Remove usage of six
With python3.x, classes can use 'metaclass=' instead of 'six.add_metaclass', 'six.integer_type' can be replaced by 'int', 'six.string_type' and 'six.text_type' are just 'str'. Change-Id: I40a020aa4a8e69a8dd7e800352dc54a9e694d500
This commit is contained in:
parent
f51744b4fe
commit
f8f9463cf7
@ -123,7 +123,7 @@ deprecated-modules=
|
||||
|
||||
[TYPECHECK]
|
||||
# List of module names for which member attributes should not be checked
|
||||
ignored-modules=six.moves,_MovedItems
|
||||
ignored-modules=
|
||||
|
||||
[REPORTS]
|
||||
# Tells whether to display a full report or only the messages
|
||||
|
@ -119,7 +119,6 @@ requestsexceptions==1.2.0
|
||||
rfc3986==0.3.1
|
||||
Routes==2.3.1
|
||||
simplejson==3.5.1
|
||||
six==1.10.0
|
||||
snowballstemmer==1.2.1
|
||||
Sphinx==1.6.5
|
||||
sphinxcontrib-svg2pdfconverter==0.1.0 # BSD
|
||||
|
@ -15,10 +15,5 @@
|
||||
|
||||
import gettext
|
||||
|
||||
import six
|
||||
|
||||
|
||||
if six.PY2:
|
||||
gettext.install('neutron', unicode=1)
|
||||
else:
|
||||
gettext.install('neutron')
|
||||
gettext.install('neutron')
|
||||
|
@ -24,7 +24,6 @@ from neutron_lib import exceptions as n_exc
|
||||
from neutron_lib.exceptions import agent as agent_exc
|
||||
from neutron_lib.plugins import directory
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob
|
||||
|
||||
from neutron_dynamic_routing._i18n import _, _LE
|
||||
@ -145,8 +144,7 @@ class Bgp_dragentscheduler(api_extensions.ExtensionDescriptor):
|
||||
return {}
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BgpDrSchedulerPluginBase(object):
|
||||
class BgpDrSchedulerPluginBase(object, metaclass=abc.ABCMeta):
|
||||
"""REST API to operate BGP dynamic routing agent scheduler.
|
||||
|
||||
All the methods must be executed in admin context.
|
||||
|
@ -15,11 +15,8 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BgpDriverBase(object):
|
||||
class BgpDriverBase(object, metaclass=abc.ABCMeta):
|
||||
"""Base class for BGP Speaking drivers.
|
||||
|
||||
Any class which provides BGP functionality should extend this
|
||||
|
@ -14,7 +14,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
import netaddr
|
||||
import six
|
||||
|
||||
from neutron_lib import constants as lib_consts
|
||||
|
||||
@ -24,7 +23,7 @@ from neutron_dynamic_routing.services.bgp.common import constants as bgp_consts
|
||||
|
||||
# Parameter validation functions provided are provided by the base.
|
||||
def validate_as_num(param, as_num):
|
||||
if not isinstance(as_num, six.integer_types):
|
||||
if not isinstance(as_num, int):
|
||||
raise bgp_driver_exc.InvalidParamType(param=param,
|
||||
param_type='integer')
|
||||
|
||||
@ -61,7 +60,7 @@ def validate_ip_addr(ip_addr):
|
||||
|
||||
def validate_string(param):
|
||||
if param is not None:
|
||||
if not isinstance(param, six.string_types):
|
||||
if not isinstance(param, str):
|
||||
raise bgp_driver_exc.InvalidParamType(param=param,
|
||||
param_type='string')
|
||||
|
||||
|
@ -20,7 +20,6 @@ from os_ken.services.protocols.bgp import bgpspeaker
|
||||
from os_ken.services.protocols.bgp.rtconf.neighbors import CONNECT_MODE_ACTIVE
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
|
||||
from neutron_dynamic_routing.services.bgp.agent import config as bgp_config
|
||||
from neutron_dynamic_routing.services.bgp.agent.driver import exceptions as bgp_driver_exc # noqa
|
||||
@ -112,7 +111,7 @@ class TestOsKenBgpDriver(base.BaseTestCase):
|
||||
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
|
||||
self.assertEqual(1,
|
||||
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
|
||||
NEW_FAKE_PEER_PASSWORD = six.text_type(FAKE_PEER_PASSWORD)
|
||||
NEW_FAKE_PEER_PASSWORD = str(FAKE_PEER_PASSWORD)
|
||||
self.os_ken_bgp_driver.add_bgp_peer(
|
||||
FAKE_LOCAL_AS1,
|
||||
FAKE_PEER_IP,
|
||||
|
@ -8,7 +8,6 @@ httplib2>=0.9.1 # MIT
|
||||
netaddr>=0.7.18 # BSD
|
||||
SQLAlchemy>=1.2.0 # MIT
|
||||
alembic>=0.8.10 # MIT
|
||||
six>=1.10.0 # MIT
|
||||
neutron-lib>=1.26.0 # Apache-2.0
|
||||
os-ken>=0.3.0 # Apache-2.0
|
||||
oslo.config>=5.2.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user