From 2d93d2e1ed9f1661c98243d8754faf870cbbe80a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 28 Jan 2024 16:26:45 +0900 Subject: [PATCH] Bump hacking hacking 3.0.x is too old. This also pulls the hacking options from neutron. Change-Id: Ic1a428a05131f98d5a9050b83613c5478904f202 --- neutronclient/common/utils.py | 2 +- neutronclient/neutron/v2_0/bgp/speaker.py | 2 +- neutronclient/osc/v2/sfc/sfc_port_pair_group.py | 2 +- neutronclient/osc/v2/sfc/sfc_service_graph.py | 4 ++-- .../tests/unit/osc/v2/sfc/test_flow_classifier.py | 2 +- .../tests/unit/osc/v2/sfc/test_port_chain.py | 4 ++-- .../tests/unit/osc/v2/sfc/test_service_graph.py | 14 +++++++------- requirements.txt | 4 ---- test-requirements.txt | 7 ++----- tox.ini | 15 ++++++++++++++- 10 files changed, 31 insertions(+), 25 deletions(-) diff --git a/neutronclient/common/utils.py b/neutronclient/common/utils.py index 38274018c..93f92fd19 100644 --- a/neutronclient/common/utils.py +++ b/neutronclient/common/utils.py @@ -138,7 +138,7 @@ def str2dict(strdict, required_keys=None, optional_keys=None): msg = _("missing value for key '%s'") raise argparse.ArgumentTypeError(msg % kv) else: - kvlist[i-1] = "%s,%s" % (kvlist[i-1], kv) + kvlist[i - 1] = "%s,%s" % (kvlist[i - 1], kv) for kv in kvlist: key, sep, value = kv.partition('=') if not sep: diff --git a/neutronclient/neutron/v2_0/bgp/speaker.py b/neutronclient/neutron/v2_0/bgp/speaker.py index 6bdbd86f2..34ce22eb8 100644 --- a/neutronclient/neutron/v2_0/bgp/speaker.py +++ b/neutronclient/neutron/v2_0/bgp/speaker.py @@ -189,7 +189,7 @@ class RemovePeerFromSpeaker(neutronv20.NeutronCommand): neutron_client.remove_peer_from_bgp_speaker(_speaker_id, {'bgp_peer_id': _peer_id}) print(_('Removed BGP peer %(peer)s from BGP speaker %(speaker)s.') % - {'peer': parsed_args.bgp_peer, + {'peer': parsed_args.bgp_peer, 'speaker': parsed_args.bgp_speaker}, file=self.app.stdout) diff --git a/neutronclient/osc/v2/sfc/sfc_port_pair_group.py b/neutronclient/osc/v2/sfc/sfc_port_pair_group.py index 5ad3ebea7..ec8859b42 100755 --- a/neutronclient/osc/v2/sfc/sfc_port_pair_group.py +++ b/neutronclient/osc/v2/sfc/sfc_port_pair_group.py @@ -34,7 +34,7 @@ _attr_map = ( ('port_pair_group_parameters', 'Port Pair Group Parameters', column_util.LIST_BOTH), ('description', 'Description', column_util.LIST_LONG_ONLY), - ('project_id', 'Project', column_util.LIST_LONG_ONLY), + ('project_id', 'Project', column_util.LIST_LONG_ONLY), ('is_tap_enabled', 'Tap Enabled', column_util.LIST_BOTH) ) diff --git a/neutronclient/osc/v2/sfc/sfc_service_graph.py b/neutronclient/osc/v2/sfc/sfc_service_graph.py index 6c87d95fe..2edf2ccd0 100644 --- a/neutronclient/osc/v2/sfc/sfc_service_graph.py +++ b/neutronclient/osc/v2/sfc/sfc_service_graph.py @@ -213,8 +213,8 @@ def _validate_destination_chains(comma_split, attrs, client, sc_): dc_ = client.find_sfc_port_chain(e, ignore_missing=False)['id'] attrs['port_chains'][sc_].append(dc_) if _check_cycle(attrs['port_chains'], sc_, dc_): - raise(exceptions.CommandError( - "Error: Service graph contains a cycle")) + raise exceptions.CommandError( + "Error: Service graph contains a cycle") else: raise exceptions.CommandError( "Error: you must specify at least one " diff --git a/neutronclient/tests/unit/osc/v2/sfc/test_flow_classifier.py b/neutronclient/tests/unit/osc/v2/sfc/test_flow_classifier.py index 6a9e691f9..ea1c4f3ab 100755 --- a/neutronclient/tests/unit/osc/v2/sfc/test_flow_classifier.py +++ b/neutronclient/tests/unit/osc/v2/sfc/test_flow_classifier.py @@ -137,7 +137,7 @@ class TestCreateSfcFlowClassifier(fakes.TestNeutronClientOSCV2): 'logical_destination_port': self._fc['logical_destination_port'], 'l7_parameters': param - } + } ) self.assertEqual(self.columns, columns) diff --git a/neutronclient/tests/unit/osc/v2/sfc/test_port_chain.py b/neutronclient/tests/unit/osc/v2/sfc/test_port_chain.py index 9b414c22c..15f7a431e 100755 --- a/neutronclient/tests/unit/osc/v2/sfc/test_port_chain.py +++ b/neutronclient/tests/unit/osc/v2/sfc/test_port_chain.py @@ -47,7 +47,7 @@ class TestCreateSfcPortChain(fakes.TestNeutronClientOSCV2): self._port_chain['name'], self._port_chain['port_pair_groups'], self._port_chain['project_id'], - ) + ) def setUp(self): super(TestCreateSfcPortChain, self).setUp() @@ -357,7 +357,7 @@ class TestSetSfcPortChain(fakes.TestNeutronClientOSCV2): arglist = [ target, '--no-port-pair-group', - ] + ] verifylist = [ (self.res, target), ('no_port_pair_group', True), diff --git a/neutronclient/tests/unit/osc/v2/sfc/test_service_graph.py b/neutronclient/tests/unit/osc/v2/sfc/test_service_graph.py index 50a02139d..167f1fcf8 100644 --- a/neutronclient/tests/unit/osc/v2/sfc/test_service_graph.py +++ b/neutronclient/tests/unit/osc/v2/sfc/test_service_graph.py @@ -123,8 +123,8 @@ class TestCreateSfcServiceGraph(fakes.TestNeutronClientOSCV2): arglist = [ "--description", self._service_graph['description'], - "--branching-point", bp1_str, - "--branching-point", bp2_str, + "--branching-point", bp1_str, + "--branching-point", bp2_str, self._service_graph['name']] pcs = {'pc1': ['pc2', 'pc3'], 'pc2': ['pc4']} @@ -154,8 +154,8 @@ class TestCreateSfcServiceGraph(fakes.TestNeutronClientOSCV2): arglist = [ "--description", self._service_graph['description'], - "--branching-point", bp1_str, - "--branching-point", bp2_str, + "--branching-point", bp1_str, + "--branching-point", bp2_str, self._service_graph['name']] verifylist = [ @@ -175,7 +175,7 @@ class TestCreateSfcServiceGraph(fakes.TestNeutronClientOSCV2): arglist = [ "--description", self._service_graph['description'], - "--branching-point", bp1_str, + "--branching-point", bp1_str, self._service_graph['name']] verifylist = [ @@ -196,8 +196,8 @@ class TestCreateSfcServiceGraph(fakes.TestNeutronClientOSCV2): arglist = [ "--description", self._service_graph['description'], - "--branching-point", bp1_str, - "--branching-point", bp2_str, + "--branching-point", bp1_str, + "--branching-point", bp2_str, self._service_graph['name']] verifylist = [ diff --git a/requirements.txt b/requirements.txt index 5a20fc0e6..5f10ef907 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,6 @@ # Requirements lower bounds listed here are our best effort to keep them up to # date but we do not test them so no guarantee of having them all correct. If # you find any incorrect lower bounds, let us know or propose a fix. - -# 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. pbr!=2.1.0,>=2.0.0 # Apache-2.0 cliff>=3.4.0 # Apache-2.0 debtcollector>=1.2.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index ae1f2e55d..8cd49ce02 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,12 +1,9 @@ -# 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>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=6.1.0,<6.2.0 # Apache-2.0 bandit!=1.6.0,>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD -flake8-import-order==0.12 # LGPLv3 +flake8-import-order>=0.18.0,<0.19.0 # LGPLv3 oslotest>=3.2.0 # Apache-2.0 osprofiler>=2.3.0 # Apache-2.0 python-openstackclient>=3.12.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index afdf530e2..cda43b91c 100644 --- a/tox.ini +++ b/tox.ini @@ -66,12 +66,25 @@ deps = commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] +# E126 continuation line over-indented for hanging indent +# E128 continuation line under-indented for visual indent +# H405 multi line docstring summary not separated with an empty line +# I202 Additional newline in a group of imports +# N530 direct neutron imports not allowed +# TODO(amotoki) check the following new rules should be fixed or ignored +# E731 do not assign a lambda expression, use a def +# W504 line break after binary operator +ignore = E126,E128,E731,I202,H405,N530,W504 show-source = true exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools import-order-style = pep8 +# H106: Don't put vim configuration in source files +# H203: Use assertIs(Not)None to check for None +# H204: Use assert(Not)Equal to check for equality +# H205: Use assert(Greater|Less)(Equal) for comparison # H904: Delay string interpolations at logging calls -enable-extensions=H904 +enable-extensions=H106,H203,H204,H205,H904 [testenv:bandit] # B303: blacklist calls: md5, sha1