Skip to content

Commit

Permalink
Bump black to 23.3.0
Browse files Browse the repository at this point in the history
I was using the distro-provided version of black, 22.8.0, during the
blackify series. There's a newer version out however, 23.3.0. Bump this,
applying the various changes it introduces in the process.

Change-Id: I3442a7ddaf0cb35f37b84bdbe06625a28e982dba
Signed-off-by: Stephen Finucane <[email protected]>
  • Loading branch information
stephenfin committed May 5, 2023
1 parent c946294 commit c7010a2
Show file tree
Hide file tree
Showing 166 changed files with 17 additions and 248 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
hooks:
- id: doc8
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 23.3.0
hooks:
- id: black
args: ['-S', '-l', '79']
Expand Down
1 change: 0 additions & 1 deletion examples/image/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def download_image_stream(conn):
# Read only 1024 bytes of memory at a time until
# all of the image data has been consumed.
for chunk in response.iter_content(chunk_size=1024):

# With each chunk, add it to the hash to be computed.
md5.update(chunk)

Expand Down
1 change: 0 additions & 1 deletion openstack/_services_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@


class ServicesMixin:

identity = identity_service.IdentityService(service_type='identity')

compute = compute_service.ComputeService(service_type='compute')
Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class Proxy(proxy.Proxy):

retriable_status_codes = _common.RETRIABLE_STATUS_CODES

_resource_registry = {
Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class Allocation(_common.ListMixin, resource.Resource):

resources_key = 'allocations'
base_path = '/allocations'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class Chassis(_common.ListMixin, resource.Resource):

resources_key = 'chassis'
base_path = '/chassis'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class Conductor(_common.ListMixin, resource.Resource):

resources_key = 'conductors'
base_path = '/conductors'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/deploy_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class DeployTemplate(_common.ListMixin, resource.Resource):

resources_key = 'deploy_templates'
base_path = '/deploy_templates'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class Driver(resource.Resource):

resources_key = 'drivers'
base_path = '/drivers'

Expand Down
2 changes: 0 additions & 2 deletions openstack/baremetal/v1/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class WaitResult(


class Node(_common.ListMixin, resource.Resource):

resources_key = 'nodes'
base_path = '/nodes'

Expand Down Expand Up @@ -1323,7 +1322,6 @@ def patch(
base_path=None,
reset_interfaces=None,
):

if reset_interfaces is not None:
# The id cannot be dirty for an commit
self._body._dirty.discard("id")
Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/port.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class Port(_common.ListMixin, resource.Resource):

resources_key = 'ports'
base_path = '/ports'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/port_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class PortGroup(_common.ListMixin, resource.Resource):

resources_key = 'portgroups'
base_path = '/portgroups'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/volume_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class VolumeConnector(_common.ListMixin, resource.Resource):

resources_key = 'connectors'
base_path = '/volume/connectors'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal/v1/volume_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class VolumeTarget(_common.ListMixin, resource.Resource):

resources_key = 'targets'
base_path = '/volume/targets'

Expand Down
1 change: 0 additions & 1 deletion openstack/baremetal_introspection/v1/introspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class Introspection(resource.Resource):

resources_key = 'introspection'
base_path = '/introspection'

Expand Down
1 change: 0 additions & 1 deletion openstack/block_storage/v2/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class Proxy(_base_proxy.BaseBlockStorageProxy):

# ====== SNAPSHOTS ======
def get_snapshot(self, snapshot):
"""Get a single snapshot
Expand Down
1 change: 0 additions & 1 deletion openstack/block_storage/v2/quota_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class QuotaSet(quota_set.QuotaSet):

#: Properties
#: The size (GB) of backups that are allowed for each project.
backup_gigabytes = resource.Body('backup_gigabytes', type=int)
Expand Down
1 change: 0 additions & 1 deletion openstack/block_storage/v3/quota_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class QuotaSet(quota_set.QuotaSet):

#: Properties
#: The size (GB) of backups that are allowed for each project.
backup_gigabytes = resource.Body('backup_gigabytes', type=int)
Expand Down
1 change: 0 additions & 1 deletion openstack/cloud/_block_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ def get_volume_limits(self, name_or_id=None):
project_id = None
error_msg = "Failed to get limits"
if name_or_id:

proj = self.get_project(name_or_id)
if not proj:
raise exc.OpenStackCloudException("project does not exist")
Expand Down
4 changes: 1 addition & 3 deletions openstack/cloud/_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ def get_compute_limits(self, name_or_id=None):
params = {}
project_id = None
if name_or_id:

proj = self.get_project(name_or_id)
if not proj:
raise exc.OpenStackCloudException("project does not exist")
Expand Down Expand Up @@ -874,7 +873,7 @@ def create_server(
user_data = kwargs.pop('userdata')
if user_data:
kwargs['user_data'] = self._encode_server_userdata(user_data)
for (desired, given) in (
for desired, given in (
('OS-DCF:diskConfig', 'disk_config'),
('config_drive', 'config_drive'),
('key_name', 'key_name'),
Expand Down Expand Up @@ -1092,7 +1091,6 @@ def _get_boot_from_volume_kwargs(
kwargs['block_device_mapping_v2'].append(block_mapping)
kwargs['imageRef'] = ''
elif boot_from_volume:

if isinstance(image, dict):
image_obj = image
else:
Expand Down
3 changes: 0 additions & 3 deletions openstack/cloud/_floating_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ def _neutron_create_floating_ip(
timeout=60,
network_id=None,
):

if not network_id:
if network_name_or_id:
try:
Expand Down Expand Up @@ -796,7 +795,6 @@ def _attach_ip_to_server(
def _neutron_attach_ip_to_server(
self, server, floating_ip, fixed_address=None, nat_destination=None
):

# Find an available port
(port, fixed_address) = self._nat_destination_port(
server,
Expand Down Expand Up @@ -884,7 +882,6 @@ def _neutron_detach_ip_from_server(self, server_id, floating_ip_id):
return True

def _nova_detach_ip_from_server(self, server_id, floating_ip_id):

f_ip = self.get_floating_ip(id=floating_ip_id)
if f_ip is None:
raise exc.OpenStackCloudException(
Expand Down
1 change: 0 additions & 1 deletion openstack/cloud/_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ def create_service(self, name, enabled=True, **kwargs):
'name', 'enabled', 'type', 'service_type', 'description'
)
def update_service(self, name_or_id, **kwargs):

# NOTE(SamYaple): Keystone v3 only accepts 'type' but shade accepts
# both 'type' and 'service_type' with a preference
# towards 'type'
Expand Down
1 change: 0 additions & 1 deletion openstack/cloud/_network_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def _set_interesting_networks(self):
return

for network in all_networks:

# External IPv4 networks
if (
network['name'] in self._external_ipv4_names
Expand Down
2 changes: 0 additions & 2 deletions openstack/cloud/_security_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ def _normalize_secgroups(self, groups):
# TODO(stephenfin): Remove this once we get rid of support for nova
# secgroups
def _normalize_secgroup(self, group):

ret = utils.Munch()
# Copy incoming group because of shared dicts in unittests
group = group.copy()
Expand Down Expand Up @@ -518,7 +517,6 @@ def _normalize_secgroup_rules(self, rules):
# TODO(stephenfin): Remove this once we get rid of support for nova
# secgroups
def _normalize_secgroup_rule(self, rule):

ret = utils.Munch()
# Copy incoming rule because of shared dicts in unittests
rule = rule.copy()
Expand Down
1 change: 0 additions & 1 deletion openstack/cloud/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class OpenStackInventory:

# Put this here so the capability can be detected with hasattr on the class
extra_config = None

Expand Down
2 changes: 1 addition & 1 deletion openstack/cloud/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def find_nova_interfaces(
addresses, ext_tag=None, key_name=None, version=4, mac_addr=None
):
ret = []
for (k, v) in iter(addresses.items()):
for k, v in iter(addresses.items()):
if key_name is not None and k != key_name:
# key_name is specified and it doesn't match the current network.
# Continue with the next one
Expand Down
1 change: 0 additions & 1 deletion openstack/cloud/openstackcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class _OpenStackCloudMixin:
_SHADE_OBJECT_AUTOCREATE_KEY = 'x-object-meta-x-shade-autocreated'

def __init__(self):

super(_OpenStackCloudMixin, self).__init__()

self.log = _log.setup_logging('openstack')
Expand Down
1 change: 0 additions & 1 deletion openstack/common/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class MetadataMixin:

#: *Type: list of tag strings*
metadata = resource.Body('metadata', type=dict)

Expand Down
1 change: 0 additions & 1 deletion openstack/common/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class TagMixin:

_tag_query_parameters = {
'tags': 'tags',
'any_tags': 'tags-any',
Expand Down
2 changes: 0 additions & 2 deletions openstack/compute/v2/limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class AbsoluteLimits(resource.Resource):

_max_microversion = '2.57'

#: The number of key-value pairs that can be set as image metadata.
Expand Down Expand Up @@ -74,7 +73,6 @@ class AbsoluteLimits(resource.Resource):


class RateLimit(resource.Resource):

# TODO(mordred) Make a resource type for the contents of limit and add
# it to list_type here.
#: A list of the specific limits that apply to the ``regex`` and ``uri``.
Expand Down
1 change: 0 additions & 1 deletion openstack/compute/v2/server_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class ServerActionEvent(resource.Resource):

# Added the 'details' field in 2.84
_max_microversion = '2.84'

Expand Down
1 change: 0 additions & 1 deletion openstack/compute/v2/server_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def list(
base_path=None,
**params
):

if base_path is None:
base_path = cls.base_path

Expand Down
2 changes: 1 addition & 1 deletion openstack/config/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def normalize_keys(config):
def merge_clouds(old_dict, new_dict):
"""Like dict.update, except handling nested dicts."""
ret = old_dict.copy()
for (k, v) in new_dict.items():
for k, v in new_dict.items():
if isinstance(v, dict):
if k in ret:
ret[k] = merge_clouds(ret[k], v)
Expand Down
Loading

0 comments on commit c7010a2

Please sign in to comment.