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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
@ -18,12 +18,12 @@ repos:
files: .*\.(yaml|yml)$
args: ['--unsafe']
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.4.0
hooks:
- id: black
args: ['-S', '-l', '79']
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
rev: 1.7.8
hooks:
- id: bandit
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)
boot_kwargs[
'hypervisor_hostname'
] = parsed_args.hypervisor_hostname
boot_kwargs['hypervisor_hostname'] = (
parsed_args.hypervisor_hostname
)
if parsed_args.hostname:
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]:
image_obj = copy.deepcopy(image)
image_obj['state'] = 'cached'
image_obj[
'last_accessed'
] = datetime.datetime.utcfromtimestamp(
image['last_accessed']
).isoformat()
image_obj[
'last_modified'
] = datetime.datetime.utcfromtimestamp(
image['last_modified']
).isoformat()
image_obj['last_accessed'] = (
datetime.datetime.utcfromtimestamp(
image['last_accessed']
).isoformat()
)
image_obj['last_modified'] = (
datetime.datetime.utcfromtimestamp(
image['last_modified']
).isoformat()
)
image_list.append(image_obj)
elif item == "queued_images":
for image in cached_images[item]:

View File

@ -43,8 +43,10 @@ def _get_ranges(item):
item = sorted([int(i) for i in item])
for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]):
b = list(b)
yield "%s-%s" % (b[0][1], b[-1][1]) if b[0][1] != b[-1][1] else str(
b[0][1]
yield (
"%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 = {}
if parsed_args.external_gateways:
external_gateways: collections.defaultdict[
str, list[dict]
] = collections.defaultdict(list)
external_gateways: collections.defaultdict[str, list[dict]] = (
collections.defaultdict(list)
)
n_client = client_manager.network
first_network_id = None

View File

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

View File

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

View File

@ -690,8 +690,7 @@ class FakeClientMixin:
class TestIdentityv3(
FakeClientMixin,
utils.TestCommand,
):
...
): ...
# 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):
registered_limit = copy.deepcopy(identity_fakes.REGISTERED_LIMIT)
registered_limit[
'description'
] = identity_fakes.registered_limit_description
registered_limit['description'] = (
identity_fakes.registered_limit_description
)
self.registered_limit_mock.update.return_value = fakes.FakeResource(
None, registered_limit, loaded=True
)

View File

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

View File

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

View File

@ -104,8 +104,7 @@ class TestNetworkV2(
identity_fakes.FakeClientMixin,
FakeClientMixin,
utils.TestCommand,
):
...
): ...
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
# E203 Black will put spaces after colons in list comprehensions
# 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
# 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
application_import_names = openstackclient