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: I02169e2f5bba669182d41a25bef1057306f74be8
This commit is contained in:
Andreas Jaeger 2020-04-02 11:47:33 +02:00
parent 4f0a2eac5e
commit 82bf693bdf
18 changed files with 25 additions and 27 deletions

View File

@ -23,14 +23,11 @@ eventlet==0.18.2
extras==1.0.0 extras==1.0.0
fasteners==0.7.0 fasteners==0.7.0
fixtures==3.0.0 fixtures==3.0.0
flake8-import-order==0.12
flake8==2.6.2
future==0.16.0 future==0.16.0
futurist==1.2.0 futurist==1.2.0
gitdb==0.6.4 gitdb==0.6.4
GitPython==1.0.1 GitPython==1.0.1
greenlet==0.4.10 greenlet==0.4.10
hacking==1.1.0
httplib2==0.9.1 httplib2==0.9.1
imagesize==0.7.1 imagesize==0.7.1
iso8601==0.1.11 iso8601==0.1.11
@ -93,7 +90,6 @@ Paste==2.0.2
PasteDeploy==1.5.0 PasteDeploy==1.5.0
pbr==4.0.0 pbr==4.0.0
pecan==1.3.2 pecan==1.3.2
pep8==1.5.7
pika-pool==0.1.3 pika-pool==0.1.3
pika==0.10.0 pika==0.10.0
positional==1.2.1 positional==1.2.1
@ -102,7 +98,6 @@ psutil==3.2.2
pycadf==1.1.0 pycadf==1.1.0
pycodestyle==2.4.0 pycodestyle==2.4.0
pycparser==2.18 pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0 Pygments==2.2.0
pyinotify==0.9.6 pyinotify==0.9.6
pylint==2.2.0 pylint==2.2.0

View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order # 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 # 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!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
mock>=3.0.0 # BSD mock>=3.0.0 # BSD

View File

@ -67,6 +67,11 @@ builtins = _
# H106: Don't put vim configuration in source files # H106: Don't put vim configuration in source files
# H203: Use assertIs(Not)None to check for None # H203: Use assertIs(Not)None to check for None
enable-extensions=H106,H203 enable-extensions=H106,H203
# E123 closing bracket does not match indentation of opening bracket's line
# E402 module level import not at top of file
# W503 line break before binary operator
# W504 line break after binary operator
ignore = E123,E402,W503,W504
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[hacking] [hacking]

View File

@ -84,13 +84,13 @@ class AsyncJobController(rest.RestController):
redundant_fields = request_fields - require_fields redundant_fields = request_fields - require_fields
if missing_fields: if missing_fields:
return utils.format_api_error( return utils.format_api_error(
400, _('Some required fields are not specified:' 400, _('Some required fields are not specified:'
' %(field)s') % {'field': missing_fields}) ' %(field)s') % {'field': missing_fields})
if redundant_fields: if redundant_fields:
return utils.format_api_error( return utils.format_api_error(
400, _('Some fields are redundant: %(field)s') % { 400, _('Some fields are redundant: %(field)s') % {
'field': redundant_fields}) 'field': redundant_fields})
# validate whether the project id is legal # validate whether the project id is legal
resource_type_1, resource_id_1 = ( resource_type_1, resource_id_1 = (

View File

@ -43,6 +43,7 @@ def add_command_parsers(subparsers):
parser.set_defaults(func=do_db_sync) parser.set_defaults(func=do_db_sync)
parser.add_argument('version', nargs='?') parser.add_argument('version', nargs='?')
command_opt = cfg.SubCommandOpt('command', command_opt = cfg.SubCommandOpt('command',
title='Commands', title='Commands',
help='Show available commands.', help='Show available commands.',

View File

@ -50,5 +50,6 @@ def main():
return upgradecheck.main( return upgradecheck.main(
cfg.CONF, project='tricircle', upgrade_command=Checks()) cfg.CONF, project='tricircle', upgrade_command=Checks())
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View File

@ -53,5 +53,6 @@ def main():
xservice.wait() xservice.wait()
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -90,7 +90,7 @@ class TricircleException(Exception):
def _should_format(self): def _should_format(self):
if self.kwargs['message'] is None and '%(message)' in self.message: if self.kwargs['message'] is None and '%(message)' in self.message:
LOG.error('\%(message)s in message ' LOG.error(r'\%(message)s in message '
'but init parameter is None') 'but init parameter is None')
return self.kwargs['message'] is None or '%(message)' in self.message return self.kwargs['message'] is None or '%(message)' in self.message

View File

@ -26,6 +26,7 @@ class Mapping(object):
for key, value in six.iteritems(mapping): for key, value in six.iteritems(mapping):
self.reverse_mapping[value] = key self.reverse_mapping[value] = key
_SINGLETON_MAPPING = Mapping({ _SINGLETON_MAPPING = Mapping({
ATTR_NOT_SPECIFIED: "@@**ATTR_NOT_SPECIFIED**@@", ATTR_NOT_SPECIFIED: "@@**ATTR_NOT_SPECIFIED**@@",
}) })

View File

@ -154,7 +154,7 @@ class DeletingResources(core.ModelBase, core.DictBase):
__table_args__ = ( __table_args__ = (
schema.UniqueConstraint( schema.UniqueConstraint(
'resource_id', 'resource_type', 'resource_id', 'resource_type',
name='deleting_resources0resource_id0resource_type'), name='deleting_resources0resource_id0resource_type'),
) )

View File

@ -482,7 +482,7 @@ class AsyncJobControllerTest(base.TestCase):
# test marker and limit # test marker and limit
limit = 2 limit = 2
pt = '/v1.0/jobs\?limit=\w+&marker=([\w-]+)' pt = r'/v1.0/jobs\?limit=\w+&marker=([\w-]+)'
job_paginate_filter = {'status': 'new', 'limit': limit} job_paginate_filter = {'status': 'new', 'limit': limit}
res = self.controller.get_all(**job_paginate_filter) res = self.controller.get_all(**job_paginate_filter)
while 'jobs_links' in res: while 'jobs_links' in res:

View File

@ -173,7 +173,7 @@ class RoutingControllerTest(base.TestCase):
self.assertEqual(1, len(items)) self.assertEqual(1, len(items))
# test when pagination limit varies in range [1, total_routings+1) # test when pagination limit varies in range [1, total_routings+1)
for i in xrange(1, total_routings+1): for i in xrange(1, total_routings + 1):
routings = [] routings = []
total_pages = 0 total_pages = 0
@ -201,7 +201,7 @@ class RoutingControllerTest(base.TestCase):
self.assertEqual(pages, total_pages) self.assertEqual(pages, total_pages)
self.assertEqual(total_routings - 1, len(routings)) self.assertEqual(total_routings - 1, len(routings))
for i in xrange(total_routings-1): for i in xrange(total_routings - 1):
self.assertEqual(total_routings - i, routings[i]['id']) self.assertEqual(total_routings - i, routings[i]['id'])
set1 = set(['router', 'security_group', 'network']) set1 = set(['router', 'security_group', 'network'])

View File

@ -1530,8 +1530,6 @@ class PluginTest(unittest.TestCase,
'id': b_port_id, 'id': b_port_id,
'name': b_port_id, 'name': b_port_id,
'description': 'old_bottom_description', 'description': 'old_bottom_description',
'extra_dhcp_opts': [],
'device_owner': device_onwer,
'security_groups': [], 'security_groups': [],
'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470', 'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470',
'admin_state_up': True, 'admin_state_up': True,

View File

@ -138,7 +138,7 @@ class FakeClient(test_utils.FakeClient):
if not pp: if not pp:
raise client_exceptions.NotFound() raise client_exceptions.NotFound()
if pp['portpairgroup_id']: if pp['portpairgroup_id']:
raise client_exceptions.Conflict(constants.STR_IN_USE) raise client_exceptions.Conflict(constants.STR_IN_USE)
elif _type == constants.RT_FLOW_CLASSIFIER: elif _type == constants.RT_FLOW_CLASSIFIER:
pc_list = self._res_map[self.region_name][constants.RT_PORT_CHAIN] pc_list = self._res_map[self.region_name][constants.RT_PORT_CHAIN]
for pc in pc_list: for pc in pc_list:

View File

@ -299,8 +299,6 @@ class PluginTest(unittest.TestCase):
'id': t_port_id, 'id': t_port_id,
'name': t_port_id, 'name': t_port_id,
'description': 'old_bottom_description', 'description': 'old_bottom_description',
'extra_dhcp_opts': [],
'device_owner': device_onwer,
'security_groups': [], 'security_groups': [],
'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470', 'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470',
'admin_state_up': True, 'admin_state_up': True,

View File

@ -299,8 +299,6 @@ class PluginTest(unittest.TestCase):
'id': t_port_id, 'id': t_port_id,
'name': t_port_id, 'name': t_port_id,
'description': 'old_bottom_description', 'description': 'old_bottom_description',
'extra_dhcp_opts': [],
'device_owner': device_onwer,
'security_groups': [], 'security_groups': [],
'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470', 'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470',
'admin_state_up': True, 'admin_state_up': True,

View File

@ -621,7 +621,7 @@ class FakeClient(object):
return None return None
def delete_resources(self, _type, ctx, _id): def delete_resources(self, _type, ctx, _id):
if _type is 'policy': if _type == 'policy':
_type = 'qos_policy' _type = 'qos_policy'
index = -1 index = -1
res_list = self._res_map[self.region_name][_type] res_list = self._res_map[self.region_name][_type]

View File

@ -624,9 +624,9 @@ class XManagerTest(unittest.TestCase):
'net2_pod2_inf': '10.0.2.3', 'net2_pod2_inf': '10.0.2.3',
'net3_pod1_inf': '10.0.3.5', 'net3_pod1_inf': '10.0.3.5',
'net3_pod2_inf': '10.0.3.6'} 'net3_pod2_inf': '10.0.3.6'}
get_gw_map = lambda n_idx, p_idx: gw_map[ get_gw_map = lambda n_idx, p_idx: gw_map[ # noqa: E731
'net%d_pod%d_gw' % (n_idx, p_idx)] 'net%d_pod%d_gw' % (n_idx, p_idx)]
get_inf_map = lambda n_idx, p_idx: inf_map[ get_inf_map = lambda n_idx, p_idx: inf_map[ # noqa: E731
'net%d_pod%d_inf' % (n_idx, p_idx)] 'net%d_pod%d_inf' % (n_idx, p_idx)]
bridge_infos = [] bridge_infos = []