pre-commit: Bump versions

We apply fold in the new black changes also.

Change-Id: I632728aa81e6c55423c0275a0a9b35e0753980a6
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2024-04-23 12:13:19 +01:00
parent a39bc3c855
commit e67a7b14b9
11 changed files with 35 additions and 42 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
@ -22,7 +22,7 @@ repos:
hooks: hooks:
- id: doc8 - id: doc8
- 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']
@ -34,7 +34,7 @@ repos:
- flake8-import-order~=0.18.2 - flake8-import-order~=0.18.2
exclude: '^(doc|releasenotes|tools)/.*$' exclude: '^(doc|releasenotes|tools)/.*$'
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0 rev: v1.9.0
hooks: hooks:
- id: mypy - id: mypy
additional_dependencies: additional_dependencies:

View File

@ -1780,8 +1780,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
name_or_id: str, name_or_id: str,
ignore_missing: ty.Literal[True] = True, ignore_missing: ty.Literal[True] = True,
**query, **query,
) -> ty.Optional[_service.Service]: ) -> ty.Optional[_service.Service]: ...
...
@ty.overload @ty.overload
def find_service( def find_service(
@ -1789,8 +1788,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
name_or_id: str, name_or_id: str,
ignore_missing: ty.Literal[False], ignore_missing: ty.Literal[False],
**query, **query,
) -> _service.Service: ) -> _service.Service: ...
...
# excuse the duplication here: it's mypy's fault # excuse the duplication here: it's mypy's fault
# https://github.com/python/mypy/issues/14764 # https://github.com/python/mypy/issues/14764
@ -1800,8 +1798,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
name_or_id: str, name_or_id: str,
ignore_missing: bool, ignore_missing: bool,
**query, **query,
) -> ty.Optional[_service.Service]: ) -> ty.Optional[_service.Service]: ...
...
def find_service( def find_service(
self, self,

View File

@ -323,12 +323,12 @@ class SecurityGroupCloudMixin:
# as the equivalent value. # as the equivalent value.
rule_def = { rule_def = {
'security_group_id': secgroup['id'], 'security_group_id': secgroup['id'],
'port_range_min': None 'port_range_min': (
if port_range_min == -1 None if port_range_min == -1 else port_range_min
else port_range_min, ),
'port_range_max': None 'port_range_max': (
if port_range_max == -1 None if port_range_max == -1 else port_range_max
else port_range_max, ),
'protocol': protocol, 'protocol': protocol,
'remote_ip_prefix': remote_ip_prefix, 'remote_ip_prefix': remote_ip_prefix,
'remote_group_id': remote_group_id, 'remote_group_id': remote_group_id,

View File

@ -21,8 +21,7 @@ class TagMixin:
_body: resource._ComponentManager _body: resource._ComponentManager
@classmethod @classmethod
def _get_session(cls, session): def _get_session(cls, session): ...
...
_tag_query_parameters = { _tag_query_parameters = {
'tags': 'tags', 'tags': 'tags',

View File

@ -558,9 +558,9 @@ class Connection(
self.config._influxdb_config self.config._influxdb_config
and 'additional_metric_tags' in self.config.config and 'additional_metric_tags' in self.config.config
): ):
self.config._influxdb_config[ self.config._influxdb_config['additional_metric_tags'] = (
'additional_metric_tags' self.config.config['additional_metric_tags']
] = self.config.config['additional_metric_tags'] )
# Register cleanup steps # Register cleanup steps
atexit.register(self.close) atexit.register(self.close)

View File

@ -41,8 +41,7 @@ class DownloadMixin:
resource_response_key=None, resource_response_key=None,
microversion=None, microversion=None,
**params, **params,
): ): ...
...
def download( def download(
self, self,

View File

@ -484,8 +484,7 @@ class Proxy(adapter.Adapter):
name_or_id: str, name_or_id: str,
ignore_missing: ty.Literal[True] = True, ignore_missing: ty.Literal[True] = True,
**attrs, **attrs,
) -> ty.Optional[ResourceType]: ) -> ty.Optional[ResourceType]: ...
...
@ty.overload @ty.overload
def _find( def _find(
@ -494,8 +493,7 @@ class Proxy(adapter.Adapter):
name_or_id: str, name_or_id: str,
ignore_missing: ty.Literal[False], ignore_missing: ty.Literal[False],
**attrs, **attrs,
) -> ResourceType: ) -> ResourceType: ...
...
# excuse the duplication here: it's mypy's fault # excuse the duplication here: it's mypy's fault
# https://github.com/python/mypy/issues/14764 # https://github.com/python/mypy/issues/14764
@ -506,8 +504,7 @@ class Proxy(adapter.Adapter):
name_or_id: str, name_or_id: str,
ignore_missing: bool, ignore_missing: bool,
**attrs, **attrs,
) -> ty.Optional[ResourceType]: ) -> ty.Optional[ResourceType]: ...
...
def _find( def _find(
self, self,

View File

@ -2258,8 +2258,7 @@ class Resource(dict):
microversion: ty.Optional[str] = None, microversion: ty.Optional[str] = None,
all_projects: ty.Optional[bool] = None, all_projects: ty.Optional[bool] = None,
**params, **params,
) -> ty.Optional['Resource']: ) -> ty.Optional['Resource']: ...
...
@ty.overload @ty.overload
@classmethod @classmethod
@ -2273,8 +2272,7 @@ class Resource(dict):
microversion: ty.Optional[str] = None, microversion: ty.Optional[str] = None,
all_projects: ty.Optional[bool] = None, all_projects: ty.Optional[bool] = None,
**params, **params,
) -> 'Resource': ) -> 'Resource': ...
...
# excuse the duplication here: it's mypy's fault # excuse the duplication here: it's mypy's fault
# https://github.com/python/mypy/issues/14764 # https://github.com/python/mypy/issues/14764
@ -2290,8 +2288,7 @@ class Resource(dict):
microversion: ty.Optional[str] = None, microversion: ty.Optional[str] = None,
all_projects: ty.Optional[bool] = None, all_projects: ty.Optional[bool] = None,
**params, **params,
): ): ...
...
@classmethod @classmethod
def find( def find(

View File

@ -31,7 +31,6 @@ _TRUE_VALUES = ('true', '1', 'yes')
class TestCase(base.BaseTestCase): class TestCase(base.BaseTestCase):
"""Test case base class for all tests.""" """Test case base class for all tests."""
# A way to adjust slow test classes # A way to adjust slow test classes

View File

@ -199,9 +199,11 @@ class TestRoleAssignment(base.TestCase):
uri=self.get_mock_url(resource='users'), uri=self.get_mock_url(resource='users'),
status_code=200, status_code=200,
json={ json={
'users': [user_data.json_response['user']] 'users': (
if is_found [user_data.json_response['user']]
else [] if is_found
else []
)
}, },
) )
) )
@ -215,9 +217,11 @@ class TestRoleAssignment(base.TestCase):
), ),
status_code=200, status_code=200,
json={ json={
'users': [user_data.json_response['user']] 'users': (
if is_found [user_data.json_response['user']]
else [] if is_found
else []
)
}, },
) )
) )

View File

@ -146,13 +146,14 @@ application-import-names = openstack
# if they fix ALL of the occurances of one and only one of them. # if they fix ALL of the occurances of one and only one of them.
# 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
# H238 New Style Classes are the default in Python3 # H238 New Style Classes are the default in Python3
# 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
# H4 Are about docstrings and there's just a huge pile of pre-existing issues. # H4 Are about docstrings and there's just a huge pile of pre-existing issues.
# W503 Is supposed to be off by default but in the latest pycodestyle isn't. # W503 Is supposed to be off by default but in the latest pycodestyle isn't.
# Also, both openstacksdk and Donald Knuth disagree with the rule. Line # Also, both openstacksdk and Donald Knuth disagree with the rule. Line
# breaks should occur before the binary operator for readability. # breaks should occur before the binary operator for readability.
ignore = E203, E501, H301, H238, H4, W503 ignore = E203, E501, E704, H301, H238, H4, W503
import-order-style = pep8 import-order-style = pep8
show-source = True show-source = True
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,openstack/_services_mixin.py exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,openstack/_services_mixin.py