Bump to hacking 1.1.0
* Minor changes to fix some new checks. * Use pycodestyle directly instead of pep8. Change-Id: I5fbe877f8d05c1b25bf760e52ea8abdfd0a2d8d9
This commit is contained in:
parent
973cafd79b
commit
2c9e9f5f41
@ -17,7 +17,7 @@ import os
|
||||
|
||||
# Eventlet's GreenDNS Patching will prevent the resolution of names in
|
||||
# the /etc/hosts file, causing problems for installs.
|
||||
os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
|
||||
os.environ['EVENTLET_NO_GREENDNS'] = 'yes' # noqa
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_concurrency import lockutils
|
||||
|
@ -207,8 +207,8 @@ class MaintenanceMiddleware(base.Middleware):
|
||||
return None
|
||||
|
||||
# If the caller has the bypass role, let them through
|
||||
if ('context' in request.environ
|
||||
and self.role in request.environ['context'].roles):
|
||||
if ('context' in request.environ and
|
||||
self.role in request.environ['context'].roles):
|
||||
LOG.warning('Request authorized to bypass maintenance mode')
|
||||
return None
|
||||
|
||||
|
@ -317,8 +317,8 @@ class Service(service.RPCService, service.Service):
|
||||
raise exceptions.InvalidRecordSetName('Name too long')
|
||||
|
||||
# RecordSets must be contained in the parent zone
|
||||
if (recordset_name != zone['name']
|
||||
and not recordset_name.endswith("." + zone['name'])):
|
||||
if (recordset_name != zone['name'] and
|
||||
not recordset_name.endswith("." + zone['name'])):
|
||||
raise exceptions.InvalidRecordSetLocation(
|
||||
'RecordSet is not contained within it\'s parent zone')
|
||||
|
||||
@ -340,8 +340,8 @@ class Service(service.RPCService, service.Service):
|
||||
|
||||
recordsets = self.storage.find_recordsets(context, criterion)
|
||||
|
||||
if ((len(recordsets) == 1 and recordsets[0].id != recordset_id)
|
||||
or len(recordsets) > 1):
|
||||
if ((len(recordsets) == 1 and recordsets[0].id != recordset_id) or
|
||||
len(recordsets) > 1):
|
||||
raise exceptions.InvalidRecordSetLocation(
|
||||
'CNAME recordsets may not share a name with any other records')
|
||||
|
||||
|
@ -11,15 +11,9 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
from designate.conf import base # noqa
|
||||
|
||||
base.register_opts(CONF) # noqa
|
||||
|
||||
from designate.conf import akamai
|
||||
from designate.conf import agent
|
||||
from designate.conf import api
|
||||
@ -45,6 +39,9 @@ from designate.conf import sink
|
||||
from designate.conf import storage
|
||||
from designate.conf import worker
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
base.register_opts(CONF)
|
||||
akamai.register_opts(CONF)
|
||||
agent.register_opts(CONF)
|
||||
api.register_opts(CONF)
|
||||
|
@ -14,8 +14,7 @@
|
||||
# under the License.
|
||||
import re
|
||||
|
||||
import pep8
|
||||
|
||||
import pycodestyle
|
||||
|
||||
# D701: Default parameter value is a mutable type
|
||||
# D702: Log messages require translation
|
||||
@ -27,7 +26,6 @@ import pep8
|
||||
# D708: Do not use xrange. Use range, or six.moves.range for large loops.
|
||||
# D709: LOG.audit is deprecated, please use LOG.info!
|
||||
|
||||
|
||||
UNDERSCORE_IMPORT_FILES = []
|
||||
|
||||
|
||||
@ -47,7 +45,7 @@ graduated_oslo_libraries_import_re = re.compile(
|
||||
|
||||
|
||||
def mutable_default_arguments(logical_line, physical_line, filename):
|
||||
if pep8.noqa(physical_line):
|
||||
if pycodestyle.noqa(physical_line):
|
||||
return
|
||||
|
||||
if mutable_default_argument_check.match(logical_line):
|
||||
|
@ -127,9 +127,10 @@ class NotifyEndpoint(base.BaseEndpoint):
|
||||
response, retry_cnt = self._make_and_send_dns_message(
|
||||
zone, host, port, timeout, retry_interval, retries_left)
|
||||
|
||||
if response and (response.rcode() in (
|
||||
dns.rcode.NXDOMAIN, dns.rcode.REFUSED, dns.rcode.SERVFAIL)
|
||||
or not bool(response.answer)):
|
||||
if response and (response.rcode() in (dns.rcode.NXDOMAIN,
|
||||
dns.rcode.REFUSED,
|
||||
dns.rcode.SERVFAIL) or
|
||||
not bool(response.answer)):
|
||||
status = 'NO_ZONE'
|
||||
if zone.serial == 0 and zone.action in ('DELETE', 'NONE'):
|
||||
actual_serial = 0
|
||||
|
@ -128,13 +128,13 @@ class DesignateObject(base.VersionedObject):
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
"""Enforces all object attributes are private or well defined"""
|
||||
if not (name[0:5] == '_obj_'
|
||||
or name[0:7] == '_change'
|
||||
or name == '_context'
|
||||
or name in list(six.iterkeys(self.fields))
|
||||
or name == 'FIELDS'
|
||||
or name == 'VERSION'
|
||||
or name == 'fields'):
|
||||
if not (name[0:5] == '_obj_' or
|
||||
name[0:7] == '_change' or
|
||||
name == '_context' or
|
||||
name in list(six.iterkeys(self.fields)) or
|
||||
name == 'FIELDS' or
|
||||
name == 'VERSION' or
|
||||
name == 'fields'):
|
||||
raise AttributeError(
|
||||
"Designate object '%(type)s' has no"
|
||||
"attribute '%(name)s'" % {
|
||||
@ -507,9 +507,9 @@ class DesignateRegistry(base.VersionedObjectRegistry):
|
||||
self._changed_fields.add(name)
|
||||
# TODO(daidv): _obj_original_values shoud be removed
|
||||
# after OVO migration completed.
|
||||
if (self.obj_attr_is_set(name) and value != getattr(self, name)
|
||||
and name not in list(six.iterkeys(
|
||||
self._obj_original_values))):
|
||||
if (self.obj_attr_is_set(name) and
|
||||
value != getattr(self, name) and
|
||||
name not in list(six.iterkeys(self._obj_original_values))): # noqa
|
||||
self._obj_original_values[name] = getattr(self, name)
|
||||
try:
|
||||
return setattr(self, attrname, field_value)
|
||||
|
@ -93,11 +93,9 @@ class IntegerFields(IntegerField):
|
||||
class StringFields(ovoo_fields.StringField):
|
||||
RE_HOSTNAME = r'^(?!.{255,})(?:(?:^\*|(?!\-)[A-Za-z0-9_\-]{1,63})(?<!\-)\.)+\Z' # noqa
|
||||
RE_ZONENAME = r'^(?!.{255,})(?:(?!\-)[A-Za-z0-9_\-]{1,63}(?<!\-)\.)+\Z'
|
||||
RE_SRV_HOST_NAME = r'^(?:(?!\-)(?:\_[A-Za-z0-9_\-]{1,63}\.){2})(?!.{255,})'\
|
||||
r'(?:(?!\-)[A-Za-z0-9_\-]{1,63}(?<!\-)\.)+\Z'
|
||||
RE_SRV_HOST_NAME = r'^(?:(?!\-)(?:\_[A-Za-z0-9_\-]{1,63}\.){2})(?!.{255,})(?:(?!\-)[A-Za-z0-9_\-]{1,63}(?<!\-)\.)+\Z' # noqa
|
||||
RE_SSHFP_FINGERPRINT = r'^([0-9A-Fa-f]{10,40}|[0-9A-Fa-f]{64})\Z'
|
||||
RE_TLDNAME = r'^(?!.{255,})(?:(?!\-)[A-Za-z0-9_\-]{1,63}(?<!\-))' \
|
||||
r'(?:\.(?:(?!\-)[A-Za-z0-9_\-]{1,63}(?<!\-)))*\Z'
|
||||
RE_TLDNAME = r'^(?!.{255,})(?:(?!\-)[A-Za-z0-9_\-]{1,63}(?<!\-))(?:\.(?:(?!\-)[A-Za-z0-9_\-]{1,63}(?<!\-)))*\Z' # noqa
|
||||
RE_NAPTR_FLAGS = r'^(?!.*(.).*\1)[APSU]+$'
|
||||
RE_NAPTR_SERVICE = r'^([A-Za-z]([A-Za-z0-9]*)(\+[A-Za-z]([A-Za-z0-9]{0,31}))*)?' # noqa
|
||||
RE_NAPTR_REGEXP = r'^([^0-9i\\])(.*)\1((.+)|(\\[1-9]))\1(i?)'
|
||||
|
@ -11,6 +11,17 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import functools
|
||||
import threading
|
||||
|
||||
from oslo_config import cfg
|
||||
import oslo_messaging as messaging
|
||||
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from designate import objects
|
||||
import designate.context
|
||||
import designate.exceptions
|
||||
|
||||
__all__ = [
|
||||
'init',
|
||||
@ -25,17 +36,6 @@ __all__ = [
|
||||
'get_notifier',
|
||||
]
|
||||
|
||||
import functools
|
||||
from oslo_config import cfg
|
||||
import oslo_messaging as messaging
|
||||
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
|
||||
from oslo_serialization import jsonutils
|
||||
import threading
|
||||
|
||||
import designate.context
|
||||
import designate.exceptions
|
||||
from designate import objects
|
||||
|
||||
CONF = cfg.CONF
|
||||
EXPECTED_EXCEPTION = threading.local()
|
||||
NOTIFICATION_TRANSPORT = None
|
||||
|
@ -23,8 +23,8 @@ def type_draft3(validator, types, instance, schema):
|
||||
types = _utils.ensure_list(types)
|
||||
|
||||
# NOTE(kiall): A datetime object is not a string, but is still valid.
|
||||
if ('format' in schema and schema['format'] == 'date-time'
|
||||
and isinstance(instance, datetime.datetime)):
|
||||
if ('format' in schema and schema['format'] == 'date-time' and
|
||||
isinstance(instance, datetime.datetime)):
|
||||
return
|
||||
|
||||
all_errors = []
|
||||
@ -71,8 +71,8 @@ def type_draft4(validator, types, instance, schema):
|
||||
types = _utils.ensure_list(types)
|
||||
|
||||
# NOTE(kiall): A datetime object is not a string, but is still valid.
|
||||
if ('format' in schema and schema['format'] == 'date-time'
|
||||
and isinstance(instance, datetime.datetime)):
|
||||
if ('format' in schema and schema['format'] == 'date-time' and
|
||||
isinstance(instance, datetime.datetime)):
|
||||
return
|
||||
|
||||
if not any(validator.is_type(instance, type) for type in types):
|
||||
|
@ -3,7 +3,7 @@
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
hacking>=1.1.0,<1.2.0 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
mock>=2.0.0 # BSD
|
||||
|
Loading…
Reference in New Issue
Block a user