diff --git a/doc/source/conf.py b/doc/source/conf.py index 594c01ce6a..b7a16fbc70 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Octavia documentation build configuration file, created by # sphinx-quickstart on Tue May 21 17:43:32 2013. diff --git a/octavia/hacking/checks.py b/octavia/hacking/checks.py index 70089940b2..eb0abc2558 100644 --- a/octavia/hacking/checks.py +++ b/octavia/hacking/checks.py @@ -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|\.|\'|\"|\[|\])+, " diff --git a/octavia/image/drivers/noop_driver/driver.py b/octavia/image/drivers/noop_driver/driver.py index 10acf186ce..84ba69a6eb 100644 --- a/octavia/image/drivers/noop_driver/driver.py +++ b/octavia/image/drivers/noop_driver/driver.py @@ -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 = {} diff --git a/octavia/image/image_base.py b/octavia/image/image_base.py index 3bb0af0d1c..eca84632ef 100644 --- a/octavia/image/image_base.py +++ b/octavia/image/image_base.py @@ -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): diff --git a/octavia/network/base.py b/octavia/network/base.py index 1480b55818..0a23434d40 100644 --- a/octavia/network/base.py +++ b/octavia/network/base.py @@ -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 diff --git a/octavia/network/drivers/neutron/allowed_address_pairs.py b/octavia/network/drivers/neutron/allowed_address_pairs.py index 61334da91a..267e60b8c0 100644 --- a/octavia/network/drivers/neutron/allowed_address_pairs.py +++ b/octavia/network/drivers/neutron/allowed_address_pairs.py @@ -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 diff --git a/octavia/network/drivers/noop_driver/driver.py b/octavia/network/drivers/noop_driver/driver.py index be3b4e7ebd..96c174b12e 100644 --- a/octavia/network/drivers/noop_driver/driver.py +++ b/octavia/network/drivers/noop_driver/driver.py @@ -31,7 +31,7 @@ _NOOP_MANAGER_VARS = { } -class NoopManager(object): +class NoopManager: def __init__(self): super().__init__() diff --git a/octavia/statistics/stats_base.py b/octavia/statistics/stats_base.py index e11faf67a7..5a8db5697f 100644 --- a/octavia/statistics/stats_base.py +++ b/octavia/statistics/stats_base.py @@ -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 diff --git a/octavia/volume/drivers/noop_driver/driver.py b/octavia/volume/drivers/noop_driver/driver.py index c046c0009f..65b2821064 100644 --- a/octavia/volume/drivers/noop_driver/driver.py +++ b/octavia/volume/drivers/noop_driver/driver.py @@ -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 = {} diff --git a/octavia/volume/volume_base.py b/octavia/volume/volume_base.py index c2f43aba2e..d71e8d01d6 100644 --- a/octavia/volume/volume_base.py +++ b/octavia/volume/volume_base.py @@ -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): diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index f11d92b513..c88b39272a 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -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 diff --git a/tools/create_flow_docs.py b/tools/create_flow_docs.py index aad6f28985..9fcccade27 100755 --- a/tools/create_flow_docs.py +++ b/tools/create_flow_docs.py @@ -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 diff --git a/tools/pkcs7_to_pem.py b/tools/pkcs7_to_pem.py index 19e3d42251..df0515811b 100755 --- a/tools/pkcs7_to_pem.py +++ b/tools/pkcs7_to_pem.py @@ -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