Update hacking version to latest

This resolves extranous "improper escape sequence" warnings on
python 3.6+[1].

Note, this does not resolve those warnings from pylint. There
is already another proposed patch to address pylint[2].

[1] https://review.opendev.org/494322
[2] https://review.opendev.org/635236

Change-Id: Ie160436913e4d935bab118d31ba10193ac38bd8f
This commit is contained in:
zhulingjie 2019-01-04 23:59:14 +08:00 committed by Michael Johnson
parent 2c99d0109c
commit ff50886d79
9 changed files with 16 additions and 16 deletions

View File

@ -30,7 +30,7 @@ def get_haproxy_versions():
version = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
version_re = re.search('.*version (.+?)\.(.+?)\..*',
version_re = re.search(r'.*version (.+?)\.(.+?)\..*',
version.decode('utf-8'))
major_version = int(version_re.group(1))

View File

@ -483,17 +483,17 @@ class Listener(object):
with open(util.config_path(listener_id), 'r') as file:
cfg = file.read()
m = re.search('mode\s+(http|tcp)', cfg)
m = re.search(r'mode\s+(http|tcp)', cfg)
if not m:
raise ParsingError()
mode = m.group(1).upper()
m = re.search('stats socket\s+(\S+)', cfg)
m = re.search(r'stats socket\s+(\S+)', cfg)
if not m:
raise ParsingError()
stats_socket = m.group(1)
m = re.search('ssl crt\s+(\S+)', cfg)
m = re.search(r'ssl crt\s+(\S+)', cfg)
ssl_crt = None
if m:
ssl_crt = m.group(1)
@ -514,7 +514,7 @@ class Listener(object):
def _check_ssl_filename_format(self, filename):
# check if the format is (xxx.)*xxx.pem
if not re.search('(\w.)+pem', filename):
if not re.search(r'(\w.)+pem', filename):
raise exceptions.HTTPException(
response=webob.Response(json=dict(
message='Filename has wrong format'), status=400))

View File

@ -70,7 +70,7 @@ def get_listener_realserver_mapping(ns_name, listener_ip_port):
if ip_obj.version == 4:
ip_to_hex_format = "0%X" % ip_obj._ip
else:
ip_to_hex_format = '\[' + ip_obj.exploded + '\]'
ip_to_hex_format = r'\[' + ip_obj.exploded + r'\]'
port_hex_format = "%.4X" % int(listener_port)
idex = ip_to_hex_format + ':' + port_hex_format

View File

@ -375,8 +375,8 @@ class ListenersController(base.BaseController):
# Make sure we have a client CA cert if they enable client auth
if ((listener.client_authentication != wtypes.Unset and
listener.client_authentication != constants.CLIENT_AUTH_NONE)
and not (db_listener.client_ca_tls_certificate_id or
listener.client_authentication != constants.CLIENT_AUTH_NONE) and
not (db_listener.client_ca_tls_certificate_id or
listener.client_ca_tls_container_ref)):
raise exceptions.ValidationException(detail=_(
"Client authentication setting %s requires a client CA "

View File

@ -41,7 +41,7 @@ _log_translation_hint = re.compile(
assert_trueinst_re = re.compile(
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
"(\w|\.|\'|\"|\[|\])+\)\)")
r"(\w|\.|\'|\"|\[|\])+\)\)")
assert_equal_in_end_with_true_or_false_re = re.compile(
r"assertEqual\((\w|[][.'\"])+ in (\w|[][.'\", ])+, (True|False)\)")
assert_equal_in_start_with_true_or_false_re = re.compile(
@ -264,7 +264,7 @@ def check_line_continuation_no_backslash(logical_line, tokens):
def revert_must_have_kwargs(logical_line):
"""O347 - Taskflow revert methods must have \*\*kwargs.
"""O347 - Taskflow revert methods must have \\*\\*kwargs.
:param logical_line: The logical line to check.
:returns: None if the logical line passes the check, otherwise a tuple

View File

@ -81,7 +81,7 @@ class TestLocalGenerator(local_csr.BaseLocalCSRTestCase):
should_expire = (datetime.datetime.utcnow() +
datetime.timedelta(seconds=2 * 365 * 24 * 60 * 60))
diff = should_expire - cert.not_valid_after
self.assertTrue(diff < datetime.timedelta(seconds=10))
self.assertLess(diff, datetime.timedelta(seconds=10))
# Make sure this is a version 3 X509.
self.assertEqual('v3', cert.version.name)
@ -126,7 +126,7 @@ class TestLocalGenerator(local_csr.BaseLocalCSRTestCase):
should_expire = (datetime.datetime.utcnow() +
datetime.timedelta(seconds=2 * 365 * 24 * 60 * 60))
diff = should_expire - cert.not_valid_after
self.assertTrue(diff < datetime.timedelta(seconds=10))
self.assertLess(diff, datetime.timedelta(seconds=10))
# Make sure this is a version 3 X509.
self.assertEqual('v3', cert.version.name)

View File

@ -967,7 +967,7 @@ def sample_l7rule_tuple(id,
type = constants.L7RULE_TYPE_SSL_DN_FIELD
compare_type = constants.L7RULE_COMPARE_TYPE_REGEX
key = 'STREET'
value = '^STREET.*NO\.$'
value = r'^STREET.*NO\.$'
invert = True
enabled = True
if sample_rule == 10:

View File

@ -71,7 +71,7 @@ class HackingTestCase(base.BaseTestCase):
return check_fns
def test_factory(self):
self.assertTrue(len(self._get_factory_checks(checks.factory)) > 0)
self.assertGreater(len(self._get_factory_checks(checks.factory)), 0)
def test_assert_true_instance(self):
self.assertEqual(1, len(list(checks.assert_true_instance(

View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=1.1.0 # Apache-2.0
requests-mock>=1.2.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
flake8-import-order==0.12 # LGPLv3