Remove usage of six

Remove six-library Replace the following items with Python 3 style code.
- six.six.add_metaclass
- six.PY2
- requirement.txt

Change-Id: Ib87394e41cdba7fc57e6ae6ed08ba1f84465441e
This commit is contained in:
zhangtongjian 2022-06-03 14:52:18 +08:00 committed by Lajos Katona
parent e4fbbaae08
commit b126f4224a
8 changed files with 11 additions and 32 deletions

View File

@ -15,10 +15,5 @@
import gettext import gettext
import six
gettext.install('neutron')
if six.PY2:
gettext.install('neutron', unicode=1)
else:
gettext.install('neutron')

View File

@ -22,7 +22,6 @@ from neutron_lib.api import extensions
from neutron_lib.exceptions import firewall_v2 as f_exc from neutron_lib.exceptions import firewall_v2 as f_exc
from neutron_lib.services import base as service_base from neutron_lib.services import base as service_base
from oslo_config import cfg from oslo_config import cfg
import six
from neutron_fwaas._i18n import _ from neutron_fwaas._i18n import _
from neutron_fwaas.common import fwaas_constants from neutron_fwaas.common import fwaas_constants
@ -221,8 +220,9 @@ class Firewall_v2(extensions.APIExtensionDescriptor):
return Firewallv2PluginBase return Firewallv2PluginBase
@six.add_metaclass(abc.ABCMeta) class Firewallv2PluginBase(
class Firewallv2PluginBase(service_base.ServicePluginBase): service_base.ServicePluginBase,
metaclass=abc.ABCMeta):
def get_plugin_type(self): def get_plugin_type(self):
return fwaas_constants.FIREWALL_V2 return fwaas_constants.FIREWALL_V2

View File

@ -15,7 +15,6 @@
import abc import abc
import six
from neutron_lib.utils import runtime from neutron_lib.utils import runtime
from oslo_config import cfg from oslo_config import cfg
@ -38,8 +37,7 @@ def load_and_init_conntrack_driver(*args, **kwargs):
return conntrack_driver return conntrack_driver
@six.add_metaclass(abc.ABCMeta) class ConntrackDriverBase(object, metaclass=abc.ABCMeta):
class ConntrackDriverBase(object):
"""Base Driver for Conntrack""" """Base Driver for Conntrack"""
@abc.abstractmethod @abc.abstractmethod

View File

@ -15,11 +15,8 @@
import abc import abc
import six
class FwaasDriverBase(object, metaclass=abc.ABCMeta):
@six.add_metaclass(abc.ABCMeta)
class FwaasDriverBase(object):
"""Firewall as a Service Driver base class. """Firewall as a Service Driver base class.
Using FwaasDriver Class, an instance of L3 perimeter Firewall Using FwaasDriver Class, an instance of L3 perimeter Firewall

View File

@ -15,11 +15,8 @@
import abc import abc
import six
class FwaasDriverBase(object, metaclass=abc.ABCMeta):
@six.add_metaclass(abc.ABCMeta)
class FwaasDriverBase(object):
"""Firewall as a Service Driver base class. """Firewall as a Service Driver base class.
Using FwaasDriver Class, an instance of L3 perimeter Firewall Using FwaasDriver Class, an instance of L3 perimeter Firewall

View File

@ -15,11 +15,8 @@
import abc import abc
import contextlib import contextlib
import six
class FirewallL2DriverBase(object, metaclass=abc.ABCMeta):
@six.add_metaclass(abc.ABCMeta)
class FirewallL2DriverBase(object):
"""Abstract firewall L2 driver base""" """Abstract firewall L2 driver base"""
def __init__(self, integration_bridge, sg_enabled=False): def __init__(self, integration_bridge, sg_enabled=False):

View File

@ -16,7 +16,6 @@
import abc import abc
import copy import copy
import six
from neutron_lib.callbacks import events from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry from neutron_lib.callbacks import registry
@ -31,8 +30,7 @@ from neutron_fwaas.db.firewall.v2 import firewall_db_v2
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) class FirewallDriver(object, metaclass=abc.ABCMeta):
class FirewallDriver(object):
"""Firewall v2 interface for driver """Firewall v2 interface for driver
That driver interface does not persist Firewall v2 data in any database. That driver interface does not persist Firewall v2 data in any database.
@ -124,8 +122,7 @@ class FirewallDriver(object):
pass pass
@six.add_metaclass(abc.ABCMeta) class FirewallDriverDBMixin(FirewallDriver, metaclass=abc.ABCMeta):
class FirewallDriverDBMixin(FirewallDriver):
"""FirewallDriverDB mixin to provision the database on behalf of the driver """FirewallDriverDB mixin to provision the database on behalf of the driver
That driver interface persists Firewall data in its database and forwards That driver interface persists Firewall data in its database and forwards
@ -519,8 +516,7 @@ class FirewallDriverDB(FirewallDriverDBMixin):
pass pass
@six.add_metaclass(abc.ABCMeta) class FirewallDriverRPCMixin(object, metaclass=abc.ABCMeta):
class FirewallDriverRPCMixin(object):
"""FirewallAgent interface for driver with rpc callback listener. """FirewallAgent interface for driver with rpc callback listener.
Each firewall backend driver that needs a rpc callback listener should Each firewall backend driver that needs a rpc callback listener should

View File

@ -11,7 +11,6 @@ eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
netaddr>=0.7.18 # BSD netaddr>=0.7.18 # BSD
SQLAlchemy>=1.4.23 # MIT SQLAlchemy>=1.4.23 # MIT
alembic>=1.6.5 # MIT alembic>=1.6.5 # MIT
six>=1.10.0 # MIT
neutron-lib>=1.26.0 # Apache-2.0 neutron-lib>=1.26.0 # Apache-2.0
os-ken >= 0.3.0 # Apache-2.0 os-ken >= 0.3.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0