Merge "Stop subclassing object"
This commit is contained in:
commit
7e2a51aeff
@ -36,7 +36,7 @@ config = loader.OpenStackConfig()
|
|||||||
cloud = openstack.connect(cloud=TEST_CLOUD)
|
cloud = openstack.connect(cloud=TEST_CLOUD)
|
||||||
|
|
||||||
|
|
||||||
class Opts(object):
|
class Opts:
|
||||||
def __init__(self, cloud_name='devstack-admin', debug=False):
|
def __init__(self, cloud_name='devstack-admin', debug=False):
|
||||||
self.cloud = cloud_name
|
self.cloud = cloud_name
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
@ -20,7 +20,7 @@ from openstack.orchestration import orchestration_service
|
|||||||
from openstack.workflow import workflow_service
|
from openstack.workflow import workflow_service
|
||||||
|
|
||||||
|
|
||||||
class ServicesMixin(object):
|
class ServicesMixin:
|
||||||
|
|
||||||
identity = identity_service.IdentityService(service_type='identity')
|
identity = identity_service.IdentityService(service_type='identity')
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ CONFIG_DRIVE_DICT_VERSION = '1.56'
|
|||||||
"""API version in which configdrive can be a dictionary."""
|
"""API version in which configdrive can be a dictionary."""
|
||||||
|
|
||||||
|
|
||||||
class ListMixin(object):
|
class ListMixin:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list(cls, session, details=False, **params):
|
def list(cls, session, details=False, **params):
|
||||||
|
@ -18,7 +18,7 @@ from openstack import resource
|
|||||||
from openstack import utils
|
from openstack import utils
|
||||||
|
|
||||||
|
|
||||||
class ValidationResult(object):
|
class ValidationResult:
|
||||||
"""Result of a single interface validation.
|
"""Result of a single interface validation.
|
||||||
|
|
||||||
:ivar result: Result of a validation, ``True`` for success, ``False`` for
|
:ivar result: Result of a validation, ``True`` for success, ``False`` for
|
||||||
|
@ -139,7 +139,7 @@ def _pop_or_get(resource, key, default, strict):
|
|||||||
return resource.get(key, default)
|
return resource.get(key, default)
|
||||||
|
|
||||||
|
|
||||||
class Normalizer(object):
|
class Normalizer:
|
||||||
'''Mix-in class to provide the normalization functions.
|
'''Mix-in class to provide the normalization functions.
|
||||||
|
|
||||||
This is in a separate class just for on-disk source code organization
|
This is in a separate class just for on-disk source code organization
|
||||||
|
@ -667,7 +667,7 @@ def generate_patches_from_kwargs(operation, **kwargs):
|
|||||||
return sorted(patches)
|
return sorted(patches)
|
||||||
|
|
||||||
|
|
||||||
class FileSegment(object):
|
class FileSegment:
|
||||||
"""File-like object to pass to requests."""
|
"""File-like object to pass to requests."""
|
||||||
|
|
||||||
def __init__(self, filename, offset, length):
|
def __init__(self, filename, offset, length):
|
||||||
|
@ -22,7 +22,7 @@ from openstack.cloud import _utils
|
|||||||
__all__ = ['OpenStackInventory']
|
__all__ = ['OpenStackInventory']
|
||||||
|
|
||||||
|
|
||||||
class OpenStackInventory(object):
|
class OpenStackInventory:
|
||||||
|
|
||||||
# Put this here so the capability can be detected with hasattr on the class
|
# Put this here so the capability can be detected with hasattr on the class
|
||||||
extra_config = None
|
extra_config = None
|
||||||
|
@ -48,7 +48,7 @@ DEFAULT_MAX_FILE_SIZE = _object_store.DEFAULT_MAX_FILE_SIZE
|
|||||||
OBJECT_CONTAINER_ACLS = _object_store.OBJECT_CONTAINER_ACLS
|
OBJECT_CONTAINER_ACLS = _object_store.OBJECT_CONTAINER_ACLS
|
||||||
|
|
||||||
|
|
||||||
class _OpenStackCloudMixin(object):
|
class _OpenStackCloudMixin:
|
||||||
"""Represent a connection to an OpenStack Cloud.
|
"""Represent a connection to an OpenStack Cloud.
|
||||||
|
|
||||||
OpenStackCloud is the entry point for all cloud operations, regardless
|
OpenStackCloud is the entry point for all cloud operations, regardless
|
||||||
@ -126,7 +126,7 @@ class _OpenStackCloudMixin(object):
|
|||||||
def _fake_invalidate(unused):
|
def _fake_invalidate(unused):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class _FakeCache(object):
|
class _FakeCache:
|
||||||
def invalidate(self):
|
def invalidate(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ from openstack import exceptions
|
|||||||
from openstack import utils
|
from openstack import utils
|
||||||
|
|
||||||
|
|
||||||
class MetadataMixin(object):
|
class MetadataMixin:
|
||||||
|
|
||||||
def _metadata(self, method, key=None, clear=False, delete=False,
|
def _metadata(self, method, key=None, clear=False, delete=False,
|
||||||
metadata=None):
|
metadata=None):
|
||||||
|
@ -45,7 +45,7 @@ def merge_clouds(old_dict, new_dict):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class VersionRequest(object):
|
class VersionRequest:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
version=None,
|
version=None,
|
||||||
|
@ -201,7 +201,7 @@ def from_conf(conf, session=None, service_types=None, **kwargs):
|
|||||||
session=session, config=config_dict, **kwargs)
|
session=session, config=config_dict, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class CloudRegion(object):
|
class CloudRegion:
|
||||||
# TODO(efried): Doc the rest of the kwargs
|
# TODO(efried): Doc the rest of the kwargs
|
||||||
"""The configuration for a Region of an OpenStack Cloud.
|
"""The configuration for a Region of an OpenStack Cloud.
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ def _fix_argv(argv):
|
|||||||
options=','.join(overlap)))
|
options=','.join(overlap)))
|
||||||
|
|
||||||
|
|
||||||
class OpenStackConfig(object):
|
class OpenStackConfig:
|
||||||
|
|
||||||
# These two attribute are to allow os-client-config to plumb in its
|
# These two attribute are to allow os-client-config to plumb in its
|
||||||
# local versions for backwards compat.
|
# local versions for backwards compat.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
class Formatter(object):
|
class Formatter:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def serialize(cls, value):
|
def serialize(cls, value):
|
||||||
|
@ -24,7 +24,7 @@ def _verify_checksum(md5, checksum):
|
|||||||
"checksum mismatch: %s != %s" % (checksum, digest))
|
"checksum mismatch: %s != %s" % (checksum, digest))
|
||||||
|
|
||||||
|
|
||||||
class DownloadMixin(object):
|
class DownloadMixin:
|
||||||
|
|
||||||
def download(self, session, stream=False, output=None, chunk_size=1024):
|
def download(self, session, stream=False, output=None, chunk_size=1024):
|
||||||
"""Download the data contained in an image"""
|
"""Download the data contained in an image"""
|
||||||
|
@ -28,7 +28,7 @@ HASH_METHODS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ImageSigner(object):
|
class ImageSigner:
|
||||||
"""Image file signature generator.
|
"""Image file signature generator.
|
||||||
|
|
||||||
Generates signatures for files using a specified private key file.
|
Generates signatures for files using a specified private key file.
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
class IterableChunkedFile(object):
|
class IterableChunkedFile:
|
||||||
"""File object chunk iterator using yield.
|
"""File object chunk iterator using yield.
|
||||||
|
|
||||||
Represents a local file as an iterable object by splitting the file
|
Represents a local file as an iterable object by splitting the file
|
||||||
|
@ -82,7 +82,7 @@ def _convert_type(value, data_type, list_type=None):
|
|||||||
return data_type(value)
|
return data_type(value)
|
||||||
|
|
||||||
|
|
||||||
class _BaseComponent(object):
|
class _BaseComponent:
|
||||||
|
|
||||||
# The name this component is being tracked as in the Resource
|
# The name this component is being tracked as in the Resource
|
||||||
key = None
|
key = None
|
||||||
@ -257,7 +257,7 @@ class _ComponentManager(collections.MutableMapping):
|
|||||||
self._dirty = set()
|
self._dirty = set()
|
||||||
|
|
||||||
|
|
||||||
class _Request(object):
|
class _Request:
|
||||||
"""Prepared components that go into a KSA request"""
|
"""Prepared components that go into a KSA request"""
|
||||||
|
|
||||||
def __init__(self, url, body, headers):
|
def __init__(self, url, body, headers):
|
||||||
@ -266,7 +266,7 @@ class _Request(object):
|
|||||||
self.headers = headers
|
self.headers = headers
|
||||||
|
|
||||||
|
|
||||||
class QueryParameters(object):
|
class QueryParameters:
|
||||||
|
|
||||||
def __init__(self, *names, **mappings):
|
def __init__(self, *names, **mappings):
|
||||||
"""Create a dict of accepted query parameters
|
"""Create a dict of accepted query parameters
|
||||||
@ -1869,7 +1869,7 @@ class Resource(dict):
|
|||||||
"No %s found for %s" % (cls.__name__, name_or_id))
|
"No %s found for %s" % (cls.__name__, name_or_id))
|
||||||
|
|
||||||
|
|
||||||
class TagMixin(object):
|
class TagMixin:
|
||||||
|
|
||||||
_tag_query_parameters = {
|
_tag_query_parameters = {
|
||||||
'tags': 'tags',
|
'tags': 'tags',
|
||||||
|
@ -27,7 +27,7 @@ _logger = _log.setup_logging('openstack')
|
|||||||
_service_type_manager = os_service_types.ServiceTypes()
|
_service_type_manager = os_service_types.ServiceTypes()
|
||||||
|
|
||||||
|
|
||||||
class _ServiceDisabledProxyShim(object):
|
class _ServiceDisabledProxyShim:
|
||||||
def __init__(self, service_type, reason):
|
def __init__(self, service_type, reason):
|
||||||
self.service_type = service_type
|
self.service_type = service_type
|
||||||
self.reason = reason
|
self.reason = reason
|
||||||
@ -39,7 +39,7 @@ class _ServiceDisabledProxyShim(object):
|
|||||||
service_type=self.service_type, reason=self.reason or ''))
|
service_type=self.service_type, reason=self.reason or ''))
|
||||||
|
|
||||||
|
|
||||||
class ServiceDescription(object):
|
class ServiceDescription:
|
||||||
|
|
||||||
#: Dictionary of supported versions and proxy classes for that version
|
#: Dictionary of supported versions and proxy classes for that version
|
||||||
supported_versions = None
|
supported_versions = None
|
||||||
|
@ -282,7 +282,7 @@ def make_fake_port(address, node_id=None, port_id=None):
|
|||||||
node_id=node_id))
|
node_id=node_id))
|
||||||
|
|
||||||
|
|
||||||
class FakeFloatingIP(object):
|
class FakeFloatingIP:
|
||||||
def __init__(self, id, pool, ip, fixed_ip, instance_id):
|
def __init__(self, id, pool, ip, fixed_ip, instance_id):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.pool = pool
|
self.pool = pool
|
||||||
@ -345,7 +345,7 @@ def make_fake_hypervisor(id, name):
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
class FakeVolume(object):
|
class FakeVolume:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, id, status, name, attachments=[],
|
self, id, status, name, attachments=[],
|
||||||
size=75):
|
size=75):
|
||||||
@ -363,7 +363,7 @@ class FakeVolume(object):
|
|||||||
self.metadata = {}
|
self.metadata = {}
|
||||||
|
|
||||||
|
|
||||||
class FakeVolumeSnapshot(object):
|
class FakeVolumeSnapshot:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, id, status, name, description, size=75):
|
self, id, status, name, description, size=75):
|
||||||
self.id = id
|
self.id = id
|
||||||
@ -376,7 +376,7 @@ class FakeVolumeSnapshot(object):
|
|||||||
self.metadata = {}
|
self.metadata = {}
|
||||||
|
|
||||||
|
|
||||||
class FakeMachine(object):
|
class FakeMachine:
|
||||||
def __init__(self, id, name=None, driver=None, driver_info=None,
|
def __init__(self, id, name=None, driver=None, driver_info=None,
|
||||||
chassis_uuid=None, instance_info=None, instance_uuid=None,
|
chassis_uuid=None, instance_info=None, instance_uuid=None,
|
||||||
properties=None, reservation=None, last_error=None,
|
properties=None, reservation=None, last_error=None,
|
||||||
@ -394,7 +394,7 @@ class FakeMachine(object):
|
|||||||
self.provision_state = provision_state
|
self.provision_state = provision_state
|
||||||
|
|
||||||
|
|
||||||
class FakeMachinePort(object):
|
class FakeMachinePort:
|
||||||
def __init__(self, id, address, node_id):
|
def __init__(self, id, address, node_id):
|
||||||
self.uuid = id
|
self.uuid = id
|
||||||
self.address = address
|
self.address = address
|
||||||
@ -443,7 +443,7 @@ def make_fake_nova_security_group(id, name, description, rules):
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
class FakeNovaSecgroupRule(object):
|
class FakeNovaSecgroupRule:
|
||||||
def __init__(self, id, from_port=None, to_port=None, ip_protocol=None,
|
def __init__(self, id, from_port=None, to_port=None, ip_protocol=None,
|
||||||
cidr=None, parent_group_id=None):
|
cidr=None, parent_group_id=None):
|
||||||
self.id = id
|
self.id = id
|
||||||
@ -455,13 +455,13 @@ class FakeNovaSecgroupRule(object):
|
|||||||
self.parent_group_id = parent_group_id
|
self.parent_group_id = parent_group_id
|
||||||
|
|
||||||
|
|
||||||
class FakeHypervisor(object):
|
class FakeHypervisor:
|
||||||
def __init__(self, id, hostname):
|
def __init__(self, id, hostname):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.hypervisor_hostname = hostname
|
self.hypervisor_hostname = hostname
|
||||||
|
|
||||||
|
|
||||||
class FakeZone(object):
|
class FakeZone:
|
||||||
def __init__(self, id, name, type_, email, description,
|
def __init__(self, id, name, type_, email, description,
|
||||||
ttl, masters):
|
ttl, masters):
|
||||||
self.id = id
|
self.id = id
|
||||||
@ -473,7 +473,7 @@ class FakeZone(object):
|
|||||||
self.masters = masters
|
self.masters = masters
|
||||||
|
|
||||||
|
|
||||||
class FakeRecordset(object):
|
class FakeRecordset:
|
||||||
def __init__(self, zone, id, name, type_, description,
|
def __init__(self, zone, id, name, type_, description,
|
||||||
ttl, records):
|
ttl, records):
|
||||||
self.zone = zone
|
self.zone = zone
|
||||||
|
@ -18,7 +18,7 @@ TEST_IMAGE_NAME = 'Test Image'
|
|||||||
|
|
||||||
class TestImage(base.BaseFunctionalTest):
|
class TestImage(base.BaseFunctionalTest):
|
||||||
|
|
||||||
class ImageOpts(object):
|
class ImageOpts:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.image_api_version = '2'
|
self.image_api_version = '2'
|
||||||
|
|
||||||
|
@ -24,13 +24,13 @@ PUBLIC_V4 = '192.0.2.99'
|
|||||||
PUBLIC_V6 = '2001:0db8:face:0da0:face::0b00:1c' # rfc3849
|
PUBLIC_V6 = '2001:0db8:face:0da0:face::0b00:1c' # rfc3849
|
||||||
|
|
||||||
|
|
||||||
class FakeConfig(object):
|
class FakeConfig:
|
||||||
def get_region_name(self, service_type=None):
|
def get_region_name(self, service_type=None):
|
||||||
# TODO(efried): Validate service_type?
|
# TODO(efried): Validate service_type?
|
||||||
return 'test-region'
|
return 'test-region'
|
||||||
|
|
||||||
|
|
||||||
class FakeCloud(object):
|
class FakeCloud:
|
||||||
config = FakeConfig()
|
config = FakeConfig()
|
||||||
name = 'test-name'
|
name = 'test-name'
|
||||||
private = False
|
private = False
|
||||||
@ -942,10 +942,10 @@ class TestMeta(base.TestCase):
|
|||||||
|
|
||||||
def test_obj_list_to_munch(self):
|
def test_obj_list_to_munch(self):
|
||||||
"""Test conversion of a list of objects to a list of dictonaries"""
|
"""Test conversion of a list of objects to a list of dictonaries"""
|
||||||
class obj0(object):
|
class obj0:
|
||||||
value = 0
|
value = 0
|
||||||
|
|
||||||
class obj1(object):
|
class obj1:
|
||||||
value = 1
|
value = 1
|
||||||
|
|
||||||
list = [obj0, obj1]
|
list = [obj0, obj1]
|
||||||
|
@ -26,7 +26,7 @@ zone_dict = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ZoneTestWrapper(object):
|
class ZoneTestWrapper:
|
||||||
|
|
||||||
def __init__(self, ut, attrs):
|
def __init__(self, ut, attrs):
|
||||||
self.remote_res = attrs
|
self.remote_res = attrs
|
||||||
|
@ -806,7 +806,7 @@ class TestServer(base.TestCase):
|
|||||||
def test_live_migrate_no_force(self):
|
def test_live_migrate_no_force(self):
|
||||||
sot = server.Server(**EXAMPLE)
|
sot = server.Server(**EXAMPLE)
|
||||||
|
|
||||||
class FakeEndpointData(object):
|
class FakeEndpointData:
|
||||||
min_microversion = None
|
min_microversion = None
|
||||||
max_microversion = None
|
max_microversion = None
|
||||||
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
||||||
@ -822,7 +822,7 @@ class TestServer(base.TestCase):
|
|||||||
def test_live_migrate_no_microversion_force_true(self):
|
def test_live_migrate_no_microversion_force_true(self):
|
||||||
sot = server.Server(**EXAMPLE)
|
sot = server.Server(**EXAMPLE)
|
||||||
|
|
||||||
class FakeEndpointData(object):
|
class FakeEndpointData:
|
||||||
min_microversion = None
|
min_microversion = None
|
||||||
max_microversion = None
|
max_microversion = None
|
||||||
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
||||||
@ -848,7 +848,7 @@ class TestServer(base.TestCase):
|
|||||||
def test_live_migrate_25(self):
|
def test_live_migrate_25(self):
|
||||||
sot = server.Server(**EXAMPLE)
|
sot = server.Server(**EXAMPLE)
|
||||||
|
|
||||||
class FakeEndpointData(object):
|
class FakeEndpointData:
|
||||||
min_microversion = '2.1'
|
min_microversion = '2.1'
|
||||||
max_microversion = '2.25'
|
max_microversion = '2.25'
|
||||||
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
||||||
@ -872,7 +872,7 @@ class TestServer(base.TestCase):
|
|||||||
def test_live_migrate_25_default_block(self):
|
def test_live_migrate_25_default_block(self):
|
||||||
sot = server.Server(**EXAMPLE)
|
sot = server.Server(**EXAMPLE)
|
||||||
|
|
||||||
class FakeEndpointData(object):
|
class FakeEndpointData:
|
||||||
min_microversion = '2.1'
|
min_microversion = '2.1'
|
||||||
max_microversion = '2.25'
|
max_microversion = '2.25'
|
||||||
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
||||||
@ -896,7 +896,7 @@ class TestServer(base.TestCase):
|
|||||||
def test_live_migrate_30(self):
|
def test_live_migrate_30(self):
|
||||||
sot = server.Server(**EXAMPLE)
|
sot = server.Server(**EXAMPLE)
|
||||||
|
|
||||||
class FakeEndpointData(object):
|
class FakeEndpointData:
|
||||||
min_microversion = '2.1'
|
min_microversion = '2.1'
|
||||||
max_microversion = '2.30'
|
max_microversion = '2.30'
|
||||||
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
||||||
@ -920,7 +920,7 @@ class TestServer(base.TestCase):
|
|||||||
def test_live_migrate_30_force(self):
|
def test_live_migrate_30_force(self):
|
||||||
sot = server.Server(**EXAMPLE)
|
sot = server.Server(**EXAMPLE)
|
||||||
|
|
||||||
class FakeEndpointData(object):
|
class FakeEndpointData:
|
||||||
min_microversion = '2.1'
|
min_microversion = '2.1'
|
||||||
max_microversion = '2.30'
|
max_microversion = '2.30'
|
||||||
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
self.sess.get_endpoint_data.return_value = FakeEndpointData()
|
||||||
|
@ -95,7 +95,7 @@ def calculate_md5_checksum(data):
|
|||||||
return checksum.hexdigest()
|
return checksum.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
class FakeResponse(object):
|
class FakeResponse:
|
||||||
def __init__(self, response, status_code=200, headers=None, reason=None):
|
def __init__(self, response, status_code=200, headers=None, reason=None):
|
||||||
self.body = response
|
self.body = response
|
||||||
self.content = response
|
self.content = response
|
||||||
|
@ -27,7 +27,7 @@ from openstack.tests.unit import test_proxy_base
|
|||||||
EXAMPLE = fake_image.EXAMPLE
|
EXAMPLE = fake_image.EXAMPLE
|
||||||
|
|
||||||
|
|
||||||
class FakeResponse(object):
|
class FakeResponse:
|
||||||
def __init__(self, response, status_code=200, headers=None):
|
def __init__(self, response, status_code=200, headers=None):
|
||||||
self.body = response
|
self.body = response
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
|
@ -137,7 +137,7 @@ class TestProxyPrivate(base.TestCase):
|
|||||||
# of that same behavior to let us check that `new` gets
|
# of that same behavior to let us check that `new` gets
|
||||||
# called with the expected arguments.
|
# called with the expected arguments.
|
||||||
|
|
||||||
class Fake(object):
|
class Fake:
|
||||||
call = {}
|
call = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -24,7 +24,7 @@ from openstack import resource
|
|||||||
from openstack.tests.unit import base
|
from openstack.tests.unit import base
|
||||||
|
|
||||||
|
|
||||||
class FakeResponse(object):
|
class FakeResponse:
|
||||||
def __init__(self, response, status_code=200, headers=None):
|
def __init__(self, response, status_code=200, headers=None):
|
||||||
self.body = response
|
self.body = response
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
@ -74,7 +74,7 @@ class TestComponent(base.TestCase):
|
|||||||
def test_get_name_None(self):
|
def test_get_name_None(self):
|
||||||
name = "name"
|
name = "name"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {name: None}
|
_example = {name: None}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -87,7 +87,7 @@ class TestComponent(base.TestCase):
|
|||||||
def test_get_default(self):
|
def test_get_default(self):
|
||||||
expected_result = 123
|
expected_result = 123
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {}
|
_example = {}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -104,7 +104,7 @@ class TestComponent(base.TestCase):
|
|||||||
name = "name"
|
name = "name"
|
||||||
expected_result = 123
|
expected_result = 123
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {name: expected_result}
|
_example = {name: expected_result}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -119,7 +119,7 @@ class TestComponent(base.TestCase):
|
|||||||
name = "name"
|
name = "name"
|
||||||
value = "123"
|
value = "123"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {name: value}
|
_example = {name: value}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -134,7 +134,7 @@ class TestComponent(base.TestCase):
|
|||||||
value = "123"
|
value = "123"
|
||||||
expected_result = "one hundred twenty three"
|
expected_result = "one hundred twenty three"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {name: value}
|
_example = {name: value}
|
||||||
|
|
||||||
class FakeFormatter(format.Formatter):
|
class FakeFormatter(format.Formatter):
|
||||||
@ -154,7 +154,7 @@ class TestComponent(base.TestCase):
|
|||||||
name = "name"
|
name = "name"
|
||||||
expected_value = "123"
|
expected_value = "123"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {}
|
_example = {}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -167,7 +167,7 @@ class TestComponent(base.TestCase):
|
|||||||
def test_set_name_typed(self):
|
def test_set_name_typed(self):
|
||||||
expected_value = "123"
|
expected_value = "123"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {}
|
_example = {}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -177,7 +177,7 @@ class TestComponent(base.TestCase):
|
|||||||
# instance that would allow us to call `assert_called_once_with` to
|
# instance that would allow us to call `assert_called_once_with` to
|
||||||
# ensure that we're sending the value through the type.
|
# ensure that we're sending the value through the type.
|
||||||
# Instead, we use this tiny version of a similar thing.
|
# Instead, we use this tiny version of a similar thing.
|
||||||
class FakeType(object):
|
class FakeType:
|
||||||
calls = []
|
calls = []
|
||||||
|
|
||||||
def __init__(self, arg):
|
def __init__(self, arg):
|
||||||
@ -192,7 +192,7 @@ class TestComponent(base.TestCase):
|
|||||||
def test_set_name_formatter(self):
|
def test_set_name_formatter(self):
|
||||||
expected_value = "123"
|
expected_value = "123"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {}
|
_example = {}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -220,7 +220,7 @@ class TestComponent(base.TestCase):
|
|||||||
name = "name"
|
name = "name"
|
||||||
expected_value = "123"
|
expected_value = "123"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {name: expected_value}
|
_example = {name: expected_value}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
@ -235,7 +235,7 @@ class TestComponent(base.TestCase):
|
|||||||
name = "name"
|
name = "name"
|
||||||
expected_value = "123"
|
expected_value = "123"
|
||||||
|
|
||||||
class Parent(object):
|
class Parent:
|
||||||
_example = {"what": expected_value}
|
_example = {"what": expected_value}
|
||||||
|
|
||||||
instance = Parent()
|
instance = Parent()
|
||||||
|
@ -75,7 +75,7 @@ def get_string_format_keys(fmt_string, old_style=True):
|
|||||||
use the old style string formatting.
|
use the old style string formatting.
|
||||||
"""
|
"""
|
||||||
if old_style:
|
if old_style:
|
||||||
class AccessSaver(object):
|
class AccessSaver:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.keys = []
|
self.keys = []
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ def maximum_supported_microversion(adapter, client_maximum):
|
|||||||
return discover.version_to_string(result)
|
return discover.version_to_string(result)
|
||||||
|
|
||||||
|
|
||||||
class TinyDAG(object):
|
class TinyDAG:
|
||||||
"""Tiny DAG
|
"""Tiny DAG
|
||||||
|
|
||||||
Bases on the Kahn's algorithm, and enables parallel visiting of the nodes
|
Bases on the Kahn's algorithm, and enables parallel visiting of the nodes
|
||||||
|
@ -71,7 +71,7 @@ def make_names():
|
|||||||
for imp in sorted(imports):
|
for imp in sorted(imports):
|
||||||
print(imp)
|
print(imp)
|
||||||
print('\n')
|
print('\n')
|
||||||
print("class ServicesMixin(object):\n")
|
print("class ServicesMixin:\n")
|
||||||
for service in services:
|
for service in services:
|
||||||
if service:
|
if service:
|
||||||
print(" {service}".format(service=service))
|
print(" {service}".format(service=service))
|
||||||
|
3
tox.ini
3
tox.ini
@ -107,12 +107,13 @@ commands =
|
|||||||
# The following are ignored on purpose. It's not super worth it to fix them.
|
# The following are ignored on purpose. It's not super worth it to fix them.
|
||||||
# However, if you feel strongly about it, patches will be accepted to fix them
|
# However, if you feel strongly about it, patches will be accepted to fix them
|
||||||
# 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.
|
||||||
|
# H238 New Style Classes are the default in Python3
|
||||||
# H306 Is about alphabetical imports - there's a lot to fix.
|
# H306 Is about alphabetical imports - there's a lot to fix.
|
||||||
# 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 = H306,H4,W503
|
ignore = H238,H306,H4,W503
|
||||||
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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user