diff --git a/lower-constraints.txt b/lower-constraints.txt index 8b9707d3..e01e89b2 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -23,14 +23,11 @@ eventlet==0.18.2 extras==1.0.0 fasteners==0.7.0 fixtures==3.0.0 -flake8-import-order==0.12 -flake8==2.6.2 future==0.16.0 futurist==1.2.0 gitdb==0.6.4 GitPython==1.0.1 greenlet==0.4.10 -hacking==1.1.0 httplib2==0.9.1 imagesize==0.7.1 iso8601==0.1.11 @@ -93,7 +90,6 @@ Paste==2.0.2 PasteDeploy==1.5.0 pbr==4.0.0 pecan==1.3.2 -pep8==1.5.7 pika-pool==0.1.3 pika==0.10.0 positional==1.2.1 @@ -102,7 +98,6 @@ psutil==3.2.2 pycadf==1.1.0 pycodestyle==2.4.0 pycparser==2.18 -pyflakes==0.8.1 Pygments==2.2.0 pyinotify==0.9.6 pylint==2.2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 514b0b82..04eb7ecb 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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>=3.0,<3.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD mock>=3.0.0 # BSD diff --git a/tox.ini b/tox.ini index a6c1a197..3f2015e5 100644 --- a/tox.ini +++ b/tox.ini @@ -67,6 +67,11 @@ builtins = _ # H106: Don't put vim configuration in source files # H203: Use assertIs(Not)None to check for None 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 [hacking] diff --git a/tricircle/api/controllers/job.py b/tricircle/api/controllers/job.py index ce15adec..062e23f2 100755 --- a/tricircle/api/controllers/job.py +++ b/tricircle/api/controllers/job.py @@ -84,13 +84,13 @@ class AsyncJobController(rest.RestController): redundant_fields = request_fields - require_fields if missing_fields: - return utils.format_api_error( - 400, _('Some required fields are not specified:' - ' %(field)s') % {'field': missing_fields}) + return utils.format_api_error( + 400, _('Some required fields are not specified:' + ' %(field)s') % {'field': missing_fields}) if redundant_fields: - return utils.format_api_error( - 400, _('Some fields are redundant: %(field)s') % { - 'field': redundant_fields}) + return utils.format_api_error( + 400, _('Some fields are redundant: %(field)s') % { + 'field': redundant_fields}) # validate whether the project id is legal resource_type_1, resource_id_1 = ( diff --git a/tricircle/cmd/manage.py b/tricircle/cmd/manage.py index 16eedb54..bef841d6 100644 --- a/tricircle/cmd/manage.py +++ b/tricircle/cmd/manage.py @@ -43,6 +43,7 @@ def add_command_parsers(subparsers): parser.set_defaults(func=do_db_sync) parser.add_argument('version', nargs='?') + command_opt = cfg.SubCommandOpt('command', title='Commands', help='Show available commands.', diff --git a/tricircle/cmd/status.py b/tricircle/cmd/status.py index 5f0437cf..10bad2a9 100644 --- a/tricircle/cmd/status.py +++ b/tricircle/cmd/status.py @@ -50,5 +50,6 @@ def main(): return upgradecheck.main( cfg.CONF, project='tricircle', upgrade_command=Checks()) + if __name__ == '__main__': sys.exit(main()) diff --git a/tricircle/cmd/xjob.py b/tricircle/cmd/xjob.py index 216a796e..4523e349 100644 --- a/tricircle/cmd/xjob.py +++ b/tricircle/cmd/xjob.py @@ -53,5 +53,6 @@ def main(): xservice.wait() + if __name__ == '__main__': main() diff --git a/tricircle/common/exceptions.py b/tricircle/common/exceptions.py index 326194ff..74be97be 100644 --- a/tricircle/common/exceptions.py +++ b/tricircle/common/exceptions.py @@ -90,7 +90,7 @@ class TricircleException(Exception): def _should_format(self): 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') return self.kwargs['message'] is None or '%(message)' in self.message diff --git a/tricircle/common/serializer.py b/tricircle/common/serializer.py index 289d0d33..2d40108d 100644 --- a/tricircle/common/serializer.py +++ b/tricircle/common/serializer.py @@ -26,6 +26,7 @@ class Mapping(object): for key, value in six.iteritems(mapping): self.reverse_mapping[value] = key + _SINGLETON_MAPPING = Mapping({ ATTR_NOT_SPECIFIED: "@@**ATTR_NOT_SPECIFIED**@@", }) diff --git a/tricircle/db/models.py b/tricircle/db/models.py index 7fd47cee..6f550065 100644 --- a/tricircle/db/models.py +++ b/tricircle/db/models.py @@ -154,7 +154,7 @@ class DeletingResources(core.ModelBase, core.DictBase): __table_args__ = ( schema.UniqueConstraint( - 'resource_id', 'resource_type', + 'resource_id', 'resource_type', name='deleting_resources0resource_id0resource_type'), ) diff --git a/tricircle/tests/unit/api/controllers/test_job.py b/tricircle/tests/unit/api/controllers/test_job.py index eb6a22e6..e512e8fe 100755 --- a/tricircle/tests/unit/api/controllers/test_job.py +++ b/tricircle/tests/unit/api/controllers/test_job.py @@ -482,7 +482,7 @@ class AsyncJobControllerTest(base.TestCase): # test marker and limit 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} res = self.controller.get_all(**job_paginate_filter) while 'jobs_links' in res: diff --git a/tricircle/tests/unit/api/controllers/test_routing.py b/tricircle/tests/unit/api/controllers/test_routing.py index 740d77e5..ee4d5aad 100644 --- a/tricircle/tests/unit/api/controllers/test_routing.py +++ b/tricircle/tests/unit/api/controllers/test_routing.py @@ -173,7 +173,7 @@ class RoutingControllerTest(base.TestCase): self.assertEqual(1, len(items)) # 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 = [] total_pages = 0 @@ -201,7 +201,7 @@ class RoutingControllerTest(base.TestCase): self.assertEqual(pages, total_pages) 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']) set1 = set(['router', 'security_group', 'network']) diff --git a/tricircle/tests/unit/network/test_central_plugin.py b/tricircle/tests/unit/network/test_central_plugin.py index 4a7019a3..4ab9ad7e 100644 --- a/tricircle/tests/unit/network/test_central_plugin.py +++ b/tricircle/tests/unit/network/test_central_plugin.py @@ -1530,8 +1530,6 @@ class PluginTest(unittest.TestCase, 'id': b_port_id, 'name': b_port_id, 'description': 'old_bottom_description', - 'extra_dhcp_opts': [], - 'device_owner': device_onwer, 'security_groups': [], 'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470', 'admin_state_up': True, diff --git a/tricircle/tests/unit/network/test_central_sfc_plugin.py b/tricircle/tests/unit/network/test_central_sfc_plugin.py index 1202e58d..c03dd769 100644 --- a/tricircle/tests/unit/network/test_central_sfc_plugin.py +++ b/tricircle/tests/unit/network/test_central_sfc_plugin.py @@ -138,7 +138,7 @@ class FakeClient(test_utils.FakeClient): if not pp: raise client_exceptions.NotFound() 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: pc_list = self._res_map[self.region_name][constants.RT_PORT_CHAIN] for pc in pc_list: diff --git a/tricircle/tests/unit/network/test_central_trunk_driver.py b/tricircle/tests/unit/network/test_central_trunk_driver.py index fa449205..0484f29b 100644 --- a/tricircle/tests/unit/network/test_central_trunk_driver.py +++ b/tricircle/tests/unit/network/test_central_trunk_driver.py @@ -299,8 +299,6 @@ class PluginTest(unittest.TestCase): 'id': t_port_id, 'name': t_port_id, 'description': 'old_bottom_description', - 'extra_dhcp_opts': [], - 'device_owner': device_onwer, 'security_groups': [], 'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470', 'admin_state_up': True, diff --git a/tricircle/tests/unit/network/test_central_trunk_plugin.py b/tricircle/tests/unit/network/test_central_trunk_plugin.py index 39505da1..6d638b45 100644 --- a/tricircle/tests/unit/network/test_central_trunk_plugin.py +++ b/tricircle/tests/unit/network/test_central_trunk_plugin.py @@ -299,8 +299,6 @@ class PluginTest(unittest.TestCase): 'id': t_port_id, 'name': t_port_id, 'description': 'old_bottom_description', - 'extra_dhcp_opts': [], - 'device_owner': device_onwer, 'security_groups': [], 'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470', 'admin_state_up': True, diff --git a/tricircle/tests/unit/utils.py b/tricircle/tests/unit/utils.py index 901470ed..8a1a5bc9 100644 --- a/tricircle/tests/unit/utils.py +++ b/tricircle/tests/unit/utils.py @@ -621,7 +621,7 @@ class FakeClient(object): return None def delete_resources(self, _type, ctx, _id): - if _type is 'policy': + if _type == 'policy': _type = 'qos_policy' index = -1 res_list = self._res_map[self.region_name][_type] diff --git a/tricircle/tests/unit/xjob/test_xmanager.py b/tricircle/tests/unit/xjob/test_xmanager.py index abe4735d..d669f106 100644 --- a/tricircle/tests/unit/xjob/test_xmanager.py +++ b/tricircle/tests/unit/xjob/test_xmanager.py @@ -624,9 +624,9 @@ class XManagerTest(unittest.TestCase): 'net2_pod2_inf': '10.0.2.3', 'net3_pod1_inf': '10.0.3.5', '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)] - 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)] bridge_infos = []