Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Remove hacking and friends from lower-constraints, they are not needed
for installation.

Change-Id: I3f23bf09ef24fe34e128102c34382da98e10f5c1
This commit is contained in:
Andreas Jaeger 2020-04-02 15:08:30 +02:00
parent 8433aba4d6
commit d90726a1eb
8 changed files with 9 additions and 8 deletions

View File

@ -7,11 +7,9 @@ debtcollector==1.2.0
eventlet==0.18.2 eventlet==0.18.2
extras==1.0.0 extras==1.0.0
fixtures==3.0.0 fixtures==3.0.0
flake8==2.5.5
funcsigs==1.0.0 funcsigs==1.0.0
gitdb==0.6.4 gitdb==0.6.4
GitPython==1.0.1 GitPython==1.0.1
hacking==0.12.0
iso8601==0.1.11 iso8601==0.1.11
keystoneauth1==3.4.0 keystoneauth1==3.4.0
linecache2==1.0.0 linecache2==1.0.0
@ -24,8 +22,6 @@ oslo.config==5.2.0
oslo.i18n==3.15.3 oslo.i18n==3.15.3
oslotest==3.2.0 oslotest==3.2.0
pbr==2.0.0 pbr==2.0.0
pep8==1.5.7
pyflakes==0.8.1
pyparsing==2.1.0 pyparsing==2.1.0
python-mimeparse==1.6.0 python-mimeparse==1.6.0
python-subunit==1.0.0 python-subunit==1.0.0

View File

@ -45,7 +45,7 @@ class QemuImgInfo(object):
r"\s+(.*?)\)\s*$"), re.I) r"\s+(.*?)\)\s*$"), re.I)
TOP_LEVEL_RE = re.compile(r"^([\w\d\s\_\-]+):(.*)$") TOP_LEVEL_RE = re.compile(r"^([\w\d\s\_\-]+):(.*)$")
SIZE_RE = re.compile(r"([0-9]+[eE][-+][0-9]+|\d*\.?\d+)" SIZE_RE = re.compile(r"([0-9]+[eE][-+][0-9]+|\d*\.?\d+)"
"\s*(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?", r"\s*(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?",
re.I) re.I)
def __init__(self, cmd_output=None, format='human'): def __init__(self, cmd_output=None, format='human'):

View File

@ -39,6 +39,7 @@ def _constant_time_compare(first, second):
result |= ord(x) ^ ord(y) result |= ord(x) ^ ord(y)
return result == 0 return result == 0
try: try:
constant_time_compare = hmac.compare_digest constant_time_compare = hmac.compare_digest
except AttributeError: except AttributeError:

View File

@ -137,6 +137,7 @@ class ImageUtilsRawTestCase(test_base.BaseTestCase):
image_info = imageutils.QemuImgInfo(example_output) image_info = imageutils.QemuImgInfo(example_output)
self._base_validation(image_info) self._base_validation(image_info)
ImageUtilsRawTestCase.generate_scenarios() ImageUtilsRawTestCase.generate_scenarios()
@ -203,6 +204,7 @@ class ImageUtilsQemuTestCase(ImageUtilsRawTestCase):
if self.encrypted is not None: if self.encrypted is not None:
self.assertEqual(image_info.encrypted, self.encrypted) self.assertEqual(image_info.encrypted, self.encrypted)
ImageUtilsQemuTestCase.generate_scenarios() ImageUtilsQemuTestCase.generate_scenarios()

View File

@ -291,6 +291,7 @@ class StringToBytesTest(test_base.BaseTestCase):
else: else:
self.assertAlmostEqual(actual, expected) self.assertAlmostEqual(actual, expected)
StringToBytesTest.generate_scenarios() StringToBytesTest.generate_scenarios()

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
hacking>=1.1.0,<1.2.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
eventlet>=0.18.2,!=0.18.3,!=0.20.1,!=0.21.0,!=0.23.0 # MIT eventlet>=0.18.2,!=0.18.3,!=0.20.1,!=0.21.0,!=0.23.0 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD

View File

@ -37,7 +37,7 @@ print('payload has %d bytes' % len(input_str))
for pattern in strutils._SANITIZE_PATTERNS_2['admin_pass']: for pattern in strutils._SANITIZE_PATTERNS_2['admin_pass']:
print('\ntesting %s' % pattern.pattern) print('\ntesting %s' % pattern.pattern)
t = timeit.Timer( t = timeit.Timer(
"re.sub(pattern, r'\g<1>***\g<2>', payload)", r"re.sub(pattern, r'\g<1>***\g<2>', payload)",
""" """
import re import re
payload = '''%s''' payload = '''%s'''

View File

@ -37,7 +37,8 @@ commands = bandit -r oslo_utils -x tests -n5
[flake8] [flake8]
# E731 skipped as assign a lambda expression # E731 skipped as assign a lambda expression
ignore = E123,E731,H405 # W504 line break after binary operator
ignore = E123,E731,H405,W504
show-source = True show-source = True
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py