From 6419533f436c6c369e05662c6ced26ad0bc68240 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 14 Jun 2019 11:51:52 +0100 Subject: [PATCH] Bump hacking version Pick up newer versions of this library. Thankfully no serious changes are needed. Change-Id: I69e523844529fc1c8aa0c1ce764182dbe29cfeb6 Signed-off-by: Stephen Finucane --- lower-constraints.txt | 7 +-- openstackclient/common/configuration.py | 2 +- openstackclient/compute/v2/hypervisor.py | 2 +- openstackclient/compute/v2/server.py | 58 +++++++++---------- .../network/v2/network_segment_range.py | 2 +- openstackclient/shell.py | 1 + .../tests/unit/compute/v2/fakes.py | 2 +- .../tests/unit/network/v2/fakes.py | 2 +- test-requirements.txt | 3 +- tox.ini | 5 +- 10 files changed, 41 insertions(+), 43 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index c3dc477ea..710ff0e1c 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -22,14 +22,14 @@ extras==1.0.0 fasteners==0.7.0 fixtures==3.0.0 flake8-import-order==0.13 -flake8==2.5.5 +flake8==2.6.2 future==0.16.0 futurist==1.2.0 gitdb==0.6.4 GitPython==1.0.1 gnocchiclient==3.3.1 greenlet==0.4.10 -hacking==0.12.0 +hacking==1.1.0 httplib2==0.9.1 idna==2.6 iso8601==0.1.11 @@ -71,14 +71,13 @@ paramiko==2.0.0 Paste==2.0.2 PasteDeploy==1.5.0 pbr==2.0.0 -pep8==1.5.7 pika-pool==0.1.3 pika==0.10.0 ply==3.10 positional==1.2.1 prettytable==0.7.2 pyasn1==0.1.8 -pycodestyle==2.3.1 +pycodestyle==2.0.0 pycparser==2.18 pyflakes==0.8.1 pyinotify==0.9.6 diff --git a/openstackclient/common/configuration.py b/openstackclient/common/configuration.py index 57825bb05..ce646b1e4 100644 --- a/openstackclient/common/configuration.py +++ b/openstackclient/common/configuration.py @@ -52,6 +52,6 @@ class ShowConfiguration(command.ShowOne): info = self.app.client_manager.get_configuration() for key, value in six.iteritems(info.pop('auth', {})): if parsed_args.mask and key.lower() in secret_opts: - value = REDACTED + value = REDACTED info['auth.' + key] = value return zip(*sorted(six.iteritems(info))) diff --git a/openstackclient/compute/v2/hypervisor.py b/openstackclient/compute/v2/hypervisor.py index 406aa9175..0d367fee8 100644 --- a/openstackclient/compute/v2/hypervisor.py +++ b/openstackclient/compute/v2/hypervisor.py @@ -112,7 +112,7 @@ class ShowHypervisor(command.ShowOne): # example: 17:37:14 up 2:33, 3 users, # load average: 0.33, 0.36, 0.34 m = re.match( - "\s*(.+)\sup\s+(.+),\s+(.+)\susers?,\s+load average:\s(.+)", + r"\s*(.+)\sup\s+(.+),\s+(.+)\susers?,\s+load average:\s(.+)", uptime['uptime']) if m: hypervisor["host_time"] = m.group(1) diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 95c2f28a8..5922dc500 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -79,37 +79,37 @@ def _format_servers_list_power_state(state): def _get_ip_address(addresses, address_type, ip_address_family): - # Old style addresses - if address_type in addresses: - for addy in addresses[address_type]: + # Old style addresses + if address_type in addresses: + for addy in addresses[address_type]: + if int(addy['version']) in ip_address_family: + return addy['addr'] + + # New style addresses + new_address_type = address_type + if address_type == 'public': + new_address_type = 'floating' + if address_type == 'private': + new_address_type = 'fixed' + for network in addresses: + for addy in addresses[network]: + # Case where it is list of strings + if isinstance(addy, six.string_types): + if new_address_type == 'fixed': + return addresses[network][0] + else: + return addresses[network][-1] + # Case where it is a dict + if 'OS-EXT-IPS:type' not in addy: + continue + if addy['OS-EXT-IPS:type'] == new_address_type: if int(addy['version']) in ip_address_family: return addy['addr'] - - # New style addresses - new_address_type = address_type - if address_type == 'public': - new_address_type = 'floating' - if address_type == 'private': - new_address_type = 'fixed' - for network in addresses: - for addy in addresses[network]: - # Case where it is list of strings - if isinstance(addy, six.string_types): - if new_address_type == 'fixed': - return addresses[network][0] - else: - return addresses[network][-1] - # Case where it is a dict - if 'OS-EXT-IPS:type' not in addy: - continue - if addy['OS-EXT-IPS:type'] == new_address_type: - if int(addy['version']) in ip_address_family: - return addy['addr'] - msg = _("ERROR: No %(type)s IP version %(family)s address found") - raise exceptions.CommandError( - msg % {"type": address_type, - "family": ip_address_family} - ) + msg = _("ERROR: No %(type)s IP version %(family)s address found") + raise exceptions.CommandError( + msg % {"type": address_type, + "family": ip_address_family} + ) def _prefix_checked_value(prefix): diff --git a/openstackclient/network/v2/network_segment_range.py b/openstackclient/network/v2/network_segment_range.py index 567b5b6eb..b938bdd92 100644 --- a/openstackclient/network/v2/network_segment_range.py +++ b/openstackclient/network/v2/network_segment_range.py @@ -358,7 +358,7 @@ class ListNetworkSegmentRange(command.Lister): parsed_args.used and _is_prop_empty(columns, props, 'used') or \ parsed_args.unused and \ not _is_prop_empty(columns, props, 'used'): - continue + continue if parsed_args.long: props = _update_additional_fields_from_props(columns, props) display_props += (props,) diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 22d8412cc..86aa032b6 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -209,5 +209,6 @@ def main(argv=None): return OpenStackShell().run(argv) + if __name__ == "__main__": sys.exit(main()) diff --git a/openstackclient/tests/unit/compute/v2/fakes.py b/openstackclient/tests/unit/compute/v2/fakes.py index ee7d49831..7357e1430 100644 --- a/openstackclient/tests/unit/compute/v2/fakes.py +++ b/openstackclient/tests/unit/compute/v2/fakes.py @@ -505,7 +505,7 @@ class FakeSecurityGroup(object): @staticmethod def get_security_groups(security_groups=None, count=2): - """Get an iterable MagicMock object with a list of faked security groups. + """Get an iterable MagicMock with a list of faked security groups. If security groups list is provided, then initialize the Mock object with the list. Otherwise create one. diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py index e41621a48..1519bd4b8 100644 --- a/openstackclient/tests/unit/network/v2/fakes.py +++ b/openstackclient/tests/unit/network/v2/fakes.py @@ -1344,7 +1344,7 @@ class FakeSecurityGroupRule(object): @staticmethod def get_security_group_rules(security_group_rules=None, count=2): - """Get an iterable Mock object with a list of faked security group rules. + """Get an iterable Mock with a list of faked security group rules. If security group rules list is provided, then initialize the Mock object with the list. Otherwise create one. diff --git a/test-requirements.txt b/test-requirements.txt index 4cb66cfdb..64e7a0773 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +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,<1.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD flake8-import-order==0.13 # LGPLv3 diff --git a/tox.ini b/tox.ini index eaf66bc49..a973b107f 100644 --- a/tox.ini +++ b/tox.ini @@ -132,9 +132,8 @@ show-source = True # H203: Use assertIs(Not)None to check for None enable-extensions = H203 exclude = .git,.tox,dist,doc,*lib/python*,*egg,build,tools -# If 'ignore' is not set there are default errors and warnings that are set -# Doc: http://flake8.readthedocs.org/en/latest/config.html#default -ignore = __ +# W504 is disabled since you must choose between this or W503 +ignore = W504 import-order-style = pep8 application_import_names = openstackclient