diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2022-04-06 11:02:19 +0100 |
---|---|---|
committer | Takashi Natsume <takanattie@gmail.com> | 2022-04-08 17:49:08 +0900 |
commit | c408db2dd987c251e0d6f30280072d78d46515b0 (patch) | |
tree | e7c3c5470eb19a71e8941d3feda9439699ef5599 /novaclient | |
parent | 52cdbd271ed9fbaa0f08a4f74f0a1c44552698fa (diff) | |
download | python-novaclient-c408db2dd987c251e0d6f30280072d78d46515b0.tar.gz |
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 <stephenfin@redhat.com>
Diffstat (limited to 'novaclient')
-rw-r--r-- | novaclient/tests/unit/v2/test_shell.py | 18 | ||||
-rw-r--r-- | novaclient/utils.py | 9 | ||||
-rw-r--r-- | novaclient/v2/shell.py | 10 |
3 files changed, 22 insertions, 15 deletions
diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index e6c0fda7..da70e3cc 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 fba708b5..d0219795 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 dfe93c01..58823fc7 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: |