Merge "pyupgrade changes for Python3.8+ (7)"
This commit is contained in:
commit
b4e8727159
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
#
|
||||||
# Octavia documentation build configuration file, created by
|
# Octavia documentation build configuration file, created by
|
||||||
# sphinx-quickstart on Tue May 21 17:43:32 2013.
|
# sphinx-quickstart on Tue May 21 17:43:32 2013.
|
||||||
|
@ -37,10 +37,10 @@ _all_log_levels = {'critical', 'error', 'exception', 'info', 'warning'}
|
|||||||
_all_hints = {'_LC', '_LE', '_LI', '_', '_LW'}
|
_all_hints = {'_LC', '_LE', '_LI', '_', '_LW'}
|
||||||
|
|
||||||
_log_translation_hint = re.compile(
|
_log_translation_hint = re.compile(
|
||||||
r".*LOG\.(%(levels)s)\(\s*(%(hints)s)\(" % {
|
r".*LOG\.({levels})\(\s*({hints})\(".format(
|
||||||
'levels': '|'.join(_all_log_levels),
|
levels='|'.join(_all_log_levels),
|
||||||
'hints': '|'.join(_all_hints),
|
hints='|'.join(_all_hints),
|
||||||
})
|
))
|
||||||
|
|
||||||
assert_trueinst_re = re.compile(
|
assert_trueinst_re = re.compile(
|
||||||
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
|
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
|
||||||
|
@ -19,7 +19,7 @@ from octavia.image import image_base as driver_base
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class NoopManager(object):
|
class NoopManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.imageconfig = {}
|
self.imageconfig = {}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import abc
|
import abc
|
||||||
|
|
||||||
|
|
||||||
class ImageBase(object, metaclass=abc.ABCMeta):
|
class ImageBase(metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_image_id_by_tag(self, image_tag, image_owner=None):
|
def get_image_id_by_tag(self, image_tag, image_owner=None):
|
||||||
|
@ -86,7 +86,7 @@ class CreatePortException(NetworkException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AbstractNetworkDriver(object, metaclass=abc.ABCMeta):
|
class AbstractNetworkDriver(metaclass=abc.ABCMeta):
|
||||||
"""This class defines the methods for a fully functional network driver.
|
"""This class defines the methods for a fully functional network driver.
|
||||||
|
|
||||||
Implementations of this interface can expect a rollback to occur if any of
|
Implementations of this interface can expect a rollback to occur if any of
|
||||||
|
@ -475,7 +475,9 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
|||||||
:param load_balancer: octavia.common.data_models.LoadBalancer instance
|
:param load_balancer: octavia.common.data_models.LoadBalancer instance
|
||||||
:return: octavia.common.data_models.Vip,
|
:return: octavia.common.data_models.Vip,
|
||||||
list(octavia.common.data_models.AdditionalVip)
|
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:
|
if load_balancer.vip.port_id:
|
||||||
try:
|
try:
|
||||||
@ -500,7 +502,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
|||||||
self.delete_port(load_balancer.vip.port_id)
|
self.delete_port(load_balancer.vip.port_id)
|
||||||
else:
|
else:
|
||||||
raise base.AllocateVIPException(
|
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.'
|
'so will not be recreated. Aborting VIP allocation.'
|
||||||
.format(port.id, port.project_id))
|
.format(port.id, port.project_id))
|
||||||
except base.AllocateVIPException as e:
|
except base.AllocateVIPException as e:
|
||||||
@ -552,7 +554,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
|||||||
constants.NAME: 'octavia-lb-' + load_balancer.id,
|
constants.NAME: 'octavia-lb-' + load_balancer.id,
|
||||||
constants.NETWORK_ID: load_balancer.vip.network_id,
|
constants.NETWORK_ID: load_balancer.vip.network_id,
|
||||||
constants.ADMIN_STATE_UP: False,
|
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,
|
constants.DEVICE_OWNER: constants.OCTAVIA_OWNER,
|
||||||
project_id_key: load_balancer.project_id}
|
project_id_key: load_balancer.project_id}
|
||||||
|
|
||||||
@ -615,7 +617,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
|||||||
try:
|
try:
|
||||||
subnet = self.get_subnet(vip.subnet_id)
|
subnet = self.get_subnet(vip.subnet_id)
|
||||||
except base.SubnetNotFound as e:
|
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)
|
"found").format(vip.subnet_id)
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
raise base.PluggedVIPNotFound(msg) from e
|
raise base.PluggedVIPNotFound(msg) from e
|
||||||
|
@ -31,7 +31,7 @@ _NOOP_MANAGER_VARS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class NoopManager(object):
|
class NoopManager:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -48,7 +48,7 @@ def update_stats_via_driver(listener_stats, deltas=False):
|
|||||||
handlers.map_method('update_stats', listener_stats, deltas=deltas)
|
handlers.map_method('update_stats', listener_stats, deltas=deltas)
|
||||||
|
|
||||||
|
|
||||||
class StatsDriverMixin(object, metaclass=abc.ABCMeta):
|
class StatsDriverMixin(metaclass=abc.ABCMeta):
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def update_stats(self, listener_stats, deltas=False):
|
def update_stats(self, listener_stats, deltas=False):
|
||||||
"""Return a stats object formatted for a generic backend
|
"""Return a stats object formatted for a generic backend
|
||||||
|
@ -18,7 +18,7 @@ from octavia.volume import volume_base as driver_base
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class NoopManager(object):
|
class NoopManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.volumeconfig = {}
|
self.volumeconfig = {}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import abc
|
import abc
|
||||||
|
|
||||||
|
|
||||||
class VolumeBase(object, metaclass=abc.ABCMeta):
|
class VolumeBase(metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def create_volume_from_image(self, image_id):
|
def create_volume_from_image(self, image_id):
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
|
@ -44,7 +44,7 @@ def generate(flow_list, output_directory):
|
|||||||
base_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
base_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||||
os.path.pardir)
|
os.path.pardir)
|
||||||
diagram_list = []
|
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:
|
for row in flowlist:
|
||||||
if row.startswith('#'):
|
if row.startswith('#'):
|
||||||
continue
|
continue
|
||||||
|
@ -60,7 +60,7 @@ def _read_pem_blocks(data, *markers):
|
|||||||
else:
|
else:
|
||||||
certLines.append(certLine)
|
certLines.append(certLine)
|
||||||
if state == stDump:
|
if state == stDump:
|
||||||
yield ''.encode().join([
|
yield b''.join([
|
||||||
base64.b64decode(x) for x in certLines])
|
base64.b64decode(x) for x in certLines])
|
||||||
state = stSpam
|
state = stSpam
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user