pre-commit: Bump versions

We fold in the new black changes also.

Change-Id: I326a0529b6b9f2aa9fbc33862567131839460797
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2024-04-23 12:22:26 +01:00
parent a79cb608b0
commit ee23995004
13 changed files with 34 additions and 36 deletions

View File

@ -4,7 +4,7 @@ default_language_version:
python: python3 python: python3
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 rev: v4.6.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: mixed-line-ending - id: mixed-line-ending
@ -18,12 +18,12 @@ repos:
files: .*\.(yaml|yml)$ files: .*\.(yaml|yml)$
args: ['--unsafe'] args: ['--unsafe']
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.12.1 rev: 24.4.0
hooks: hooks:
- id: black - id: black
args: ['-S', '-l', '79'] args: ['-S', '-l', '79']
- repo: https://github.com/PyCQA/bandit - repo: https://github.com/PyCQA/bandit
rev: 1.7.6 rev: 1.7.8
hooks: hooks:
- id: bandit - id: bandit
args: ['-x', 'tests', '-s', 'B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101'] args: ['-x', 'tests', '-s', 'B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101']

View File

@ -1991,9 +1991,9 @@ class CreateServer(command.ShowOne):
) )
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
boot_kwargs[ boot_kwargs['hypervisor_hostname'] = (
'hypervisor_hostname' parsed_args.hypervisor_hostname
] = parsed_args.hypervisor_hostname )
if parsed_args.hostname: if parsed_args.hostname:
if compute_client.api_version < api_versions.APIVersion("2.90"): if compute_client.api_version < api_versions.APIVersion("2.90"):

View File

@ -36,16 +36,16 @@ def _format_image_cache(cached_images):
for image in cached_images[item]: for image in cached_images[item]:
image_obj = copy.deepcopy(image) image_obj = copy.deepcopy(image)
image_obj['state'] = 'cached' image_obj['state'] = 'cached'
image_obj[ image_obj['last_accessed'] = (
'last_accessed' datetime.datetime.utcfromtimestamp(
] = datetime.datetime.utcfromtimestamp( image['last_accessed']
image['last_accessed'] ).isoformat()
).isoformat() )
image_obj[ image_obj['last_modified'] = (
'last_modified' datetime.datetime.utcfromtimestamp(
] = datetime.datetime.utcfromtimestamp( image['last_modified']
image['last_modified'] ).isoformat()
).isoformat() )
image_list.append(image_obj) image_list.append(image_obj)
elif item == "queued_images": elif item == "queued_images":
for image in cached_images[item]: for image in cached_images[item]:

View File

@ -43,8 +43,10 @@ def _get_ranges(item):
item = sorted([int(i) for i in item]) item = sorted([int(i) for i in item])
for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]): for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]):
b = list(b) b = list(b)
yield "%s-%s" % (b[0][1], b[-1][1]) if b[0][1] != b[-1][1] else str( yield (
b[0][1] "%s-%s" % (b[0][1], b[-1][1])
if b[0][1] != b[-1][1]
else str(b[0][1])
) )

View File

@ -106,9 +106,9 @@ def _get_external_gateway_attrs(client_manager, parsed_args):
attrs = {} attrs = {}
if parsed_args.external_gateways: if parsed_args.external_gateways:
external_gateways: collections.defaultdict[ external_gateways: collections.defaultdict[str, list[dict]] = (
str, list[dict] collections.defaultdict(list)
] = collections.defaultdict(list) )
n_client = client_manager.network n_client = client_manager.network
first_network_id = None first_network_id = None

View File

@ -181,8 +181,7 @@ class TestComputev2(
identity_fakes.FakeClientMixin, identity_fakes.FakeClientMixin,
FakeClientMixin, FakeClientMixin,
utils.TestCommand, utils.TestCommand,
): ): ...
...
def create_one_aggregate(attrs=None): def create_one_aggregate(attrs=None):

View File

@ -207,8 +207,7 @@ class FakeClientMixin:
class TestIdentityv2( class TestIdentityv2(
FakeClientMixin, FakeClientMixin,
utils.TestCommand, utils.TestCommand,
): ): ...
...
class FakeExtension(object): class FakeExtension(object):

View File

@ -690,8 +690,7 @@ class FakeClientMixin:
class TestIdentityv3( class TestIdentityv3(
FakeClientMixin, FakeClientMixin,
utils.TestCommand, utils.TestCommand,
): ): ...
...
# We don't use FakeClientMixin since we want a different fake legacy client # We don't use FakeClientMixin since we want a different fake legacy client

View File

@ -246,9 +246,9 @@ class TestRegisteredLimitSet(TestRegisteredLimit):
def test_registered_limit_set_description(self): def test_registered_limit_set_description(self):
registered_limit = copy.deepcopy(identity_fakes.REGISTERED_LIMIT) registered_limit = copy.deepcopy(identity_fakes.REGISTERED_LIMIT)
registered_limit[ registered_limit['description'] = (
'description' identity_fakes.registered_limit_description
] = identity_fakes.registered_limit_description )
self.registered_limit_mock.update.return_value = fakes.FakeResource( self.registered_limit_mock.update.return_value = fakes.FakeResource(
None, registered_limit, loaded=True None, registered_limit, loaded=True
) )

View File

@ -43,8 +43,7 @@ class TestImagev2(
identity_fakes.FakeClientMixin, identity_fakes.FakeClientMixin,
FakeClientMixin, FakeClientMixin,
utils.TestCommand, utils.TestCommand,
): ): ...
...
def create_one_image(attrs=None): def create_one_image(attrs=None):

View File

@ -894,7 +894,7 @@ class TestImageList(TestImage):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.image_client.images.assert_called_with( self.image_client.images.assert_called_with(
limit=ret_limit, limit=ret_limit,
paginated=False paginated=False,
# marker=None # marker=None
) )

View File

@ -104,8 +104,7 @@ class TestNetworkV2(
identity_fakes.FakeClientMixin, identity_fakes.FakeClientMixin,
FakeClientMixin, FakeClientMixin,
utils.TestCommand, utils.TestCommand,
): ): ...
...
def create_one_extension(attrs=None): def create_one_extension(attrs=None):

View File

@ -124,8 +124,9 @@ show-source = true
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,releasenotes exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,releasenotes
# E203 Black will put spaces after colons in list comprehensions # E203 Black will put spaces after colons in list comprehensions
# E501 Black takes care of line length for us # E501 Black takes care of line length for us
# E704 Black will occasionally put multiple statements on one line
# H301 Black will put commas after imports that can't fit on one line # H301 Black will put commas after imports that can't fit on one line
# W503 and W504 are disabled since they're not very useful # W503 and W504 are disabled since they're not very useful
ignore = E203,E501,H301,W503,W504 ignore = E203, E501, E701, H301, W503, W504
import-order-style = pep8 import-order-style = pep8
application_import_names = openstackclient application_import_names = openstackclient