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
This commit is contained in:
Riccardo Pittau 2020-03-30 11:23:42 +02:00
parent 439eb8e997
commit 2c41452bb2
5 changed files with 16 additions and 15 deletions

View File

@ -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

View File

@ -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.

View File

@ -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()

View File

@ -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

View File

@ -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.