enable pyupgrade via ruff to Python 3.7
Upgrade our syntax to Python 3.7 using pyupgrade support via ruff. Change-Id: I475eed8abbfff0717211605364482ab942c69369 Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
This commit is contained in:
@@ -5,6 +5,10 @@ build-backend = "pbr.build"
|
||||
[tool.doc8]
|
||||
ignore = ["D001"]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 79
|
||||
target-version = "py37"
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"E", # pycodestyle (error)
|
||||
@@ -12,6 +16,7 @@ select = [
|
||||
"G", # flake8-logging-format
|
||||
"LOG", # flake8-logging
|
||||
"S", # flake8-bandit
|
||||
"UP", # pyupgrade
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
|
@@ -20,7 +20,7 @@ from sushy import exceptions
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AuthBase(object, metaclass=abc.ABCMeta):
|
||||
class AuthBase(metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, username=None, password=None):
|
||||
"""A class representing a base Sushy authentication mechanism
|
||||
@@ -129,8 +129,7 @@ class SessionAuth(AuthBase):
|
||||
self._session_auth_previously_successful = False
|
||||
"""Our reminder for tracking if session auth has previously worked."""
|
||||
|
||||
super(SessionAuth, self).__init__(username,
|
||||
password)
|
||||
super().__init__(username, password)
|
||||
|
||||
def get_session_key(self):
|
||||
"""Returns the session key.
|
||||
@@ -224,7 +223,7 @@ class SessionAuth(AuthBase):
|
||||
class SessionOrBasicAuth(SessionAuth):
|
||||
|
||||
def __init__(self, username=None, password=None):
|
||||
super(SessionOrBasicAuth, self).__init__(username, password)
|
||||
super().__init__(username, password)
|
||||
self.basic_auth = BasicAuth(username=username, password=password)
|
||||
|
||||
def _fallback_to_basic_authentication(self):
|
||||
@@ -241,7 +240,7 @@ class SessionOrBasicAuth(SessionAuth):
|
||||
"""
|
||||
try:
|
||||
# Attempt session based authentication
|
||||
super(SessionOrBasicAuth, self)._do_authenticate()
|
||||
super()._do_authenticate()
|
||||
except exceptions.AccessError as e:
|
||||
if (not self.can_refresh_session()
|
||||
and not self._session_auth_previously_successful):
|
||||
@@ -297,4 +296,4 @@ class SessionOrBasicAuth(SessionAuth):
|
||||
we simply return our BasicAuthentication requests.Session.
|
||||
"""
|
||||
if self.can_refresh_session():
|
||||
super(SessionOrBasicAuth, self).refresh_session()
|
||||
super().refresh_session()
|
||||
|
@@ -29,7 +29,7 @@ from sushy import utils
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Connector(object):
|
||||
class Connector:
|
||||
|
||||
def __init__(
|
||||
self, url, username=None, password=None, verify=True,
|
||||
@@ -293,9 +293,8 @@ class Connector(object):
|
||||
raise
|
||||
if blocking and response.status_code == 202:
|
||||
if not response.headers.get('Location'):
|
||||
m = ('HTTP response for %(method)s request to %(url)s '
|
||||
'returned status 202, but no Location header'
|
||||
% {'method': method, 'url': url})
|
||||
m = (f'HTTP response for {method} request to {url} '
|
||||
'returned status 202, but no Location header')
|
||||
raise exceptions.ConnectionError(url=url, error=m)
|
||||
|
||||
mon = TaskMonitor.from_response(self, response, path)
|
||||
|
@@ -31,7 +31,7 @@ class SushyError(Exception):
|
||||
if self.message and kwargs:
|
||||
self.message = self.message % kwargs
|
||||
|
||||
super(SushyError, self).__init__(self.message)
|
||||
super().__init__(self.message)
|
||||
|
||||
|
||||
class ConnectionError(SushyError):
|
||||
@@ -116,13 +116,13 @@ class HTTPError(SushyError):
|
||||
self.extended_info = self.body.get('@Message.ExtendedInfo')
|
||||
message = self._get_most_severe_msg(self.extended_info or [{}])
|
||||
self.detail = message or self.detail
|
||||
error = '%s: %s' % (self.code, self.detail or 'unknown error.')
|
||||
error = '{}: {}'.format(self.code, self.detail or 'unknown error.')
|
||||
kwargs = {'method': method, 'url': url, 'code': self.status_code,
|
||||
'error': error, 'ext_info': self.extended_info}
|
||||
LOG.debug('HTTP response for %(method)s %(url)s: '
|
||||
'status code: %(code)s, error: %(error)s, '
|
||||
'extended: %(ext_info)s', kwargs)
|
||||
super(HTTPError, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@staticmethod
|
||||
def _get_most_severe_msg(extended_info):
|
||||
|
@@ -198,7 +198,7 @@ class Sushy(base.ResourceBase):
|
||||
password=password)
|
||||
self._auth = auth
|
||||
|
||||
super(Sushy, self).__init__(
|
||||
super().__init__(
|
||||
connector or sushy_connector.Connector(
|
||||
base_url, verify=verify,
|
||||
server_side_retries=server_side_retries,
|
||||
@@ -227,7 +227,7 @@ class Sushy(base.ResourceBase):
|
||||
|
||||
:param json_doc: parsed JSON document in form of Python types
|
||||
"""
|
||||
super(Sushy, self)._parse_attributes(json_doc)
|
||||
super()._parse_attributes(json_doc)
|
||||
self.redfish_version = json_doc.get('RedfishVersion')
|
||||
|
||||
def get_system_collection(self):
|
||||
|
@@ -32,7 +32,7 @@ from sushy import utils
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Field(object):
|
||||
class Field:
|
||||
"""Definition for fields fetched from JSON."""
|
||||
|
||||
def __init__(self, path, required=False, default=None,
|
||||
@@ -139,7 +139,7 @@ class CompositeField(collections.abc.Mapping, Field, metaclass=abc.ABCMeta):
|
||||
"""Base class for fields consisting of several sub-fields."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CompositeField, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self._subfields = dict(_collect_fields(self))
|
||||
|
||||
def _load(self, body, resource, nested_in=None):
|
||||
@@ -151,7 +151,7 @@ class CompositeField(collections.abc.Mapping, Field, metaclass=abc.ABCMeta):
|
||||
:returns: a new object with sub-fields attached to it.
|
||||
"""
|
||||
nested_in = (nested_in or []) + self._path
|
||||
value = super(CompositeField, self)._load(body, resource)
|
||||
value = super()._load(body, resource)
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
@@ -185,7 +185,7 @@ class ListField(Field):
|
||||
"""Base class for fields consisting of a list of several sub-fields."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ListField, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self._subfields = dict(_collect_fields(self))
|
||||
|
||||
def _load(self, body, resource, nested_in=None):
|
||||
@@ -197,7 +197,7 @@ class ListField(Field):
|
||||
:returns: a new list object containing subfields.
|
||||
"""
|
||||
nested_in = (nested_in or []) + self._path
|
||||
values = super(ListField, self)._load(body, resource)
|
||||
values = super()._load(body, resource)
|
||||
if values is None:
|
||||
return None
|
||||
|
||||
@@ -227,7 +227,7 @@ class DictionaryField(Field):
|
||||
"""Base class for fields consisting of dictionary of several sub-fields."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DictionaryField, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self._subfields = dict(_collect_fields(self))
|
||||
|
||||
def _load(self, body, resource, nested_in=None):
|
||||
@@ -239,7 +239,7 @@ class DictionaryField(Field):
|
||||
:returns: a new dictionary object containing subfields.
|
||||
"""
|
||||
nested_in = (nested_in or []) + self._path
|
||||
values = super(DictionaryField, self)._load(body, resource)
|
||||
values = super()._load(body, resource)
|
||||
if values is None:
|
||||
return None
|
||||
|
||||
@@ -288,7 +288,7 @@ class MappedField(Field):
|
||||
raise TypeError("The mapping argument must be a mapping or "
|
||||
"an enumeration")
|
||||
|
||||
super(MappedField, self).__init__(
|
||||
super().__init__(
|
||||
field, required=required, default=default, adapter=adapter)
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ class MappedListField(Field):
|
||||
"an enumeration")
|
||||
|
||||
self._mapping_adapter = adapter
|
||||
super(MappedListField, self).__init__(
|
||||
super().__init__(
|
||||
field, required=required, default=default,
|
||||
adapter=lambda x: x)
|
||||
|
||||
@@ -336,7 +336,7 @@ class MappedListField(Field):
|
||||
:returns: a new list object containing the mapped values.
|
||||
"""
|
||||
nested_in = (nested_in or []) + self._path
|
||||
values = super(MappedListField, self)._load(body, resource)
|
||||
values = super()._load(body, resource)
|
||||
|
||||
if values is None:
|
||||
return
|
||||
@@ -375,7 +375,7 @@ class MessageListField(ListField):
|
||||
"""
|
||||
|
||||
|
||||
class FieldData(object):
|
||||
class FieldData:
|
||||
"""Contains data to be used when constructing Fields"""
|
||||
|
||||
def __init__(self, status_code, headers, json_doc):
|
||||
@@ -400,7 +400,7 @@ class FieldData(object):
|
||||
return self._json_doc
|
||||
|
||||
|
||||
class AbstractDataReader(object, metaclass=abc.ABCMeta):
|
||||
class AbstractDataReader(metaclass=abc.ABCMeta):
|
||||
|
||||
def set_connection(self, connector, path):
|
||||
"""Sets mandatory connection parameters
|
||||
@@ -506,7 +506,7 @@ def get_reader(connector, path, reader=None):
|
||||
return reader
|
||||
|
||||
|
||||
class ResourceBase(object, metaclass=abc.ABCMeta):
|
||||
class ResourceBase(metaclass=abc.ABCMeta):
|
||||
|
||||
redfish_version = None
|
||||
"""The Redfish version"""
|
||||
|
@@ -152,7 +152,7 @@ class Chassis(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(Chassis, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -325,6 +325,6 @@ class ChassisCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ChassisCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -25,8 +25,7 @@ class IdRefField(base.CompositeField):
|
||||
|
||||
class OperationApplyTimeSupportField(base.CompositeField):
|
||||
def __init__(self):
|
||||
super(OperationApplyTimeSupportField, self).__init__(
|
||||
path="@Redfish.OperationApplyTimeSupport")
|
||||
super().__init__(path="@Redfish.OperationApplyTimeSupport")
|
||||
|
||||
maintenance_window_duration_in_seconds = base.Field(
|
||||
'MaintenanceWindowDurationInSeconds', adapter=int)
|
||||
|
@@ -62,7 +62,7 @@ class CompositionService(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(CompositionService, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
|
@@ -86,7 +86,7 @@ class ResourceBlock(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ResourceBlock, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -115,6 +115,6 @@ class ResourceBlockCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ResourceBlockCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -66,7 +66,7 @@ class ResourceZone(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ResourceZone, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -95,6 +95,6 @@ class ResourceZoneCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ResourceZoneCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -65,7 +65,7 @@ class EventDestination(base.ResourceBase):
|
||||
that needs registries to parse messages.
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(EventDestination, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -102,7 +102,7 @@ class EventDestinationCollection(base.ResourceCollectionBase):
|
||||
that needs registries to parse messages.
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(EventDestinationCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
|
@@ -75,7 +75,7 @@ class EventService(base.ResourceBase):
|
||||
that needs registries to parse messages.
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(EventService, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
|
@@ -62,7 +62,7 @@ class Fabric(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(Fabric, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -93,6 +93,6 @@ class FabricCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(FabricCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -97,7 +97,7 @@ class Manager(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(Manager, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -272,6 +272,6 @@ class ManagerCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ManagerCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -40,7 +40,7 @@ class OEMResourceBase(base.ResourceBase):
|
||||
self._parent_resource = None
|
||||
self._vendor_id = None
|
||||
|
||||
super(OEMResourceBase, self).__init__(
|
||||
super().__init__(
|
||||
connector, path,
|
||||
redfish_version=redfish_version, registries=registries,
|
||||
reader=reader, root=root)
|
||||
@@ -79,4 +79,4 @@ class OEMResourceBase(base.ResourceBase):
|
||||
|
||||
oem_json.update(oem_actions_json)
|
||||
|
||||
super(OEMResourceBase, self)._parse_attributes(oem_json)
|
||||
super()._parse_attributes(oem_json)
|
||||
|
@@ -25,7 +25,7 @@ _global_extn_mgrs_by_resource = {}
|
||||
|
||||
def _raise(m, ep, e):
|
||||
raise exceptions.ExtensionError(
|
||||
error='Failed to load entry point target: %(error)s' % {'error': e})
|
||||
error=f'Failed to load entry point target: {e}')
|
||||
|
||||
|
||||
def _create_extension_manager(namespace):
|
||||
@@ -56,10 +56,8 @@ def _create_extension_manager(namespace):
|
||||
'target': extension.entry_point_target})
|
||||
|
||||
if not extension_manager.names():
|
||||
m = (('No extensions found for "%(resource)s" under namespace '
|
||||
'"%(namespace)s"') %
|
||||
{'resource': resource_name,
|
||||
'namespace': namespace})
|
||||
m = (f'No extensions found for "{resource_name}" under namespace '
|
||||
f'"{namespace}"')
|
||||
LOG.error(m)
|
||||
raise exceptions.ExtensionError(error=m)
|
||||
|
||||
|
@@ -49,7 +49,7 @@ class Session(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(Session, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -85,6 +85,6 @@ class SessionCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(SessionCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -60,7 +60,7 @@ class SessionService(base.ResourceBase):
|
||||
"""
|
||||
# Populating the base resource so session interactions can
|
||||
# occur based on the contents of it.
|
||||
super(SessionService, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
|
@@ -40,7 +40,7 @@ NO_UPDATES = 4
|
||||
"""No updates made"""
|
||||
|
||||
|
||||
class SettingsUpdate(object):
|
||||
class SettingsUpdate:
|
||||
"""Contains Settings update status and details of the update"""
|
||||
|
||||
def __init__(self, status, messages):
|
||||
@@ -77,7 +77,7 @@ class MaintenanceWindowField(base.CompositeField):
|
||||
|
||||
class SettingsApplyTimeField(base.CompositeField):
|
||||
def __init__(self):
|
||||
super(SettingsApplyTimeField, self).__init__(
|
||||
super().__init__(
|
||||
path="@Redfish.SettingsApplyTime")
|
||||
|
||||
apply_time = base.Field('ApplyTime', adapter=str)
|
||||
@@ -109,7 +109,7 @@ class SettingsField(base.CompositeField):
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super(SettingsField, self).__init__(path="@Redfish.Settings")
|
||||
super().__init__(path="@Redfish.Settings")
|
||||
|
||||
time = base.Field('Time')
|
||||
"""Indicates the time the settings were applied to the server"""
|
||||
|
@@ -42,7 +42,7 @@ class Bios(base.ResourceBase):
|
||||
parsing messages of attribute update status
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(Bios, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
|
@@ -103,7 +103,7 @@ class Processor(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(Processor, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -169,7 +169,7 @@ class ProcessorCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ProcessorCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries,
|
||||
root=root)
|
||||
|
@@ -142,7 +142,7 @@ class SecureBoot(base.ResourceBase):
|
||||
"""
|
||||
if not isinstance(enabled, bool):
|
||||
raise exceptions.InvalidParameterValueError(
|
||||
"Expected a boolean for 'enabled', got %r" % enabled)
|
||||
f"Expected a boolean for 'enabled', got {enabled}")
|
||||
|
||||
etag = self._get_etag()
|
||||
self._conn.patch(self.path, data={'SecureBootEnable': enabled},
|
||||
|
@@ -110,6 +110,6 @@ class SecureBootDatabaseCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(SecureBootDatabaseCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -148,7 +148,7 @@ class ControllerCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(ControllerCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries,
|
||||
root=root)
|
||||
|
@@ -175,7 +175,7 @@ class System(base.ResourceBase):
|
||||
that needs registries to parse messages.
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(System, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity,
|
||||
redfish_version=redfish_version,
|
||||
registries=registries,
|
||||
@@ -594,6 +594,6 @@ class SystemCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(SystemCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, path, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -75,7 +75,7 @@ class Task(base.ResourceBase):
|
||||
:param field_data: the data to use populating the fields
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(Task, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version, registries,
|
||||
json_doc=json_doc, root=root)
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class TaskService(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(TaskService, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
|
@@ -70,7 +70,7 @@ class SoftwareInventory(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(SoftwareInventory, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
@@ -99,6 +99,6 @@ class SoftwareInventoryCollection(base.ResourceCollectionBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(SoftwareInventoryCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
@@ -76,7 +76,7 @@ class UpdateService(base.ResourceBase):
|
||||
used in any resource that needs registries to parse messages
|
||||
:param root: Sushy root object. Empty for Sushy root itself.
|
||||
"""
|
||||
super(UpdateService, self).__init__(
|
||||
super().__init__(
|
||||
connector, identity, redfish_version=redfish_version,
|
||||
registries=registries, root=root)
|
||||
|
||||
|
@@ -27,7 +27,7 @@ from sushy.resources.taskservice import task
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TaskMonitor(object):
|
||||
class TaskMonitor:
|
||||
def __init__(self,
|
||||
connector,
|
||||
task_monitor_uri,
|
||||
@@ -191,10 +191,8 @@ class TaskMonitor(object):
|
||||
'sleep': self.sleep_for})
|
||||
time.sleep(self.sleep_for)
|
||||
if time.time() >= timeout_at and self.check_is_processing:
|
||||
m = ('Timeout waiting for task monitor %(url)s '
|
||||
'(timeout = %(timeout)s)'
|
||||
% {'url': self.task_monitor_uri,
|
||||
'timeout': timeout_sec})
|
||||
m = (f'Timeout waiting for task monitor '
|
||||
f'{self.task_monitor_uri} (timeout = {timeout_sec})')
|
||||
raise exceptions.ConnectionError(url=self.task_monitor_uri,
|
||||
error=m)
|
||||
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010-2011 OpenStack Foundation
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@@ -28,7 +27,7 @@ from sushy.tests.unit import base
|
||||
class ChassisTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ChassisTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/chassis.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -226,7 +225,7 @@ class ChassisTestCase(base.TestCase):
|
||||
class ChassisCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ChassisCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'chassis_collection.json') as f:
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@@ -24,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class PowerTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PowerTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/power.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@@ -24,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class ThermalTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ThermalTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/thermal.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
@@ -24,7 +24,7 @@ from sushy.tests.unit import base
|
||||
class CompositionServiceTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(CompositionServiceTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open(
|
||||
'sushy/tests/unit/json_samples/compositionservice.json') as f:
|
||||
|
@@ -24,7 +24,7 @@ from sushy.tests.unit import base
|
||||
class ResourceBlockTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceBlockTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/resourceblock.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -70,7 +70,7 @@ class ResourceBlockTestCase(base.TestCase):
|
||||
class ResourceBlockCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceBlockCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'resourceblock_collection.json') as f:
|
||||
|
@@ -23,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class ResourceZoneTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceZoneTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/resourcezone.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -59,7 +59,7 @@ class ResourceZoneTestCase(base.TestCase):
|
||||
class ResourceZoneCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceZoneCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'resourcezone_collection.json') as f:
|
||||
|
@@ -20,7 +20,7 @@ from sushy.tests.unit import base
|
||||
class EventDestinationTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(EventDestinationTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/eventdestination1.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -53,10 +53,10 @@ class EventDestinationTestCase(base.TestCase):
|
||||
class EventDestinationCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(EventDestinationCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'eventdestination_collection.json', 'r') as f:
|
||||
'eventdestination_collection.json') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
self.eventdestination = eventdestination.EventDestinationCollection(
|
||||
self.conn, '/redfish/v1/EventService/Subscriptions',
|
||||
@@ -77,7 +77,7 @@ class EventDestinationCollectionTestCase(base.TestCase):
|
||||
members = self.eventdestination.get_members()
|
||||
calls = [
|
||||
mock.call(self.eventdestination._conn,
|
||||
'/redfish/v1/EventService/Subscriptions/%s' % member,
|
||||
f'/redfish/v1/EventService/Subscriptions/{member}',
|
||||
redfish_version=self.eventdestination.redfish_version,
|
||||
registries=None,
|
||||
root=self.eventdestination.root)
|
||||
|
@@ -23,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class EventServiceTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(EventServiceTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/eventservice.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
@@ -22,7 +22,7 @@ from sushy.tests.unit import base
|
||||
class EndpointTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(EndpointTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'endpoint.json') as f:
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@@ -25,7 +24,7 @@ from sushy.tests.unit import base
|
||||
class FabricTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(FabricTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/fabric.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -87,7 +86,7 @@ class FabricTestCase(base.TestCase):
|
||||
self.assertIsInstance(endpts, endpoint.EndpointCollection)
|
||||
|
||||
# On refreshing the fabric instance...
|
||||
with open('sushy/tests/unit/json_samples/fabric.json', 'r') as f:
|
||||
with open('sushy/tests/unit/json_samples/fabric.json') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.fabric.invalidate()
|
||||
@@ -110,7 +109,7 @@ class FabricTestCase(base.TestCase):
|
||||
class FabricCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(FabricCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'fabric_collection.json') as f:
|
||||
|
@@ -27,7 +27,7 @@ from sushy.tests.unit import base
|
||||
class ManagerTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ManagerTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/manager.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -262,7 +262,7 @@ class ManagerTestCase(base.TestCase):
|
||||
self.assertIsInstance(vrt_media, virtual_media.VirtualMediaCollection)
|
||||
|
||||
# On refreshing the manager instance...
|
||||
with open('sushy/tests/unit/json_samples/manager.json', 'r') as f:
|
||||
with open('sushy/tests/unit/json_samples/manager.json') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.manager.invalidate()
|
||||
@@ -328,7 +328,7 @@ class ManagerTestCase(base.TestCase):
|
||||
class ManagerWithoutVirtualMedia(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ManagerWithoutVirtualMedia, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'managerv1_18.json') as f:
|
||||
@@ -348,7 +348,7 @@ class ManagerWithoutVirtualMedia(base.TestCase):
|
||||
class ManagerCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ManagerCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'manager_collection.json') as f:
|
||||
|
@@ -27,7 +27,7 @@ from sushy.tests.unit import base
|
||||
class VirtualMediaTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VirtualMediaTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.conn.get.return_value.headers = {'Allow': 'GET,HEAD'}
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
@@ -267,8 +267,8 @@ class VirtualMediaTestCase(base.TestCase):
|
||||
self.assertFalse(self.sys_virtual_media._is_stale)
|
||||
self.sys_virtual_media.eject_media()
|
||||
self.sys_virtual_media._conn.post.assert_called_once_with(
|
||||
("/redfish/v1/Managers/BMC/VirtualMedia/Floppy1/Actions"
|
||||
"/VirtualMedia.EjectMedia"))
|
||||
"/redfish/v1/Managers/BMC/VirtualMedia/Floppy1/Actions"
|
||||
"/VirtualMedia.EjectMedia")
|
||||
self.assertTrue(self.sys_virtual_media._is_stale)
|
||||
|
||||
def test_eject_media_fallback(self):
|
||||
|
@@ -32,7 +32,7 @@ class FauxResourceOEMExtension(oem_base.OEMResourceBase):
|
||||
class ResourceOEMCommonMethodsTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceOEMCommonMethodsTestCase, self).setUp()
|
||||
super().setUp()
|
||||
# We use ExtensionManager.make_test_instance() and instantiate the
|
||||
# test instance outside of the test cases in setUp. Inside of the
|
||||
# test cases we set this as the return value of the mocked
|
||||
@@ -66,7 +66,7 @@ class ResourceOEMCommonMethodsTestCase(base.TestCase):
|
||||
[self.contoso_extn_dup, self.faux_extn_dup]))
|
||||
|
||||
def tearDown(self):
|
||||
super(ResourceOEMCommonMethodsTestCase, self).tearDown()
|
||||
super().tearDown()
|
||||
if oem_common._global_extn_mgrs_by_resource:
|
||||
oem_common._global_extn_mgrs_by_resource = {}
|
||||
|
||||
|
@@ -22,9 +22,9 @@ from sushy.tests.unit import base
|
||||
class FakeOEMSystemExtensionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(FakeOEMSystemExtensionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.MagicMock()
|
||||
with open('sushy/tests/unit/json_samples/system.json', 'r') as f:
|
||||
with open('sushy/tests/unit/json_samples/system.json') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.sys_instance = system.System(
|
||||
|
@@ -23,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class AttributeRegistryTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(AttributeRegistryTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'bios_attribute_registry.json') as f:
|
||||
|
@@ -28,7 +28,7 @@ from sushy.tests.unit import base
|
||||
class MessageRegistryTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(MessageRegistryTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/message_registry.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
@@ -24,7 +24,7 @@ from sushy.tests.unit import base
|
||||
class MessageRegistryFileTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(MessageRegistryFileTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'message_registry_file.json') as f:
|
||||
@@ -276,7 +276,7 @@ class MessageRegistryFileTestCase(base.TestCase):
|
||||
class BiosRegistryTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BiosRegistryTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'bios_attribute_registry_file.json') as f:
|
||||
@@ -314,7 +314,7 @@ class BiosRegistryTestCase(base.TestCase):
|
||||
class MessageRegistryFileCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(MessageRegistryFileCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'message_registry_file_collection.json') as f:
|
||||
|
@@ -24,7 +24,7 @@ from sushy.tests.unit import base
|
||||
class SessionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SessionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.auth = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/session.json') as f:
|
||||
@@ -64,7 +64,7 @@ class SessionTestCase(base.TestCase):
|
||||
class SessionCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SessionCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'session_collection.json') as f:
|
||||
|
@@ -26,7 +26,7 @@ from sushy.tests.unit import base
|
||||
class SessionServiceTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SessionServiceTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.MagicMock()
|
||||
with open('sushy/tests/unit/json_samples/session_service.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
@@ -25,7 +25,7 @@ from sushy.tests.unit import base
|
||||
class NetworkAdapterTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkAdapterTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/network_adapter.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -151,7 +151,7 @@ class NetworkAdapterTestCase(base.TestCase):
|
||||
class NetworkAdapterCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkAdapterCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'network_adapter_collection.json') as f:
|
||||
|
@@ -22,7 +22,7 @@ from sushy.tests.unit import base
|
||||
class NetworkDeviceFunctionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkDeviceFunctionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'network_device_function.json') as f:
|
||||
@@ -101,7 +101,7 @@ class NetworkDeviceFunctionTestCase(base.TestCase):
|
||||
class NetworkDeviceFunctionCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkDeviceFunctionCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'network_device_function_collection.json') as f:
|
||||
|
@@ -22,7 +22,7 @@ from sushy.tests.unit import base
|
||||
class NetworkPortTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkPortTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/network_port.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -56,7 +56,7 @@ class NetworkPortTestCase(base.TestCase):
|
||||
class NetworkPortCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkPortCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'network_port_collection.json') as f:
|
||||
|
@@ -23,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class ControllerTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ControllerTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'storage_controller.json') as f:
|
||||
@@ -92,7 +92,7 @@ class ControllerTestCase(base.TestCase):
|
||||
class ControllerCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ControllerCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'storage_controller_collection.json') as f:
|
||||
|
@@ -23,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class DriveTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(DriveTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/drive.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
@@ -40,7 +40,7 @@ STORAGE_VOLUME_FILE_NAMES = [
|
||||
class StorageTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(StorageTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/storage.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -254,7 +254,7 @@ class StorageTestCase(base.TestCase):
|
||||
class StorageCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(StorageCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'storage_collection.json') as f:
|
||||
|
@@ -27,7 +27,7 @@ from sushy.tests.unit import base
|
||||
class VolumeTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VolumeTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/volume.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -189,7 +189,7 @@ class VolumeTestCase(base.TestCase):
|
||||
class VolumeCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VolumeCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'volume_collection.json') as f:
|
||||
|
@@ -31,7 +31,7 @@ from sushy.tests.unit import base
|
||||
class BiosTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BiosTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/bios.json') as f:
|
||||
self.bios_json = json.load(f)
|
||||
@@ -365,7 +365,7 @@ class BiosTestCase(base.TestCase):
|
||||
class BiosZTTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BiosZTTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/bios_zt.json') as f:
|
||||
self.bios_json = json.load(f)
|
||||
|
@@ -22,7 +22,7 @@ from sushy.tests.unit import base
|
||||
class EthernetInterfaceTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(EthernetInterfaceTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'ethernet_interfaces.json') as f:
|
||||
@@ -52,7 +52,7 @@ class EthernetInterfaceTestCase(base.TestCase):
|
||||
class EthernetInterfaceCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(EthernetInterfaceCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'ethernet_interfaces_collection.json') as f:
|
||||
|
@@ -22,7 +22,7 @@ from sushy.tests.unit import base
|
||||
class PortTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PortTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/port.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -57,7 +57,7 @@ class PortTestCase(base.TestCase):
|
||||
class PortCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PortCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'port_collection.json') as f:
|
||||
|
@@ -26,7 +26,7 @@ from sushy.tests.unit import base
|
||||
class ProcessorTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ProcessorTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/processor.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -102,7 +102,7 @@ class ProcessorTestCase(base.TestCase):
|
||||
class ProcessorCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ProcessorCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'processor_collection.json') as f:
|
||||
|
@@ -23,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class SecureBootTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SecureBootTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/secure_boot.json') as f:
|
||||
self.secure_boot_json = json.load(f)
|
||||
|
@@ -22,7 +22,7 @@ from sushy.tests.unit import base
|
||||
class SecureBootDatabaseTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SecureBootDatabaseTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'secure_boot_database.json') as f:
|
||||
@@ -86,7 +86,7 @@ class SecureBootDatabaseTestCase(base.TestCase):
|
||||
class SecureBootDatabaseCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SecureBootDatabaseCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'secure_boot_database_collection.json') as f:
|
||||
@@ -131,7 +131,7 @@ class SecureBootDatabaseCollectionTestCase(base.TestCase):
|
||||
calls = [
|
||||
mock.call(self.collection._conn,
|
||||
'/redfish/v1/Systems/437XR1138R2/SecureBoot'
|
||||
'/SecureBootDatabases/%s' % member,
|
||||
f'/SecureBootDatabases/{member}',
|
||||
redfish_version=self.collection.redfish_version,
|
||||
registries=None,
|
||||
root=self.collection.root)
|
||||
|
@@ -22,7 +22,7 @@ from sushy.tests.unit import base
|
||||
class SimpleStorageTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SimpleStorageTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'simple_storage.json') as f:
|
||||
@@ -54,7 +54,7 @@ class SimpleStorageTestCase(base.TestCase):
|
||||
class SimpleStorageCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SimpleStorageCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'simple_storage_collection.json') as f:
|
||||
|
@@ -36,7 +36,7 @@ from sushy.tests.unit import base
|
||||
class SystemTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SystemTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.conn.get.return_value.headers = {'Allow': 'GET,HEAD'}
|
||||
with open('sushy/tests/unit/json_samples/system.json') as f:
|
||||
@@ -339,8 +339,7 @@ class SystemTestCase(base.TestCase):
|
||||
def test_set_system_boot_options_invalid_enabled(self):
|
||||
with self.assertRaisesRegex(
|
||||
exceptions.InvalidParameterValueError,
|
||||
'"enabled" value.*{0}'.format(
|
||||
list(sushy.BootSourceOverrideEnabled))):
|
||||
f'"enabled" value.*{list(sushy.BootSourceOverrideEnabled)}'):
|
||||
|
||||
self.sys_inst.set_system_boot_options(
|
||||
sushy.BootSource.HDD,
|
||||
@@ -622,8 +621,7 @@ class SystemTestCase(base.TestCase):
|
||||
def test_set_system_boot_source_invalid_enabled(self):
|
||||
with self.assertRaisesRegex(
|
||||
exceptions.InvalidParameterValueError,
|
||||
'"enabled" value.*{0}'.format(
|
||||
list(sushy.BootSourceOverrideEnabled))):
|
||||
f'"enabled" value.*{list(sushy.BootSourceOverrideEnabled)}'):
|
||||
|
||||
self.sys_inst.set_system_boot_source(
|
||||
sushy.BootSource.HDD,
|
||||
@@ -976,7 +974,7 @@ class SystemTestCase(base.TestCase):
|
||||
class SystemWithVirtualMedia(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SystemWithVirtualMedia, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'systemv1_20.json') as f:
|
||||
@@ -1028,7 +1026,7 @@ class SystemWithVirtualMedia(base.TestCase):
|
||||
self.assertIsInstance(actual_virtual_media,
|
||||
virtual_media.VirtualMediaCollection)
|
||||
|
||||
with open('sushy/tests/unit/json_samples/systemv1_20.json', 'r') as f:
|
||||
with open('sushy/tests/unit/json_samples/systemv1_20.json') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.sys_inst.invalidate()
|
||||
@@ -1050,7 +1048,7 @@ class SystemWithVirtualMedia(base.TestCase):
|
||||
class SystemCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SystemCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'system_collection.json') as f:
|
||||
|
@@ -24,7 +24,7 @@ from sushy.tests.unit import base
|
||||
class TaskTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TaskTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/task.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -78,7 +78,7 @@ class TaskTestCase(base.TestCase):
|
||||
class TaskCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TaskCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'task_collection.json') as f:
|
||||
|
@@ -24,7 +24,7 @@ from sushy.tests.unit import base
|
||||
class TaskServiceTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TaskServiceTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/taskservice.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
@@ -72,7 +72,7 @@ class BaseResource2(resource_base.ResourceBase):
|
||||
class ResourceBaseTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceBaseTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.conn.get.return_value.json.return_value = (
|
||||
copy.deepcopy(BASE_RESOURCE_JSON))
|
||||
@@ -194,8 +194,8 @@ class TestResource(resource_base.ResourceBase):
|
||||
:param registries: Dict of Redfish Message Registry objects to be
|
||||
used in any resource that needs registries to parse messages.
|
||||
"""
|
||||
super(TestResource, self).__init__(connector, 'Fakes/%s' % identity,
|
||||
redfish_version, registries, root)
|
||||
super().__init__(connector, f'Fakes/{identity}',
|
||||
redfish_version, registries, root)
|
||||
self.identity = identity
|
||||
|
||||
def _parse_attributes(self, json_doc):
|
||||
@@ -219,14 +219,14 @@ class TestResourceCollection(resource_base.ResourceCollectionBase):
|
||||
:param registries: Dict of Redfish Message Registry objects to be
|
||||
used in any resource that needs registries to parse messages.
|
||||
"""
|
||||
super(TestResourceCollection, self).__init__(
|
||||
super().__init__(
|
||||
connector, 'Fakes', redfish_version, registries, root)
|
||||
|
||||
|
||||
class ResourceCollectionBaseTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceCollectionBaseTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.MagicMock()
|
||||
self.test_resource_collection = TestResourceCollection(
|
||||
self.conn, redfish_version='1.0.x', registries=None)
|
||||
@@ -389,7 +389,7 @@ class ComplexResource(resource_base.ResourceBase):
|
||||
|
||||
class FieldTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(FieldTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.json = copy.deepcopy(TEST_JSON)
|
||||
self.conn.get.return_value.json.return_value = self.json
|
||||
@@ -493,7 +493,7 @@ class PartialKeyResource(resource_base.ResourceBase):
|
||||
|
||||
class FieldPartialKeyTestCase(base.TestCase):
|
||||
def setUp(self):
|
||||
super(FieldPartialKeyTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.json = copy.deepcopy(TEST_JSON)
|
||||
self.conn.get.return_value.json.return_value = self.json
|
||||
|
@@ -25,7 +25,7 @@ from sushy.tests.unit import base
|
||||
class SettingsFieldTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SettingsFieldTestCase, self).setUp()
|
||||
super().setUp()
|
||||
with open('sushy/tests/unit/json_samples/settings.json') as f:
|
||||
self.json = json.load(f)
|
||||
|
||||
|
@@ -23,7 +23,7 @@ from sushy.tests.unit import base
|
||||
class SoftwareInventoryTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SoftwareInventoryTestCase, self).setUp()
|
||||
super().setUp()
|
||||
conn = mock.Mock()
|
||||
with open(
|
||||
'sushy/tests/unit/json_samples/softwareinventory.json') as f:
|
||||
@@ -76,7 +76,7 @@ class SoftwareInventoryTestCase(base.TestCase):
|
||||
class SoftwareInventoryCollectionTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(SoftwareInventoryCollectionTestCase, self).setUp()
|
||||
super().setUp()
|
||||
conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'firmwareinventory_collection.json') as f:
|
||||
|
@@ -26,7 +26,7 @@ from sushy.tests.unit import base
|
||||
class UpdateServiceTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(UpdateServiceTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/updateservice.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
@@ -194,7 +194,7 @@ class UpdateServiceTestCase(base.TestCase):
|
||||
class UpdateServiceNoInvTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(UpdateServiceNoInvTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
no_inv_json = 'sushy/tests/unit/json_samples/updateservice_no_inv.json'
|
||||
with open(no_inv_json) as f:
|
||||
|
@@ -29,7 +29,7 @@ class BasicAuthTestCase(base.TestCase):
|
||||
@mock.patch.object(main, 'Sushy', autospec=True)
|
||||
@mock.patch.object(connector, 'Connector', autospec=True)
|
||||
def setUp(self, mock_connector, mock_root):
|
||||
super(BasicAuthTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.username = 'TestUsername'
|
||||
self.password = 'TestP@$$W0RD'
|
||||
self.base_auth = auth.BasicAuth(self.username,
|
||||
@@ -78,7 +78,7 @@ class SessionAuthTestCase(base.TestCase):
|
||||
@mock.patch.object(main, 'Sushy', autospec=True)
|
||||
@mock.patch.object(connector, 'Connector', autospec=True)
|
||||
def setUp(self, mock_connector, mock_root):
|
||||
super(SessionAuthTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.username = 'TestUsername'
|
||||
self.password = 'TestP@$$W0RD'
|
||||
self.sess_key = 'TestingKey'
|
||||
@@ -217,7 +217,7 @@ class SessionOrBasicAuthTestCase(base.TestCase):
|
||||
@mock.patch.object(main, 'Sushy', autospec=True)
|
||||
@mock.patch.object(connector, 'Connector', autospec=True)
|
||||
def setUp(self, mock_connector, mock_root):
|
||||
super(SessionOrBasicAuthTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.username = 'TestUsername'
|
||||
self.password = 'TestP@$$W0RD'
|
||||
self.sess_key = 'TestingKey'
|
||||
|
@@ -30,7 +30,7 @@ class ConnectorMethodsTestCase(base.TestCase):
|
||||
@mock.patch.object(sushy_auth, 'SessionOrBasicAuth', autospec=True)
|
||||
def setUp(self, mock_auth):
|
||||
mock_auth.get_session_key.return_value = None
|
||||
super(ConnectorMethodsTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = connector.Connector(
|
||||
'http://foo.bar:1234', verify=True)
|
||||
self.conn._auth = mock_auth
|
||||
@@ -162,7 +162,7 @@ class ConnectorOpTestCase(base.TestCase):
|
||||
mock_auth.get_session_key.return_value = None
|
||||
mock_auth._session_key = None
|
||||
self.auth = mock_auth
|
||||
super(ConnectorOpTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = connector.Connector(
|
||||
'http://foo.bar:1234', verify=True,
|
||||
server_side_retries=10, server_side_retries_delay=3)
|
||||
@@ -666,8 +666,8 @@ class ConnectorOpTestCase(base.TestCase):
|
||||
'HTTP GET of SessionService failed %s, '
|
||||
'this is expected prior to authentication', 'HTTP GET '
|
||||
'http://redfish/v1/SessionService returned code '
|
||||
'%s. unknown error Extended information: '
|
||||
'None' % http_client.FORBIDDEN)
|
||||
f'{http_client.FORBIDDEN!s}. unknown error Extended '
|
||||
'information: None')
|
||||
self.assertEqual(http_client.FORBIDDEN, exc.status_code)
|
||||
|
||||
def test_blocking_no_location_header(self):
|
||||
|
@@ -40,7 +40,7 @@ class MainTestCase(base.TestCase):
|
||||
@mock.patch.object(connector, 'Connector', autospec=True)
|
||||
@mock.patch.object(sessionservice, 'SessionService', autospec=True)
|
||||
def setUp(self, mock_session_service, mock_connector, mock_auth):
|
||||
super(MainTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.sess_serv = mock.Mock()
|
||||
self.sess_serv.create_session.return_value = (None, None)
|
||||
@@ -561,7 +561,7 @@ class MainTestCase(base.TestCase):
|
||||
class BareMinimumMainTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BareMinimumMainTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.MagicMock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'bare_minimum_root.json') as f:
|
||||
|
@@ -27,7 +27,7 @@ from sushy.tests.unit import base
|
||||
class TaskMonitorTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TaskMonitorTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
|
||||
with open('sushy/tests/unit/json_samples/task.json') as f:
|
||||
|
@@ -52,7 +52,7 @@ class UtilsTestCase(base.TestCase):
|
||||
self.assertEqual(True, utils.bool_or_none(True))
|
||||
|
||||
def setUp(self):
|
||||
super(UtilsTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.MagicMock()
|
||||
with open('sushy/tests/unit/json_samples/system.json') as f:
|
||||
system_json = json.load(f)
|
||||
@@ -178,7 +178,7 @@ class BaseResource(resource_base.ResourceBase):
|
||||
class CacheTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(CacheTestCase, self).setUp()
|
||||
super().setUp()
|
||||
self.conn = mock.Mock()
|
||||
self.res = BaseResource(connector=self.conn, path='/Foo',
|
||||
redfish_version='1.0.2')
|
||||
|
@@ -118,7 +118,7 @@ def get_sub_resource_path_by(resource, subresource_name, is_collection=False):
|
||||
except (TypeError, KeyError):
|
||||
attribute = '/'.join(subresource_name)
|
||||
if is_collection:
|
||||
attribute += '[%s]' % len(elements)
|
||||
attribute += f'[{len(elements)}]'
|
||||
attribute += '/@odata.id'
|
||||
raise exceptions.MissingAttributeError(
|
||||
attribute=attribute, resource=resource.path)
|
||||
|
Reference in New Issue
Block a user