From 2c41452bb2a399267c40943b8b64a47b57fbd96e Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Mon, 30 Mar 2020 11:23:42 +0200 Subject: [PATCH] Bump hacking to 3.0.0 The new version enables a lot of standard flake8 checks, so a few fixes are required. W503 is disabled as it conflicts with W504 and the latter seems to be preferred nowadays. Change-Id: I9834e1f2a31cee840c3260aaddfabd3331a86ba7 --- lower-constraints.txt | 2 +- sushy/auth.py | 4 ++-- sushy/main.py | 21 +++++++++++---------- test-requirements.txt | 2 +- tox.ini | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index c42d8c1d..a0e75b29 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -7,7 +7,7 @@ dulwich==0.15.0 extras==1.0.0 fixtures==3.0.0 flake8==2.5.5 -hacking==1.0.0 +hacking==3.0.0 imagesize==0.7.1 iso8601==0.1.11 Jinja2==2.10 diff --git a/sushy/auth.py b/sushy/auth.py index beebdad6..37ccf6fd 100644 --- a/sushy/auth.py +++ b/sushy/auth.py @@ -159,8 +159,8 @@ class SessionAuth(AuthBase): def can_refresh_session(self): """Method to assert if session based refresh can be done.""" - return (self._session_key is not None and - self._session_resource_id is not None) + return (self._session_key is not None + and self._session_resource_id is not None) def refresh_session(self): """Method to refresh a session to a Redfish controller. diff --git a/sushy/main.py b/sushy/main.py index 05651a67..fcc2bac7 100644 --- a/sushy/main.py +++ b/sushy/main.py @@ -171,8 +171,8 @@ class Sushy(base.ResourceBase): Defaults to 'en'. """ self._root_prefix = root_prefix - if (auth is not None and (password is not None or - username is not None)): + if (auth is not None and (password is not None + or username is not None)): msg = ('Username or Password were provided to Sushy ' 'when an authentication mechanism was specified.') raise ValueError(msg) @@ -430,12 +430,13 @@ class Sushy(base.ResourceBase): message_registries = [] resource_package_name = __name__ for json_file in pkg_resources.resource_listdir( - resource_package_name, STANDARD_REGISTRY_PATH): - # Not using path.join according to pkg_resources docs - mes_reg = message_registry.MessageRegistry( - None, STANDARD_REGISTRY_PATH + json_file, - reader=base.JsonPackagedFileReader(resource_package_name)) - message_registries.append(mes_reg) + resource_package_name, STANDARD_REGISTRY_PATH): + # Not using path.join according to pkg_resources docs + mes_reg = message_registry.MessageRegistry( + None, STANDARD_REGISTRY_PATH + json_file, + reader=base.JsonPackagedFileReader( + resource_package_name)) + message_registries.append(mes_reg) return message_registries @@ -453,8 +454,8 @@ class Sushy(base.ResourceBase): """ standard = self._get_standard_message_registry_collection() - registries = {r.registry_prefix + '.' + - r.registry_version.rsplit('.', 1)[0]: r + registries = {r.registry_prefix + '.' + + r.registry_version.rsplit('.', 1)[0]: r for r in standard if r.language == self._language} registry_col = self._get_registry_collection() diff --git a/test-requirements.txt b/test-requirements.txt index 2745da5b..8a70ccd4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking>=1.0.0,<1.1.0 # Apache-2.0 +hacking>=3.0.0,<3.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 python-subunit>=1.0.0 # Apache-2.0/BSD diff --git a/tox.ini b/tox.ini index ab282dcf..7dc30678 100644 --- a/tox.ini +++ b/tox.ini @@ -55,7 +55,7 @@ commands = oslo_debug_helper -t sushy/tests {posargs} [flake8] # E123, E125 skipped as they are invalid PEP-8. show-source = True -ignore = E123,E125 +ignore = E123,E125,W503 # [H106] Don't put vim configuration in source files. # [H203] Use assertIs(Not)None to check for None. # [H204] Use assert(Not)Equal to check for equality.