From 187e88a5593e4f475379738811043ee4528a7df3 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 29 Aug 2024 11:29:24 +0100 Subject: [PATCH] pre-commit: Migrate from black to ruff format This is mostly a case of adding trailing commas and rewrapping things to fit on one line. Change-Id: Iaabb38970e8077c3cfd19041c39e3d40d2d93ffa Signed-off-by: Stephen Finucane --- .pre-commit-config.yaml | 6 +- openstack/_hacking/checks.py | 2 +- openstack/accelerator/v2/deployable.py | 2 +- openstack/cloud/_accelerator.py | 1 - openstack/cloud/_baremetal.py | 33 ++- openstack/cloud/_block_storage.py | 61 +----- openstack/cloud/_coe.py | 15 +- openstack/cloud/_compute.py | 26 +-- openstack/cloud/_dns.py | 1 - openstack/cloud/_identity.py | 78 +------ openstack/cloud/_image.py | 8 +- openstack/cloud/_network.py | 190 ++++-------------- openstack/cloud/_network_common.py | 22 +- openstack/cloud/_object_store.py | 1 - openstack/cloud/_orchestration.py | 5 +- openstack/cloud/_shared_file_system.py | 1 - openstack/cloud/_utils.py | 7 +- openstack/cloud/exc.py | 2 +- openstack/cloud/openstackcloud.py | 2 + openstack/common/quota_set.py | 4 +- openstack/compute/v2/limits.py | 4 +- openstack/compute/v2/server_ip.py | 2 +- openstack/config/__init__.py | 2 +- openstack/config/cloud_region.py | 5 +- openstack/connection.py | 2 +- openstack/identity/v3/project.py | 2 +- openstack/image/v2/image.py | 6 +- openstack/load_balancer/v2/_proxy.py | 2 +- openstack/load_balancer/v2/health_monitor.py | 2 +- openstack/load_balancer/v2/l7_policy.py | 2 +- openstack/load_balancer/v2/l7_rule.py | 2 +- openstack/load_balancer/v2/listener.py | 2 +- openstack/load_balancer/v2/load_balancer.py | 2 +- openstack/load_balancer/v2/member.py | 2 +- openstack/load_balancer/v2/pool.py | 2 +- openstack/network/v2/_base.py | 2 +- openstack/network/v2/floating_ip.py | 2 +- openstack/network/v2/network.py | 2 +- openstack/network/v2/port.py | 2 +- openstack/network/v2/qos_policy.py | 2 +- openstack/network/v2/router.py | 2 +- openstack/network/v2/security_group.py | 2 +- openstack/network/v2/security_group_rule.py | 2 +- openstack/network/v2/subnet.py | 2 +- openstack/network/v2/subnet_pool.py | 2 +- openstack/network/v2/trunk.py | 2 +- openstack/orchestration/v1/_proxy.py | 4 +- .../v2/share_access_rule.py | 2 +- .../tests/functional/cloud/test_devstack.py | 1 + .../functional/cloud/test_floating_ip_pool.py | 1 - .../tests/functional/cloud/test_keypairs.py | 1 + .../tests/functional/cloud/test_limits.py | 1 + .../tests/functional/cloud/test_project.py | 1 + .../tests/functional/cloud/test_recordset.py | 1 + .../functional/cloud/test_volume_type.py | 1 + .../image/v2/test_metadef_property.py | 2 +- .../load_balancer/v2/test_load_balancer.py | 2 +- .../functional/network/v2/test_floating_ip.py | 2 +- .../network/v2/test_port_forwarding.py | 2 +- .../test_quota_class_set.py | 2 +- .../tests/unit/block_storage/v3/test_type.py | 2 +- .../tests/unit/cloud/test_baremetal_node.py | 10 +- .../tests/unit/cloud/test_delete_server.py | 1 + openstack/tests/unit/cloud/test_fwaas.py | 6 +- openstack/tests/unit/config/test_config.py | 2 +- openstack/tests/unit/config/test_from_conf.py | 2 +- .../tests/unit/object_store/v1/test_proxy.py | 4 +- openstack/tests/unit/test_connection.py | 8 +- pyproject.toml | 6 + 69 files changed, 161 insertions(+), 431 deletions(-) create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 54fa3c1a9..581e10a54 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,11 +28,7 @@ repos: hooks: - id: ruff args: ['--fix'] - - repo: https://github.com/psf/black - rev: 24.8.0 - hooks: - - id: black - args: ['-S', '-l', '79'] + - id: ruff-format - repo: https://opendev.org/openstack/hacking rev: 7.0.0 hooks: diff --git a/openstack/_hacking/checks.py b/openstack/_hacking/checks.py index df0e7d4ea..9bae7e45c 100644 --- a/openstack/_hacking/checks.py +++ b/openstack/_hacking/checks.py @@ -61,5 +61,5 @@ def assert_no_deprecated_exceptions(logical_line, filename): 'OpenStackCloudURINotFound', 'OpenStackCloudResourceNotFound', ): - if re.search(fr'\b{exception}\b', logical_line): + if re.search(rf'\b{exception}\b', logical_line): yield (0, 'O310: Use of deprecated Exception class') diff --git a/openstack/accelerator/v2/deployable.py b/openstack/accelerator/v2/deployable.py index 889853e40..27873937e 100644 --- a/openstack/accelerator/v2/deployable.py +++ b/openstack/accelerator/v2/deployable.py @@ -73,7 +73,7 @@ class Deployable(resource.Resource): json=request.body, headers=request.headers, microversion=microversion, - **kwargs + **kwargs, ) self.microversion = microversion self._translate_response(response, has_body=has_body) diff --git a/openstack/cloud/_accelerator.py b/openstack/cloud/_accelerator.py index effd65c47..9944147d2 100644 --- a/openstack/cloud/_accelerator.py +++ b/openstack/cloud/_accelerator.py @@ -14,7 +14,6 @@ from openstack.cloud import openstackcloud class AcceleratorCloudMixin(openstackcloud._OpenStackCloudMixin): - def list_deployables(self, filters=None): """List all available deployables. diff --git a/openstack/cloud/_baremetal.py b/openstack/cloud/_baremetal.py index 277d36135..e9eee152b 100644 --- a/openstack/cloud/_baremetal.py +++ b/openstack/cloud/_baremetal.py @@ -42,7 +42,6 @@ def _normalize_port_list(nics): class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin): - def list_nics(self): """Return a list of all bare metal ports.""" return list(self.baremetal.ports(details=True)) @@ -187,7 +186,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin): timeout=3600, lock_timeout=600, provision_state='available', - **kwargs + **kwargs, ): """Register Baremetal with Ironic @@ -208,10 +207,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin): Example:: - [ - {'address': 'aa:bb:cc:dd:ee:01'}, - {'address': 'aa:bb:cc:dd:ee:02'} - ] + [{'address': 'aa:bb:cc:dd:ee:01'}, {'address': 'aa:bb:cc:dd:ee:02'}] Alternatively, you can provide an array of MAC addresses. :param wait: Boolean value, defaulting to false, to wait for the node @@ -352,21 +348,16 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin): Example patch construction:: - patch=[] - patch.append({ - 'op': 'remove', - 'path': '/instance_info' - }) - patch.append({ - 'op': 'replace', - 'path': '/name', - 'value': 'newname' - }) - patch.append({ - 'op': 'add', - 'path': '/driver_info/username', - 'value': 'administrator' - }) + patch = [] + patch.append({'op': 'remove', 'path': '/instance_info'}) + patch.append({'op': 'replace', 'path': '/name', 'value': 'newname'}) + patch.append( + { + 'op': 'add', + 'path': '/driver_info/username', + 'value': 'administrator', + } + ) :returns: Current state of the node. :rtype: :class:`~openstack.baremetal.v1.node.Node`. diff --git a/openstack/cloud/_block_storage.py b/openstack/cloud/_block_storage.py index 72fe26405..df959b722 100644 --- a/openstack/cloud/_block_storage.py +++ b/openstack/cloud/_block_storage.py @@ -19,7 +19,6 @@ from openstack import warnings as os_warnings class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): - # TODO(stephenfin): Remove 'cache' in a future major version def list_volumes(self, cache=True): """List all available volumes. @@ -59,12 +58,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -94,12 +88,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -467,12 +456,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -542,12 +526,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -570,7 +549,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): { 'name': 'my-volume-snapshot', 'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56', - 'all_tenants': 1 + 'all_tenants': 1, } :returns: A list of volume ``Snapshot`` objects. @@ -590,7 +569,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): 'name': 'my-volume-backup', 'status': 'available', 'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56', - 'all_tenants': 1 + 'all_tenants': 1, } :returns: A list of volume ``Backup`` objects. @@ -671,12 +650,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -698,12 +672,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -725,12 +694,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -758,12 +722,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR diff --git a/openstack/cloud/_coe.py b/openstack/cloud/_coe.py index c64a96c01..01fa92f8b 100644 --- a/openstack/cloud/_coe.py +++ b/openstack/cloud/_coe.py @@ -16,7 +16,6 @@ from openstack import exceptions class CoeCloudMixin(openstackcloud._OpenStackCloudMixin): - def list_coe_clusters(self): """List COE (Container Orchestration Engine) cluster. @@ -51,12 +50,7 @@ class CoeCloudMixin(openstackcloud._OpenStackCloudMixin): A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -207,12 +201,7 @@ class CoeCloudMixin(openstackcloud._OpenStackCloudMixin): A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. diff --git a/openstack/cloud/_compute.py b/openstack/cloud/_compute.py index da58282cf..0b9267def 100644 --- a/openstack/cloud/_compute.py +++ b/openstack/cloud/_compute.py @@ -69,7 +69,6 @@ def _pop_or_get(resource, key, default, strict): class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin): - @property def _compute_region(self): # This is only used in exception messages. Can we get rid of it? @@ -398,12 +397,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -421,12 +415,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -505,12 +494,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin): A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -1640,9 +1624,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin): { 'availability_zone': 'nova', - 'metadata': { - 'cpu_allocation_ratio': '1.0' - } + 'metadata': {'cpu_allocation_ratio': '1.0'}, } :returns: An aggregate dict or None if no matching aggregate is diff --git a/openstack/cloud/_dns.py b/openstack/cloud/_dns.py index 4864a1036..d495b8689 100644 --- a/openstack/cloud/_dns.py +++ b/openstack/cloud/_dns.py @@ -17,7 +17,6 @@ from openstack import resource class DnsCloudMixin(openstackcloud._OpenStackCloudMixin): - def list_zones(self, filters=None): """List all available zones. diff --git a/openstack/cloud/_identity.py b/openstack/cloud/_identity.py index 8973266f3..eb78bb2ed 100644 --- a/openstack/cloud/_identity.py +++ b/openstack/cloud/_identity.py @@ -20,7 +20,6 @@ from openstack import warnings as os_warnings class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): - def _get_project_id_param_dict(self, name_or_id): if name_or_id: project = self.get_project(name_or_id) @@ -73,12 +72,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -114,12 +108,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -141,12 +130,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -264,12 +248,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -304,12 +283,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -506,12 +480,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -675,12 +644,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -837,12 +801,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -875,12 +834,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -919,12 +873,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR @@ -1055,12 +1004,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR diff --git a/openstack/cloud/_image.py b/openstack/cloud/_image.py index 95f5f238d..00b232321 100644 --- a/openstack/cloud/_image.py +++ b/openstack/cloud/_image.py @@ -17,7 +17,6 @@ from openstack import utils class ImageCloudMixin(openstackcloud._OpenStackCloudMixin): - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -65,12 +64,7 @@ class ImageCloudMixin(openstackcloud._OpenStackCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. diff --git a/openstack/cloud/_network.py b/openstack/cloud/_network.py index f8ddd5f54..1abd9a436 100644 --- a/openstack/cloud/_network.py +++ b/openstack/cloud/_network.py @@ -17,7 +17,6 @@ from openstack import exceptions class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): - def _neutron_extensions(self): extensions = set() for extension in self.network.extensions(): @@ -180,12 +179,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -254,12 +248,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -304,12 +293,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -340,12 +324,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -368,12 +347,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} :returns: A network ``Subnet`` object if found, else None. """ @@ -400,12 +374,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -459,7 +428,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): :param bool external: Whether this network is externally accessible. :param dict provider: A dict of network provider options. Example:: - { 'network_type': 'vlan', 'segmentation_id': 'vlan1' } + {'network_type': 'vlan', 'segmentation_id': 'vlan1'} :param string project_id: Specify the project ID this network will be created on (admin-only). @@ -566,7 +535,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): :param bool external: Whether this network is externally accessible. :param dict provider: A dict of network provider options. Example:: - { 'network_type': 'vlan', 'segmentation_id': 'vlan1' } + {'network_type': 'vlan', 'segmentation_id': 'vlan1'} :param int mtu_size: New maximum transmission unit value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6. @@ -753,12 +722,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -794,12 +758,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -822,12 +781,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -865,12 +819,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -957,12 +906,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -998,12 +942,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -1026,12 +965,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -1061,12 +995,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -2176,7 +2105,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): [ { "subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b", - "ip_address": "192.168.10.2" + "ip_address": "192.168.10.2", } ] @@ -2237,7 +2166,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): [ { "subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b", - "ip_address": "192.168.10.2" + "ip_address": "192.168.10.2", } ] @@ -2247,12 +2176,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): Example:: - [ - { - "destination": "179.24.1.0/24", - "nexthop": "172.24.3.99" - } - ] + [{"destination": "179.24.1.0/24", "nexthop": "172.24.3.99"}] :returns: The updated network ``Router`` object. :raises: :class:`~openstack.exceptions.SDKException` on operation @@ -2346,12 +2270,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): :param allocation_pools: A list of dictionaries of the start and end addresses for the allocation pools. For example:: - [ - { - "start": "192.168.199.2", - "end": "192.168.199.254" - } - ] + [{"start": "192.168.199.2", "end": "192.168.199.254"}] :param string gateway_ip: The gateway IP address. When you specify both allocation_pools and gateway_ip, you must ensure that the gateway @@ -2362,20 +2281,14 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): :param dns_nameservers: A list of DNS name servers for the subnet. For example:: - [ "8.8.8.7", "8.8.8.8" ] + ["8.8.8.7", "8.8.8.8"] :param host_routes: A list of host route dictionaries for the subnet. For example:: [ - { - "destination": "0.0.0.0/0", - "nexthop": "123.456.78.9" - }, - { - "destination": "192.168.0.0/24", - "nexthop": "192.168.0.1" - } + {"destination": "0.0.0.0/0", "nexthop": "123.456.78.9"}, + {"destination": "192.168.0.0/24", "nexthop": "192.168.0.1"}, ] :param string ipv6_ra_mode: IPv6 Router Advertisement mode. Valid @@ -2536,30 +2449,19 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): :param allocation_pools: A list of dictionaries of the start and end addresses for the allocation pools. For example:: - [ - { - "start": "192.168.199.2", - "end": "192.168.199.254" - } - ] + [{"start": "192.168.199.2", "end": "192.168.199.254"}] :param dns_nameservers: A list of DNS name servers for the subnet. For example:: - [ "8.8.8.7", "8.8.8.8" ] + ["8.8.8.7", "8.8.8.8"] :param host_routes: A list of host route dictionaries for the subnet. For example:: [ - { - "destination": "0.0.0.0/0", - "nexthop": "123.456.78.9" - }, - { - "destination": "192.168.0.0/24", - "nexthop": "192.168.0.1" - } + {"destination": "0.0.0.0/0", "nexthop": "123.456.78.9"}, + {"destination": "192.168.0.0/24", "nexthop": "192.168.0.1"}, ] :returns: The updated network ``Subnet`` object. @@ -2636,8 +2538,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): [ { "ip_address": "10.29.29.13", - "subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd" - }, ... + "subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd", + }, + ..., ] :param subnet_id: If you specify only a subnet ID, OpenStack Networking @@ -2651,22 +2554,12 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): :param allowed_address_pairs: Allowed address pairs list (Optional) For example:: - [ - { - "ip_address": "23.23.23.1", - "mac_address": "fa:16:3e:c4:cd:3f" - }, ... - ] + [{"ip_address": "23.23.23.1", "mac_address": "fa:16:3e:c4:cd:3f"}, ...] :param extra_dhcp_opts: Extra DHCP options. (Optional). For example:: - [ - { - "opt_name": "opt name1", - "opt_value": "value1" - }, ... - ] + [{"opt_name": "opt name1", "opt_value": "value1"}, ...] :param device_owner: The ID of the entity that uses this port. For example, a DHCP agent. (Optional) @@ -2731,30 +2624,21 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin): [ { "ip_address": "10.29.29.13", - "subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd" - }, ... + "subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd", + }, + ..., ] :param security_groups: List of security group UUIDs. (Optional) :param allowed_address_pairs: Allowed address pairs list (Optional) For example:: - [ - { - "ip_address": "23.23.23.1", - "mac_address": "fa:16:3e:c4:cd:3f" - }, ... - ] + [{"ip_address": "23.23.23.1", "mac_address": "fa:16:3e:c4:cd:3f"}, ...] :param extra_dhcp_opts: Extra DHCP options. (Optional). For example:: - [ - { - "opt_name": "opt name1", - "opt_value": "value1" - }, ... - ] + [{"opt_name": "opt name1", "opt_value": "value1"}, ...] :param device_owner: The ID of the entity that uses this port. For example, a DHCP agent. (Optional) diff --git a/openstack/cloud/_network_common.py b/openstack/cloud/_network_common.py index 43fce7a22..43633d7cd 100644 --- a/openstack/cloud/_network_common.py +++ b/openstack/cloud/_network_common.py @@ -458,12 +458,7 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin): A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. @@ -1177,8 +1172,7 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin): self.network.update_ip(floating_ip_id, port_id=None) except exceptions.SDKException: raise exceptions.SDKException( - "Error detaching IP {ip} from " - "server {server_id}".format( + "Error detaching IP {ip} from server {server_id}".format( ip=floating_ip_id, server_id=server_id ) ) @@ -1647,8 +1641,9 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin): "floating_ip_address": "198.51.100.10", "network": "this-is-a-net-or-pool-id", "attached": True, - "status": "ACTIVE" - }, ... + "status": "ACTIVE", + }, + ..., ] """ @@ -1769,12 +1764,7 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin): A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR A string containing a jmespath expression for further filtering. diff --git a/openstack/cloud/_object_store.py b/openstack/cloud/_object_store.py index c16baa7b6..3d95d799e 100644 --- a/openstack/cloud/_object_store.py +++ b/openstack/cloud/_object_store.py @@ -26,7 +26,6 @@ OBJECT_CONTAINER_ACLS = { class ObjectStoreCloudMixin(openstackcloud._OpenStackCloudMixin): - # TODO(stephenfin): Remove 'full_listing' as it's a noop def list_containers(self, full_listing=True, prefix=None): """List containers. diff --git a/openstack/cloud/_orchestration.py b/openstack/cloud/_orchestration.py index 5be0c9918..ead46cc93 100644 --- a/openstack/cloud/_orchestration.py +++ b/openstack/cloud/_orchestration.py @@ -17,7 +17,6 @@ from openstack.orchestration.util import event_utils class OrchestrationCloudMixin(openstackcloud._OpenStackCloudMixin): - def get_template_contents( self, template_file=None, @@ -44,7 +43,7 @@ class OrchestrationCloudMixin(openstackcloud._OpenStackCloudMixin): wait=False, timeout=3600, environment_files=None, - **parameters + **parameters, ): """Create a stack. @@ -101,7 +100,7 @@ class OrchestrationCloudMixin(openstackcloud._OpenStackCloudMixin): wait=False, timeout=3600, environment_files=None, - **parameters + **parameters, ): """Update a stack. diff --git a/openstack/cloud/_shared_file_system.py b/openstack/cloud/_shared_file_system.py index 61affe547..7f552d46d 100644 --- a/openstack/cloud/_shared_file_system.py +++ b/openstack/cloud/_shared_file_system.py @@ -14,7 +14,6 @@ from openstack.cloud import openstackcloud class SharedFileSystemCloudMixin(openstackcloud._OpenStackCloudMixin): - def list_share_availability_zones(self): """List all availability zones for the Shared File Systems service. diff --git a/openstack/cloud/_utils.py b/openstack/cloud/_utils.py index 57830f771..a4f5ebc1f 100644 --- a/openstack/cloud/_utils.py +++ b/openstack/cloud/_utils.py @@ -47,12 +47,7 @@ def _filter_list(data, name_or_id, filters): :param filters: A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: - { - 'last_name': 'Smith', - 'other': { - 'gender': 'Female' - } - } + {'last_name': 'Smith', 'other': {'gender': 'Female'}} OR diff --git a/openstack/cloud/exc.py b/openstack/cloud/exc.py index 2c9e6be87..9c5ddfe66 100644 --- a/openstack/cloud/exc.py +++ b/openstack/cloud/exc.py @@ -33,7 +33,7 @@ class OpenStackCloudCreateException(OpenStackCloudException): resource=resource, resource_id=resource_id ), extra_data=extra_data, - **kwargs + **kwargs, ) self.resource_id = resource_id diff --git a/openstack/cloud/openstackcloud.py b/openstack/cloud/openstackcloud.py index 33ef47c17..a8c8e22c1 100644 --- a/openstack/cloud/openstackcloud.py +++ b/openstack/cloud/openstackcloud.py @@ -302,6 +302,7 @@ class _OpenStackCloudMixin(_services_mixin.ServicesMixin): .. code-block:: python from oslo_context import context + cloud = openstack.connect(cloud='example') # Work normally servers = cloud.list_servers() @@ -314,6 +315,7 @@ class _OpenStackCloudMixin(_services_mixin.ServicesMixin): .. code-block:: python from oslo_context import context + c = openstack.connect(cloud='example') # Work normally servers = c.list_servers() diff --git a/openstack/common/quota_set.py b/openstack/common/quota_set.py index 1c7a147af..a7bd86b5c 100644 --- a/openstack/common/quota_set.py +++ b/openstack/common/quota_set.py @@ -55,14 +55,14 @@ class QuotaSet(resource.Resource): requires_id=False, base_path=None, error_message=None, - **params + **params, ): return super().fetch( session, requires_id=False, base_path=base_path, error_message=error_message, - **params + **params, ) def _translate_response(self, response, has_body=None, error_message=None): diff --git a/openstack/compute/v2/limits.py b/openstack/compute/v2/limits.py index 8ff7838a6..86946bf3a 100644 --- a/openstack/compute/v2/limits.py +++ b/openstack/compute/v2/limits.py @@ -124,7 +124,7 @@ class Limits(resource.Resource): error_message=None, base_path=None, skip_cache=False, - **params + **params, ): """Get the Limits resource. @@ -142,5 +142,5 @@ class Limits(resource.Resource): error_message=error_message, base_path=base_path, skip_cache=skip_cache, - **params + **params, ) diff --git a/openstack/compute/v2/server_ip.py b/openstack/compute/v2/server_ip.py index df85e0687..8bac8d10b 100644 --- a/openstack/compute/v2/server_ip.py +++ b/openstack/compute/v2/server_ip.py @@ -39,7 +39,7 @@ class ServerIP(resource.Resource): server_id=None, network_label=None, base_path=None, - **params + **params, ): if base_path is None: base_path = cls.base_path diff --git a/openstack/config/__init__.py b/openstack/config/__init__.py index c7950dd0c..3e118b719 100644 --- a/openstack/config/__init__.py +++ b/openstack/config/__init__.py @@ -24,7 +24,7 @@ def get_cloud_region( app_version=None, load_yaml_config=True, load_envvars=True, - **kwargs + **kwargs, ): config = OpenStackConfig( load_yaml_config=load_yaml_config, diff --git a/openstack/config/cloud_region.py b/openstack/config/cloud_region.py index 83f7b4eb4..3b7cac69d 100644 --- a/openstack/config/cloud_region.py +++ b/openstack/config/cloud_region.py @@ -218,8 +218,9 @@ def from_conf(conf, session=None, service_types=None, **kwargs): ) ) _logger.warning( - "Disabling service '{service_type}': " - "{reason}".format(service_type=st, reason=reason) + "Disabling service '{service_type}': {reason}".format( + service_type=st, reason=reason + ) ) _disable_service(config_dict, st, reason=reason) continue diff --git a/openstack/connection.py b/openstack/connection.py index 0b202bf8a..a0eecac6e 100644 --- a/openstack/connection.py +++ b/openstack/connection.py @@ -87,7 +87,7 @@ settings from files or the environment. 'username': 'amazing-user', 'password': 'super-secret-password', 'project_id': '33aa1afc-03fe-43b8-8201-4e0d3b4b8ab5', - 'user_domain_id': '054abd68-9ad9-418b-96d3-3437bb376703' + 'user_domain_id': '054abd68-9ad9-418b-96d3-3437bb376703', }, compute_api_version='2', identity_interface='internal', diff --git a/openstack/identity/v3/project.py b/openstack/identity/v3/project.py index 7b08e3e53..677ce35d7 100644 --- a/openstack/identity/v3/project.py +++ b/openstack/identity/v3/project.py @@ -35,7 +35,7 @@ class Project(resource.Resource, tag.TagMixin): 'name', 'parent_id', is_enabled='enabled', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/image/v2/image.py b/openstack/image/v2/image.py index 3d1332c55..d84eaef01 100644 --- a/openstack/image/v2/image.py +++ b/openstack/image/v2/image.py @@ -349,9 +349,9 @@ class Image(resource.Resource, tag.TagMixin, _download.DownloadMixin): if remote_region and remote_image_id: if remote_service_interface: - data['method'][ - 'glance_service_interface' - ] = remote_service_interface + data['method']['glance_service_interface'] = ( + remote_service_interface + ) data['method']['glance_region'] = remote_region data['method']['glance_image_id'] = remote_image_id diff --git a/openstack/load_balancer/v2/_proxy.py b/openstack/load_balancer/v2/_proxy.py index 28cebdbb4..ff5947819 100644 --- a/openstack/load_balancer/v2/_proxy.py +++ b/openstack/load_balancer/v2/_proxy.py @@ -1188,7 +1188,7 @@ class Proxy(proxy.Proxy): return self._update( _availability_zone_profile.AvailabilityZoneProfile, availability_zone_profile, - **attrs + **attrs, ) def create_availability_zone(self, **attrs): diff --git a/openstack/load_balancer/v2/health_monitor.py b/openstack/load_balancer/v2/health_monitor.py index 6622c775f..9741b285b 100644 --- a/openstack/load_balancer/v2/health_monitor.py +++ b/openstack/load_balancer/v2/health_monitor.py @@ -42,7 +42,7 @@ class HealthMonitor(resource.Resource, tag.TagMixin): 'type', 'url_path', is_admin_state_up='admin_state_up', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) #: Properties diff --git a/openstack/load_balancer/v2/l7_policy.py b/openstack/load_balancer/v2/l7_policy.py index 35d2917dc..130ada839 100644 --- a/openstack/load_balancer/v2/l7_policy.py +++ b/openstack/load_balancer/v2/l7_policy.py @@ -38,7 +38,7 @@ class L7Policy(resource.Resource, tag.TagMixin): 'redirect_prefix', 'project_id', is_admin_state_up='admin_state_up', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) #: Properties diff --git a/openstack/load_balancer/v2/l7_rule.py b/openstack/load_balancer/v2/l7_rule.py index 188f878ef..458c8000e 100644 --- a/openstack/load_balancer/v2/l7_rule.py +++ b/openstack/load_balancer/v2/l7_rule.py @@ -38,7 +38,7 @@ class L7Rule(resource.Resource, tag.TagMixin): 'operating_status', is_admin_state_up='admin_state_up', l7_policy_id='l7policy_id', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) #: Properties diff --git a/openstack/load_balancer/v2/listener.py b/openstack/load_balancer/v2/listener.py index 0d29a1528..29e50f80e 100644 --- a/openstack/load_balancer/v2/listener.py +++ b/openstack/load_balancer/v2/listener.py @@ -53,7 +53,7 @@ class Listener(resource.Resource, tag.TagMixin): is_hsts_include_subdomains='hsts_include_subdomains', is_hsts_preload='hsts_preload', is_admin_state_up='admin_state_up', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/load_balancer/v2/load_balancer.py b/openstack/load_balancer/v2/load_balancer.py index 0fddea5fa..a23708f17 100644 --- a/openstack/load_balancer/v2/load_balancer.py +++ b/openstack/load_balancer/v2/load_balancer.py @@ -40,7 +40,7 @@ class LoadBalancer(resource.Resource, tag.TagMixin): 'operating_status', 'availability_zone', is_admin_state_up='admin_state_up', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/load_balancer/v2/member.py b/openstack/load_balancer/v2/member.py index 4e1d9423e..a17c93161 100644 --- a/openstack/load_balancer/v2/member.py +++ b/openstack/load_balancer/v2/member.py @@ -40,7 +40,7 @@ class Member(resource.Resource, tag.TagMixin): 'monitor_port', 'backup', is_admin_state_up='admin_state_up', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/load_balancer/v2/pool.py b/openstack/load_balancer/v2/pool.py index d736548f2..09becab86 100644 --- a/openstack/load_balancer/v2/pool.py +++ b/openstack/load_balancer/v2/pool.py @@ -45,7 +45,7 @@ class Pool(resource.Resource, tag.TagMixin): 'ca_tls_container_ref', 'crl_container_ref', is_admin_state_up='admin_state_up', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) #: Properties diff --git a/openstack/network/v2/_base.py b/openstack/network/v2/_base.py index f0ef10e46..9ca01747e 100644 --- a/openstack/network/v2/_base.py +++ b/openstack/network/v2/_base.py @@ -26,7 +26,7 @@ class NetworkResource(resource.Resource): base_path=None, params=None, if_revision=None, - **kwargs + **kwargs, ): req = super()._prepare_request( requires_id=requires_id, diff --git a/openstack/network/v2/floating_ip.py b/openstack/network/v2/floating_ip.py index e2a2c3df3..cb75e7a47 100644 --- a/openstack/network/v2/floating_ip.py +++ b/openstack/network/v2/floating_ip.py @@ -43,7 +43,7 @@ class FloatingIP(_base.NetworkResource, tag.TagMixin): 'sort_key', 'sort_dir', tenant_id='project_id', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/network.py b/openstack/network/v2/network.py index 8382e0e5f..a894668b0 100644 --- a/openstack/network/v2/network.py +++ b/openstack/network/v2/network.py @@ -43,7 +43,7 @@ class Network(_base.NetworkResource, tag.TagMixin): provider_network_type='provider:network_type', provider_physical_network='provider:physical_network', provider_segmentation_id='provider:segmentation_id', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/port.py b/openstack/network/v2/port.py index d85427576..aa01260a9 100644 --- a/openstack/network/v2/port.py +++ b/openstack/network/v2/port.py @@ -53,7 +53,7 @@ class Port(_base.NetworkResource, tag.TagMixin): is_admin_state_up='admin_state_up', is_port_security_enabled='port_security_enabled', security_group_ids='security_groups', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/qos_policy.py b/openstack/network/v2/qos_policy.py index 3442be891..5f75f1990 100644 --- a/openstack/network/v2/qos_policy.py +++ b/openstack/network/v2/qos_policy.py @@ -36,7 +36,7 @@ class QoSPolicy(resource.Resource, tag.TagMixin): 'sort_key', 'sort_dir', is_shared='shared', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/router.py b/openstack/network/v2/router.py index 1ea630541..41aba3018 100644 --- a/openstack/network/v2/router.py +++ b/openstack/network/v2/router.py @@ -40,7 +40,7 @@ class Router(_base.NetworkResource, tag.TagMixin): is_admin_state_up='admin_state_up', is_distributed='distributed', is_ha='ha', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/security_group.py b/openstack/network/v2/security_group.py index 1cc9aaabf..9e1797104 100644 --- a/openstack/network/v2/security_group.py +++ b/openstack/network/v2/security_group.py @@ -37,7 +37,7 @@ class SecurityGroup(_base.NetworkResource, tag.TagMixin): 'revision_number', 'sort_dir', 'sort_key', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/security_group_rule.py b/openstack/network/v2/security_group_rule.py index d4e7b0d6d..ef9504d14 100644 --- a/openstack/network/v2/security_group_rule.py +++ b/openstack/network/v2/security_group_rule.py @@ -43,7 +43,7 @@ class SecurityGroupRule(_base.NetworkResource, tag.TagMixin): 'sort_dir', 'sort_key', ether_type='ethertype', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/subnet.py b/openstack/network/v2/subnet.py index 21f2afab2..5acc22744 100644 --- a/openstack/network/v2/subnet.py +++ b/openstack/network/v2/subnet.py @@ -44,7 +44,7 @@ class Subnet(_base.NetworkResource, tag.TagMixin): is_dhcp_enabled='enable_dhcp', subnet_pool_id='subnetpool_id', use_default_subnet_pool='use_default_subnetpool', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/subnet_pool.py b/openstack/network/v2/subnet_pool.py index a517bcc61..5da9a4c94 100644 --- a/openstack/network/v2/subnet_pool.py +++ b/openstack/network/v2/subnet_pool.py @@ -37,7 +37,7 @@ class SubnetPool(resource.Resource, tag.TagMixin): 'sort_key', 'sort_dir', is_shared='shared', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/network/v2/trunk.py b/openstack/network/v2/trunk.py index 2ec34c681..c67e5686f 100644 --- a/openstack/network/v2/trunk.py +++ b/openstack/network/v2/trunk.py @@ -37,7 +37,7 @@ class Trunk(resource.Resource, tag.TagMixin): 'sub_ports', 'project_id', is_admin_state_up='admin_state_up', - **tag.TagMixin._tag_query_parameters + **tag.TagMixin._tag_query_parameters, ) # Properties diff --git a/openstack/orchestration/v1/_proxy.py b/openstack/orchestration/v1/_proxy.py index b4e6a4be6..bcc461e76 100644 --- a/openstack/orchestration/v1/_proxy.py +++ b/openstack/orchestration/v1/_proxy.py @@ -635,12 +635,12 @@ class Proxy(proxy.Proxy): stack_id=obj.id, resource_name=resource_name, base_path=base_path, - **attr + **attr, ) return self._list( _stack_event.StackEvent, stack_name=obj.name, stack_id=obj.id, - **attr + **attr, ) diff --git a/openstack/shared_file_system/v2/share_access_rule.py b/openstack/shared_file_system/v2/share_access_rule.py index 6edf54825..590de0c87 100644 --- a/openstack/shared_file_system/v2/share_access_rule.py +++ b/openstack/shared_file_system/v2/share_access_rule.py @@ -79,7 +79,7 @@ class ShareAccessRule(resource.Resource): session, resource_request_key='allow_access', resource_response_key='access', - **kwargs + **kwargs, ) def delete( diff --git a/openstack/tests/functional/cloud/test_devstack.py b/openstack/tests/functional/cloud/test_devstack.py index 7170adfe1..ddeeafdea 100644 --- a/openstack/tests/functional/cloud/test_devstack.py +++ b/openstack/tests/functional/cloud/test_devstack.py @@ -18,6 +18,7 @@ test_devstack Throw errors if we do not actually detect the services we're supposed to. """ + import os from testscenarios import load_tests_apply_scenarios as load_tests # noqa diff --git a/openstack/tests/functional/cloud/test_floating_ip_pool.py b/openstack/tests/functional/cloud/test_floating_ip_pool.py index 2d0161c70..3fe94f59c 100644 --- a/openstack/tests/functional/cloud/test_floating_ip_pool.py +++ b/openstack/tests/functional/cloud/test_floating_ip_pool.py @@ -32,7 +32,6 @@ from openstack.tests.functional import base class TestFloatingIPPool(base.BaseFunctionalTest): - def test_list_floating_ip_pools(self): pools = self.user_cloud.list_floating_ip_pools() if not pools: diff --git a/openstack/tests/functional/cloud/test_keypairs.py b/openstack/tests/functional/cloud/test_keypairs.py index 3fd920486..9a4635b7f 100644 --- a/openstack/tests/functional/cloud/test_keypairs.py +++ b/openstack/tests/functional/cloud/test_keypairs.py @@ -16,6 +16,7 @@ test_keypairs Functional tests for keypairs methods """ + from openstack.tests import fakes from openstack.tests.functional import base diff --git a/openstack/tests/functional/cloud/test_limits.py b/openstack/tests/functional/cloud/test_limits.py index 13838599c..5d6da9bf7 100644 --- a/openstack/tests/functional/cloud/test_limits.py +++ b/openstack/tests/functional/cloud/test_limits.py @@ -16,6 +16,7 @@ test_limits Functional tests for limits method """ + from openstack.compute.v2 import limits as _limits from openstack.tests.functional import base diff --git a/openstack/tests/functional/cloud/test_project.py b/openstack/tests/functional/cloud/test_project.py index d92abdb1d..7924c9096 100644 --- a/openstack/tests/functional/cloud/test_project.py +++ b/openstack/tests/functional/cloud/test_project.py @@ -18,6 +18,7 @@ test_project Functional tests for project resource. """ + import pprint from openstack import exceptions diff --git a/openstack/tests/functional/cloud/test_recordset.py b/openstack/tests/functional/cloud/test_recordset.py index 98f8d6564..fff2b1b60 100644 --- a/openstack/tests/functional/cloud/test_recordset.py +++ b/openstack/tests/functional/cloud/test_recordset.py @@ -16,6 +16,7 @@ test_recordset Functional tests for recordset methods. """ + import random import string diff --git a/openstack/tests/functional/cloud/test_volume_type.py b/openstack/tests/functional/cloud/test_volume_type.py index 52f4fe29d..bfdf011c5 100644 --- a/openstack/tests/functional/cloud/test_volume_type.py +++ b/openstack/tests/functional/cloud/test_volume_type.py @@ -16,6 +16,7 @@ test_volume Functional tests for block storage methods. """ + import testtools from openstack import exceptions diff --git a/openstack/tests/functional/image/v2/test_metadef_property.py b/openstack/tests/functional/image/v2/test_metadef_property.py index c58edf7a4..f490faab4 100644 --- a/openstack/tests/functional/image/v2/test_metadef_property.py +++ b/openstack/tests/functional/image/v2/test_metadef_property.py @@ -109,7 +109,7 @@ class TestMetadefProperty(base.BaseImageTest): metadef_property = self.conn.image.update_metadef_property( self.metadef_property, self.metadef_namespace.namespace, - **self.attrs + **self.attrs, ) self.assertIsNotNone(metadef_property) self.assertIsInstance( diff --git a/openstack/tests/functional/load_balancer/v2/test_load_balancer.py b/openstack/tests/functional/load_balancer/v2/test_load_balancer.py index f158e6008..c43ba6ff4 100644 --- a/openstack/tests/functional/load_balancer/v2/test_load_balancer.py +++ b/openstack/tests/functional/load_balancer/v2/test_load_balancer.py @@ -90,7 +90,7 @@ class TestLoadBalancer(base.BaseFunctionalTest): 'listener': 100, 'health_monitor': 100, 'member': 100, - } + }, ) assert isinstance(test_quota, quota.Quota) self.assertEqual(self.PROJECT_ID, test_quota.id) diff --git a/openstack/tests/functional/network/v2/test_floating_ip.py b/openstack/tests/functional/network/v2/test_floating_ip.py index 7e92688a2..3ea1ea9c4 100644 --- a/openstack/tests/functional/network/v2/test_floating_ip.py +++ b/openstack/tests/functional/network/v2/test_floating_ip.py @@ -75,7 +75,7 @@ class TestFloatingIP(base.BaseFunctionalTest): # Create Router sot = self.user_cloud.network.create_router( name=self.ROT_NAME, - **{"external_gateway_info": {"network_id": self.EXT_NET_ID}} + **{"external_gateway_info": {"network_id": self.EXT_NET_ID}}, ) assert isinstance(sot, router.Router) self.assertEqual(self.ROT_NAME, sot.name) diff --git a/openstack/tests/functional/network/v2/test_port_forwarding.py b/openstack/tests/functional/network/v2/test_port_forwarding.py index 034663e72..0d28a8efc 100644 --- a/openstack/tests/functional/network/v2/test_port_forwarding.py +++ b/openstack/tests/functional/network/v2/test_port_forwarding.py @@ -86,7 +86,7 @@ class TestPortForwarding(base.BaseFunctionalTest): # Create Router sot = self.user_cloud.network.create_router( name=self.ROT_NAME, - **{"external_gateway_info": {"network_id": self.EXT_NET_ID}} + **{"external_gateway_info": {"network_id": self.EXT_NET_ID}}, ) assert isinstance(sot, router.Router) self.assertEqual(self.ROT_NAME, sot.name) diff --git a/openstack/tests/functional/shared_file_system/test_quota_class_set.py b/openstack/tests/functional/shared_file_system/test_quota_class_set.py index cec5554ee..a9815e704 100644 --- a/openstack/tests/functional/shared_file_system/test_quota_class_set.py +++ b/openstack/tests/functional/shared_file_system/test_quota_class_set.py @@ -29,7 +29,7 @@ class QuotaClassSetTest(base.BaseSharedFileSystemTest): project_id, **{ "backups": initial_backups_value + 1, - } + }, ) ) self.assertEqual( diff --git a/openstack/tests/unit/block_storage/v3/test_type.py b/openstack/tests/unit/block_storage/v3/test_type.py index 7386a5fd6..19f10cd14 100644 --- a/openstack/tests/unit/block_storage/v3/test_type.py +++ b/openstack/tests/unit/block_storage/v3/test_type.py @@ -98,7 +98,7 @@ class TestType(base.TestCase): exceptions.BadRequestException, sot.set_extra_specs, sess, - **set_specs + **set_specs, ) def test_delete_extra_specs(self): diff --git a/openstack/tests/unit/cloud/test_baremetal_node.py b/openstack/tests/unit/cloud/test_baremetal_node.py index f81fdd3e0..616fbc332 100644 --- a/openstack/tests/unit/cloud/test_baremetal_node.py +++ b/openstack/tests/unit/cloud/test_baremetal_node.py @@ -1744,7 +1744,7 @@ class TestBaremetalNode(base.IronicTestCase): exceptions.SDKException, self.cloud.register_machine, nics, - **node_to_post + **node_to_post, ) self.assert_calls() @@ -1811,7 +1811,7 @@ class TestBaremetalNode(base.IronicTestCase): nics, timeout=0.001, lock_timeout=0.001, - **node_to_post + **node_to_post, ) self.assert_calls() @@ -1901,7 +1901,7 @@ class TestBaremetalNode(base.IronicTestCase): nics, wait=True, timeout=0.001, - **node_to_post + **node_to_post, ) self.assert_calls() @@ -1949,7 +1949,7 @@ class TestBaremetalNode(base.IronicTestCase): 'no ports for you', self.cloud.register_machine, nics, - **node_to_post + **node_to_post, ) self.assert_calls() @@ -2015,7 +2015,7 @@ class TestBaremetalNode(base.IronicTestCase): 'no ports for you', self.cloud.register_machine, nics, - **node_to_post + **node_to_post, ) self.assert_calls() diff --git a/openstack/tests/unit/cloud/test_delete_server.py b/openstack/tests/unit/cloud/test_delete_server.py index 3e62f71a0..3b987eecb 100644 --- a/openstack/tests/unit/cloud/test_delete_server.py +++ b/openstack/tests/unit/cloud/test_delete_server.py @@ -16,6 +16,7 @@ test_delete_server Tests for the `delete_server` command. """ + import uuid from openstack import exceptions diff --git a/openstack/tests/unit/cloud/test_fwaas.py b/openstack/tests/unit/cloud/test_fwaas.py index c80b0689f..935e08dbf 100644 --- a/openstack/tests/unit/cloud/test_fwaas.py +++ b/openstack/tests/unit/cloud/test_fwaas.py @@ -94,7 +94,7 @@ class TestFirewallRule(FirewallTestCase): self.assertRaises( exceptions.BadRequestException, self.cloud.create_firewall_rule, - **bad_rule + **bad_rule, ) self.assert_calls() @@ -146,7 +146,7 @@ class TestFirewallRule(FirewallTestCase): uri=self._make_mock_url( 'firewall_rules', name=self.firewall_rule_name, - **filters + **filters, ), json={'firewall_rules': [self.mock_firewall_rule]}, ), @@ -446,7 +446,7 @@ class TestFirewallPolicy(FirewallTestCase): self.assertRaises( exceptions.NotFoundException, self.cloud.create_firewall_policy, - **posted_policy + **posted_policy, ) self.cloud.network.create_firewall_policy.assert_not_called() self.assert_calls() diff --git a/openstack/tests/unit/config/test_config.py b/openstack/tests/unit/config/test_config.py index e6e9bcff8..fccee9e06 100644 --- a/openstack/tests/unit/config/test_config.py +++ b/openstack/tests/unit/config/test_config.py @@ -1030,7 +1030,7 @@ class TestConfigArgparse(base.TestCase): cc = c.get_one( region_name='region2', argparse=None, - **base.USER_CONF['clouds']['_test_cloud_regions'] + **base.USER_CONF['clouds']['_test_cloud_regions'], ) # Not using assert_cloud_details because of cache settings which # are not present without the file diff --git a/openstack/tests/unit/config/test_from_conf.py b/openstack/tests/unit/config/test_from_conf.py index 3f89b2832..a6e82c12a 100644 --- a/openstack/tests/unit/config/test_from_conf.py +++ b/openstack/tests/unit/config/test_from_conf.py @@ -30,7 +30,7 @@ class TestFromConf(base.TestCase): oslocfg, session=self.cloud.session, name='from_conf.example.com', - **from_conf_kwargs + **from_conf_kwargs, ) self.assertEqual('from_conf.example.com', config.name) diff --git a/openstack/tests/unit/object_store/v1/test_proxy.py b/openstack/tests/unit/object_store/v1/test_proxy.py index b30dde267..14f6535d5 100644 --- a/openstack/tests/unit/object_store/v1/test_proxy.py +++ b/openstack/tests/unit/object_store/v1/test_proxy.py @@ -657,7 +657,7 @@ class TestTempURLUnicodePathAndKey(TestTempURL): url = '/v1/\u00e4/c/\u00f3' key = 'k\u00e9y' expected_url = ( - '%s?temp_url_sig=temp_url_signature' '&temp_url_expires=1400003600' + '%s?temp_url_sig=temp_url_signature&temp_url_expires=1400003600' ) % url expected_body = '\n'.join( [ @@ -672,7 +672,7 @@ class TestTempURLUnicodePathBytesKey(TestTempURL): url = '/v1/\u00e4/c/\u00f3' key = 'k\u00e9y'.encode() expected_url = ( - '%s?temp_url_sig=temp_url_signature' '&temp_url_expires=1400003600' + '%s?temp_url_sig=temp_url_signature&temp_url_expires=1400003600' ) % url expected_body = '\n'.join( [ diff --git a/openstack/tests/unit/test_connection.py b/openstack/tests/unit/test_connection.py index 4177a63dd..d1ac99c7a 100644 --- a/openstack/tests/unit/test_connection.py +++ b/openstack/tests/unit/test_connection.py @@ -87,9 +87,7 @@ VENDOR_CONFIG = """ "vendor_hook": "openstack.tests.unit.test_connection:vendor_hook" }} }} -""".format( - auth_url=CONFIG_AUTH_URL -) +""".format(auth_url=CONFIG_AUTH_URL) PUBLIC_CLOUDS_YAML = """ public-clouds: @@ -97,9 +95,7 @@ public-clouds: auth: auth_url: {auth_url} vendor_hook: openstack.tests.unit.test_connection:vendor_hook -""".format( - auth_url=CONFIG_AUTH_URL -) +""".format(auth_url=CONFIG_AUTH_URL) class _TestConnectionBase(base.TestCase): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..3ab847ac0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[tool.ruff] +line-length = 79 + +[tool.ruff.format] +quote-style = "preserve" +docstring-code-format = true