Browse Source

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
tags/3.2.0
Riccardo Pittau 3 months ago
parent
commit
2c41452bb2
5 changed files with 16 additions and 15 deletions
  1. +1
    -1
      lower-constraints.txt
  2. +2
    -2
      sushy/auth.py
  3. +11
    -10
      sushy/main.py
  4. +1
    -1
      test-requirements.txt
  5. +1
    -1
      tox.ini

+ 1
- 1
lower-constraints.txt 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


+ 2
- 2
sushy/auth.py 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.


+ 11
- 10
sushy/main.py 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()


+ 1
- 1
test-requirements.txt 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


+ 1
- 1
tox.ini 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.


Loading…
Cancel
Save