Merge "pyupgrade changes for Python3.8+ (7)"

This commit is contained in:
Zuul 2024-04-15 10:46:27 +00:00 committed by Gerrit Code Review
commit b4e8727159
13 changed files with 19 additions and 19 deletions

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Octavia documentation build configuration file, created by
# sphinx-quickstart on Tue May 21 17:43:32 2013.

View File

@ -37,10 +37,10 @@ _all_log_levels = {'critical', 'error', 'exception', 'info', 'warning'}
_all_hints = {'_LC', '_LE', '_LI', '_', '_LW'}
_log_translation_hint = re.compile(
r".*LOG\.(%(levels)s)\(\s*(%(hints)s)\(" % {
'levels': '|'.join(_all_log_levels),
'hints': '|'.join(_all_hints),
})
r".*LOG\.({levels})\(\s*({hints})\(".format(
levels='|'.join(_all_log_levels),
hints='|'.join(_all_hints),
))
assert_trueinst_re = re.compile(
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "

View File

@ -19,7 +19,7 @@ from octavia.image import image_base as driver_base
LOG = logging.getLogger(__name__)
class NoopManager(object):
class NoopManager:
def __init__(self):
super().__init__()
self.imageconfig = {}

View File

@ -15,7 +15,7 @@
import abc
class ImageBase(object, metaclass=abc.ABCMeta):
class ImageBase(metaclass=abc.ABCMeta):
@abc.abstractmethod
def get_image_id_by_tag(self, image_tag, image_owner=None):

View File

@ -86,7 +86,7 @@ class CreatePortException(NetworkException):
pass
class AbstractNetworkDriver(object, metaclass=abc.ABCMeta):
class AbstractNetworkDriver(metaclass=abc.ABCMeta):
"""This class defines the methods for a fully functional network driver.
Implementations of this interface can expect a rollback to occur if any of

View File

@ -475,7 +475,9 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
:param load_balancer: octavia.common.data_models.LoadBalancer instance
:return: octavia.common.data_models.Vip,
list(octavia.common.data_models.AdditionalVip)
:raises: AllocateVIPException, PortNotFound, SubnetNotFound
:raises AllocateVIPException: generic error allocating the VIP
:raises PortNotFound: port was not found
:raises SubnetNotFound: subnet was not found
"""
if load_balancer.vip.port_id:
try:
@ -500,7 +502,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
self.delete_port(load_balancer.vip.port_id)
else:
raise base.AllocateVIPException(
'VIP port {0} is broken, but is owned by project {1} '
'VIP port {} is broken, but is owned by project {} '
'so will not be recreated. Aborting VIP allocation.'
.format(port.id, port.project_id))
except base.AllocateVIPException as e:
@ -552,7 +554,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
constants.NAME: 'octavia-lb-' + load_balancer.id,
constants.NETWORK_ID: load_balancer.vip.network_id,
constants.ADMIN_STATE_UP: False,
'device_id': 'lb-{0}'.format(load_balancer.id),
'device_id': f'lb-{load_balancer.id}',
constants.DEVICE_OWNER: constants.OCTAVIA_OWNER,
project_id_key: load_balancer.project_id}
@ -615,7 +617,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
try:
subnet = self.get_subnet(vip.subnet_id)
except base.SubnetNotFound as e:
msg = ("Can't unplug vip because vip subnet {0} was not "
msg = ("Can't unplug vip because vip subnet {} was not "
"found").format(vip.subnet_id)
LOG.exception(msg)
raise base.PluggedVIPNotFound(msg) from e

View File

@ -31,7 +31,7 @@ _NOOP_MANAGER_VARS = {
}
class NoopManager(object):
class NoopManager:
def __init__(self):
super().__init__()

View File

@ -48,7 +48,7 @@ def update_stats_via_driver(listener_stats, deltas=False):
handlers.map_method('update_stats', listener_stats, deltas=deltas)
class StatsDriverMixin(object, metaclass=abc.ABCMeta):
class StatsDriverMixin(metaclass=abc.ABCMeta):
@abc.abstractmethod
def update_stats(self, listener_stats, deltas=False):
"""Return a stats object formatted for a generic backend

View File

@ -18,7 +18,7 @@ from octavia.volume import volume_base as driver_base
LOG = logging.getLogger(__name__)
class NoopManager(object):
class NoopManager:
def __init__(self):
super().__init__()
self.volumeconfig = {}

View File

@ -15,7 +15,7 @@
import abc
class VolumeBase(object, metaclass=abc.ABCMeta):
class VolumeBase(metaclass=abc.ABCMeta):
@abc.abstractmethod
def create_volume_from_image(self, image_id):

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -44,7 +44,7 @@ def generate(flow_list, output_directory):
base_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
os.path.pardir)
diagram_list = []
with open(os.path.join(base_path, flow_list), 'r') as flowlist:
with open(os.path.join(base_path, flow_list)) as flowlist:
for row in flowlist:
if row.startswith('#'):
continue

View File

@ -60,7 +60,7 @@ def _read_pem_blocks(data, *markers):
else:
certLines.append(certLine)
if state == stDump:
yield ''.encode().join([
yield b''.join([
base64.b64decode(x) for x in certLines])
state = stSpam