From c408db2dd987c251e0d6f30280072d78d46515b0 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 6 Apr 2022 11:02:19 +0100 Subject: [PATCH] Update pre-commit hook, hacking versions This was done with 'pre-commit autoupdate'. An invalid message is removed from the requirements.txt files as it no longer applies with pip's new dependency resolver. Change-Id: I01c3ece51f81d67c740e6faca6b77df7c9932435 Signed-off-by: Stephen Finucane --- .pre-commit-config.yaml | 6 +++--- novaclient/tests/unit/v2/test_shell.py | 18 ++++++++++++------ novaclient/utils.py | 9 +++++---- novaclient/v2/shell.py | 10 +++++----- requirements.txt | 3 --- test-requirements.txt | 6 +----- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76fa799a2..e782b53e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: trailing-whitespace - id: mixed-line-ending @@ -16,7 +16,7 @@ repos: - id: check-yaml files: .*\.(yaml|yml)$ - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.10 + rev: v1.1.13 hooks: - id: remove-tabs exclude: '.*\.(svg)$' @@ -25,7 +25,7 @@ repos: - id: flake8 name: flake8 additional_dependencies: - - hacking>=3.0.1,<3.1.0 + - hacking~=4.1.0 language: python entry: flake8 files: '^.*\.py$' diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index e6c0fda7b..da70e3ccb 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -3397,7 +3397,8 @@ class ShellTest(utils.TestCase): def test_services_list_v269_with_down_cells(self): """Tests nova service-list at the 2.69 microversion.""" stdout, _stderr = self.run_command('service-list', api_version='2.69') - self.assertEqual('''\ + self.assertEqual( + '''\ +--------------------------------------+--------------+-----------+------+----------+-------+---------------------+-----------------+-------------+ | Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down | +--------------------------------------+--------------+-----------+------+----------+-------+---------------------+-----------------+-------------+ @@ -3406,7 +3407,8 @@ class ShellTest(utils.TestCase): | | nova-compute | host-down | | UNKNOWN | | | | | +--------------------------------------+--------------+-----------+------+----------+-------+---------------------+-----------------+-------------+ ''', # noqa - stdout) + stdout, + ) self.assert_called('GET', '/os-services') def test_services_list_with_host(self): @@ -4779,7 +4781,8 @@ class ShellTest(utils.TestCase): def test_list_detail_v269_with_down_cells(self): """Tests nova list at the 2.69 microversion.""" stdout, _stderr = self.run_command('list', api_version='2.69') - self.assertIn('''\ + self.assertIn( + '''\ +------+----------------+---------+------------+-------------+----------------------------------------------+ | ID | Name | Status | Task State | Power State | Networks | +------+----------------+---------+------------+-------------+----------------------------------------------+ @@ -4791,7 +4794,8 @@ class ShellTest(utils.TestCase): | 9013 | sample-server4 | ACTIVE | N/A | N/A | | +------+----------------+---------+------------+-------------+----------------------------------------------+ ''', # noqa - stdout) + stdout, + ) self.assert_called('GET', '/servers/detail') def test_list_v269_with_down_cells(self): @@ -4812,7 +4816,8 @@ class ShellTest(utils.TestCase): def test_show_v269_with_down_cells(self): stdout, _stderr = self.run_command('show 9015', api_version='2.69') - self.assertEqual('''\ + self.assertEqual( + '''\ +-----------------------------+---------------------------------------------------+ | Property | Value | +-----------------------------+---------------------------------------------------+ @@ -4833,7 +4838,8 @@ class ShellTest(utils.TestCase): | user_id | fake | +-----------------------------+---------------------------------------------------+ ''', # noqa - stdout) + stdout, + ) FAKE_UUID_2 = 'c99d7632-bd66-4be9-aed5-3dd14b223a76' self.assert_called('GET', '/servers?name=9015', pos=0) self.assert_called('GET', '/servers?name=9015', pos=1) diff --git a/novaclient/utils.py b/novaclient/utils.py index fba708b55..d0219795c 100644 --- a/novaclient/utils.py +++ b/novaclient/utils.py @@ -116,13 +116,14 @@ def service_type(stype): return inner -def pretty_choice_list(l): - return ', '.join("'%s'" % i for i in l) +def pretty_choice_list(values): + return ', '.join("'%s'" % x for x in values) -def pretty_choice_dict(d): +def pretty_choice_dict(values): """Returns a formatted dict as 'key=value'.""" - return pretty_choice_list(['%s=%s' % (k, d[k]) for k in sorted(d.keys())]) + return pretty_choice_list( + ['%s=%s' % (k, values[k]) for k in sorted(values)]) def print_list(objs, fields, formatters={}, sortby_index=None): diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index dfe93c01a..58823fc70 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -3231,15 +3231,15 @@ def _print_absolute_limits(limits): other = {} limit_names = [] columns = ['Name', 'Used', 'Max'] - for l in limits: - map = limit_map.get(l.name, {'name': l.name, 'type': 'other'}) + for limit in limits: + map = limit_map.get(limit.name, {'name': limit.name, 'type': 'other'}) name = map['name'] if map['type'] == 'max': - max[name] = l.value + max[name] = limit.value elif map['type'] == 'used': - used[name] = l.value + used[name] = limit.value else: - other[name] = l.value + other[name] = limit.value if 'Other' not in columns: columns.append('Other') if name not in limit_names: diff --git a/requirements.txt b/requirements.txt index b93814eba..462e1c9c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,3 @@ -# 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 keystoneauth1>=3.5.0 # Apache-2.0 iso8601>=0.1.11 # MIT diff --git a/test-requirements.txt b/test-requirements.txt index f2df90178..5845d2d50 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,4 @@ -# 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~=4.1.0 # Apache-2.0 bandit>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT