Removing six library.

Since we already migrated fully to Python3, it's time to also remove
bits needed for Python2. One of those libs is six.

Change-Id: Ib984d7b4b3c1048ed091c78986c634689a8ace8c
This commit is contained in:
Roman Dobosz 2020-02-28 12:00:19 +01:00
parent 65f5235fab
commit ded6b6debc
27 changed files with 64 additions and 109 deletions

View File

@ -13,10 +13,10 @@
# limitations under the License. # limitations under the License.
import argparse import argparse
from http import client as httplib
import socket import socket
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from six.moves import http_client as httplib
from kuryr_kubernetes import constants from kuryr_kubernetes import constants

View File

@ -15,16 +15,14 @@
import abc import abc
import six from http import client as httplib
from six.moves import http_client as httplib
import traceback import traceback
import requests
from kuryr.lib._i18n import _ from kuryr.lib._i18n import _
from os_vif.objects import base from os_vif.objects import base
from oslo_log import log as logging from oslo_log import log as logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import requests
from kuryr_kubernetes import config from kuryr_kubernetes import config
from kuryr_kubernetes import constants as k_const from kuryr_kubernetes import constants as k_const
@ -33,8 +31,7 @@ from kuryr_kubernetes import exceptions as k_exc
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) class CNIRunner(object, metaclass=abc.ABCMeta):
class CNIRunner(object):
# TODO(ivc): extend SUPPORTED_VERSIONS and format output based on # TODO(ivc): extend SUPPORTED_VERSIONS and format output based on
# requested params.CNI_VERSION and/or params.config.cniVersion # requested params.CNI_VERSION and/or params.config.cniVersion
VERSION = '0.3.1' VERSION = '0.3.1'

View File

@ -15,7 +15,6 @@
import abc import abc
import errno import errno
import six
import os_vif import os_vif
from oslo_log import log as logging from oslo_log import log as logging
@ -30,8 +29,7 @@ _BINDING_NAMESPACE = 'kuryr_kubernetes.cni.binding'
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) class BaseBindingDriver(object, metaclass=abc.ABCMeta):
class BaseBindingDriver(object):
"""Interface to attach ports to pods.""" """Interface to attach ports to pods."""
def _remove_ifaces(self, ipdb, ifnames, netns='host'): def _remove_ifaces(self, ipdb, ifnames, netns='host'):

View File

@ -14,7 +14,6 @@
import abc import abc
import errno import errno
import six
from oslo_log import log as logging from oslo_log import log as logging
import pyroute2 import pyroute2
@ -32,8 +31,8 @@ MACVLAN_MODE_BRIDGE = 'bridge'
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) class NestedDriver(health.HealthHandler, b_base.BaseBindingDriver,
class NestedDriver(health.HealthHandler, b_base.BaseBindingDriver): metaclass=abc.ABCMeta):
def __init__(self): def __init__(self):
super(NestedDriver, self).__init__() super(NestedDriver, self).__init__()

View File

@ -13,9 +13,9 @@
# limitations under the License. # limitations under the License.
from ctypes import c_bool from ctypes import c_bool
from http import client as httplib
import multiprocessing import multiprocessing
import os import os
from six.moves import http_client as httplib
import socket import socket
import sys import sys
import threading import threading

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
import abc import abc
import six
from os_vif import objects as obj_vif from os_vif import objects as obj_vif
from oslo_log import log as logging from oslo_log import log as logging
@ -28,8 +27,7 @@ from kuryr_kubernetes import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) class CNIHandlerBase(k8s_base.ResourceEventHandler, metaclass=abc.ABCMeta):
class CNIHandlerBase(k8s_base.ResourceEventHandler):
OBJECT_KIND = k_const.K8S_OBJ_POD OBJECT_KIND = k_const.K8S_OBJ_POD
def __init__(self, cni, on_done): def __init__(self, cni, on_done):

View File

@ -10,8 +10,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from http import client as httplib
import os import os
from six.moves import http_client as httplib
from flask import Flask from flask import Flask
from pyroute2 import IPDB from pyroute2 import IPDB

View File

@ -15,7 +15,6 @@
import os import os
import signal import signal
import six
import sys import sys
import os_vif import os_vif
@ -35,10 +34,7 @@ _CNI_TIMEOUT = 180
def run(): def run():
if six.PY3: d = jsonutils.load(sys.stdin.buffer)
d = jsonutils.load(sys.stdin.buffer)
else:
d = jsonutils.load(sys.stdin)
cni_conf = utils.CNIConfig(d) cni_conf = utils.CNIConfig(d)
args = (['--config-file', cni_conf.kuryr_conf] if 'kuryr_conf' in d args = (['--config-file', cni_conf.kuryr_conf] if 'kuryr_conf' in d
else []) else [])

View File

@ -15,11 +15,9 @@
import abc import abc
import six
@six.add_metaclass(abc.ABCMeta) class CNIPlugin(object, metaclass=abc.ABCMeta):
class CNIPlugin(object):
@abc.abstractmethod @abc.abstractmethod
def add(self, params): def add(self, params):

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
import abc import abc
import six
from kuryr.lib._i18n import _ from kuryr.lib._i18n import _
from stevedore import driver as stv_driver from stevedore import driver as stv_driver
@ -38,8 +37,7 @@ class DriverBase(object):
Usage example: Usage example:
@six.add_metaclass(abc.ABCMeta) class SomeDriverInterface(DriverBase, metaclass=abc.ABCMeta):
class SomeDriverInterface(DriverBase):
ALIAS = 'driver_alias' ALIAS = 'driver_alias'
@abc.abstractmethod @abc.abstractmethod
@ -93,8 +91,7 @@ class DriverBase(object):
return self.__class__.__name__ return self.__class__.__name__
@six.add_metaclass(abc.ABCMeta) class PodProjectDriver(DriverBase, metaclass=abc.ABCMeta):
class PodProjectDriver(DriverBase):
"""Provides an OpenStack project ID for Kubernetes Pod ports.""" """Provides an OpenStack project ID for Kubernetes Pod ports."""
ALIAS = 'pod_project' ALIAS = 'pod_project'
@ -110,8 +107,7 @@ class PodProjectDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class ServiceProjectDriver(DriverBase, metaclass=abc.ABCMeta):
class ServiceProjectDriver(DriverBase):
"""Provides an OpenStack project ID for Kubernetes Services.""" """Provides an OpenStack project ID for Kubernetes Services."""
ALIAS = 'service_project' ALIAS = 'service_project'
@ -127,8 +123,7 @@ class ServiceProjectDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class NamespaceProjectDriver(DriverBase, metaclass=abc.ABCMeta):
class NamespaceProjectDriver(DriverBase):
"""Provides an OpenStack project ID for Kubernetes Namespace.""" """Provides an OpenStack project ID for Kubernetes Namespace."""
ALIAS = 'namespace_project' ALIAS = 'namespace_project'
@ -144,8 +139,7 @@ class NamespaceProjectDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class PodSubnetsDriver(DriverBase, metaclass=abc.ABCMeta):
class PodSubnetsDriver(DriverBase):
"""Provides subnets for Kubernetes Pods.""" """Provides subnets for Kubernetes Pods."""
ALIAS = 'pod_subnets' ALIAS = 'pod_subnets'
@ -202,8 +196,7 @@ class PodSubnetsDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class ServiceSubnetsDriver(DriverBase, metaclass=abc.ABCMeta):
class ServiceSubnetsDriver(DriverBase):
"""Provides subnets for Kubernetes Services.""" """Provides subnets for Kubernetes Services."""
ALIAS = 'service_subnets' ALIAS = 'service_subnets'
@ -222,8 +215,7 @@ class ServiceSubnetsDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class PodSecurityGroupsDriver(DriverBase, metaclass=abc.ABCMeta):
class PodSecurityGroupsDriver(DriverBase):
"""Provides security groups for Kubernetes Pods.""" """Provides security groups for Kubernetes Pods."""
ALIAS = 'pod_security_groups' ALIAS = 'pod_security_groups'
@ -287,8 +279,7 @@ class PodSecurityGroupsDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class ServiceSecurityGroupsDriver(DriverBase, metaclass=abc.ABCMeta):
class ServiceSecurityGroupsDriver(DriverBase):
"""Provides security groups for Kubernetes Services.""" """Provides security groups for Kubernetes Services."""
ALIAS = 'service_security_groups' ALIAS = 'service_security_groups'
@ -304,8 +295,7 @@ class ServiceSecurityGroupsDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class PodVIFDriver(DriverBase, metaclass=abc.ABCMeta):
class PodVIFDriver(DriverBase):
"""Manages Neutron ports to provide VIFs for Kubernetes Pods.""" """Manages Neutron ports to provide VIFs for Kubernetes Pods."""
ALIAS = 'pod_vif' ALIAS = 'pod_vif'
@ -433,8 +423,7 @@ class PodVIFDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class MultiVIFDriver(DriverBase, metaclass=abc.ABCMeta):
class MultiVIFDriver(DriverBase):
"""Manages additional ports of Kubernetes Pods.""" """Manages additional ports of Kubernetes Pods."""
ALIAS = 'multi_vif' ALIAS = 'multi_vif'
@ -626,8 +615,7 @@ class LBaaSDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class VIFPoolDriver(PodVIFDriver, metaclass=abc.ABCMeta):
class VIFPoolDriver(PodVIFDriver):
"""Manages Pool of Neutron ports to provide VIFs for Kubernetes Pods.""" """Manages Pool of Neutron ports to provide VIFs for Kubernetes Pods."""
ALIAS = 'vif_pool' ALIAS = 'vif_pool'
@ -657,8 +645,7 @@ class VIFPoolDriver(PodVIFDriver):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class ServicePubIpDriver(DriverBase, metaclass=abc.ABCMeta):
class ServicePubIpDriver(DriverBase):
"""Manages loadbalancerIP/public ip for neutron lbaas.""" """Manages loadbalancerIP/public ip for neutron lbaas."""
ALIAS = 'service_public_ip' ALIAS = 'service_public_ip'
@ -705,8 +692,7 @@ class ServicePubIpDriver(DriverBase):
""" """
@six.add_metaclass(abc.ABCMeta) class NetworkPolicyDriver(DriverBase, metaclass=abc.ABCMeta):
class NetworkPolicyDriver(DriverBase):
"""Provide network-policy for pods""" """Provide network-policy for pods"""
ALIAS = 'network_policy' ALIAS = 'network_policy'
@ -777,8 +763,7 @@ class NetworkPolicyDriver(DriverBase):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class NetworkPolicyProjectDriver(DriverBase, metaclass=abc.ABCMeta):
class NetworkPolicyProjectDriver(DriverBase):
"""Get an OpenStack project id for K8s network policies""" """Get an OpenStack project id for K8s network policies"""
ALIAS = 'network_policy_project' ALIAS = 'network_policy_project'

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
import abc import abc
import six
from kuryr.lib import exceptions as kl_exc from kuryr.lib import exceptions as kl_exc
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
@ -27,8 +26,8 @@ from kuryr_kubernetes.controller.drivers import neutron_vif
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) class NestedPodVIFDriver(neutron_vif.NeutronPodVIFDriver,
class NestedPodVIFDriver(neutron_vif.NeutronPodVIFDriver): metaclass=abc.ABCMeta):
"""Skeletal handler driver for VIFs for Nested Pods.""" """Skeletal handler driver for VIFs for Nested Pods."""
def _get_parent_port_by_host_ip(self, node_fixed_ip): def _get_parent_port_by_host_ip(self, node_fixed_ip):

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import abc import abc
import six
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from oslo_log import log as logging from oslo_log import log as logging
@ -24,8 +23,7 @@ from kuryr_kubernetes.controller.drivers import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta) class BasePubIpDriver(object, metaclass=abc.ABCMeta):
class BasePubIpDriver(object):
"""Base class for public IP functionality.""" """Base class for public IP functionality."""
@abc.abstractmethod @abc.abstractmethod

View File

@ -13,12 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import urllib
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from oslo_cache import core as cache from oslo_cache import core as cache
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log from oslo_log import log
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from six.moves.urllib import parse
from kuryr_kubernetes import clients from kuryr_kubernetes import clients
from kuryr_kubernetes import constants from kuryr_kubernetes import constants
@ -117,10 +118,10 @@ def get_pods(selector, namespace=None):
if exps: if exps:
exps = ', '.join(format_expression(exp) for exp in exps) exps = ', '.join(format_expression(exp) for exp in exps)
if labels: if labels:
expressions = parse.quote("," + exps) expressions = urllib.parse.quote("," + exps)
labels += expressions labels += expressions
else: else:
labels = parse.quote(exps) labels = urllib.parse.quote(exps)
if namespace: if namespace:
pods = kubernetes.get( pods = kubernetes.get(
@ -149,10 +150,10 @@ def get_namespaces(selector):
if exps: if exps:
exps = ', '.join(format_expression(exp) for exp in exps) exps = ', '.join(format_expression(exp) for exp in exps)
if labels: if labels:
expressions = parse.quote("," + exps) expressions = urllib.parse.quote("," + exps)
labels += expressions labels += expressions
else: else:
labels = parse.quote(exps) labels = urllib.parse.quote(exps)
namespaces = kubernetes.get( namespaces = kubernetes.get(
'{}/namespaces?labelSelector={}'.format( '{}/namespaces?labelSelector={}'.format(
@ -177,7 +178,7 @@ def format_expression(expression):
def replace_encoded_characters(labels): def replace_encoded_characters(labels):
labels = parse.urlencode(labels) labels = urllib.parse.urlencode(labels)
# NOTE(ltomasbo): K8s API does not accept &, so we need to AND # NOTE(ltomasbo): K8s API does not accept &, so we need to AND
# the matchLabels with ',' or '%2C' instead # the matchLabels with ',' or '%2C' instead
labels = labels.replace('&', ',') labels = labels.replace('&', ',')

View File

@ -17,7 +17,6 @@ import abc
import collections import collections
import eventlet import eventlet
import os import os
import six
import time import time
from kuryr.lib._i18n import _ from kuryr.lib._i18n import _
@ -130,8 +129,7 @@ class NoopVIFPool(base.VIFPoolDriver):
pass pass
@six.add_metaclass(abc.ABCMeta) class BaseVIFPool(base.VIFPoolDriver, metaclass=abc.ABCMeta):
class BaseVIFPool(base.VIFPoolDriver):
"""Skeletal pool driver. """Skeletal pool driver.
In order to handle the pools of ports, a few dicts are used: In order to handle the pools of ports, a few dicts are used:

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from http import client as httplib
import os import os
from six.moves import http_client as httplib
from flask import Flask from flask import Flask
from oslo_config import cfg from oslo_config import cfg

View File

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from http import server
import os import os
import socketserver
import threading import threading
from six.moves.BaseHTTPServer import BaseHTTPRequestHandler
from six.moves.socketserver import ThreadingUnixStreamServer
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from oslo_config import cfg as oslo_cfg from oslo_config import cfg as oslo_cfg
@ -41,11 +41,11 @@ pool_manager_opts = [
oslo_cfg.CONF.register_opts(pool_manager_opts, "pool_manager") oslo_cfg.CONF.register_opts(pool_manager_opts, "pool_manager")
class UnixDomainHttpServer(ThreadingUnixStreamServer): class UnixDomainHttpServer(socketserver.ThreadingUnixStreamServer):
pass pass
class RequestHandler(BaseHTTPRequestHandler): class RequestHandler(server.BaseHTTPRequestHandler):
protocol = "HTTP/1.0" protocol = "HTTP/1.0"
def do_POST(self): def do_POST(self):

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
import functools import functools
import six
import sys import sys
import os_vif import os_vif
@ -72,9 +71,8 @@ class KuryrK8sServiceMeta(type(service.Service),
pass pass
class KuryrK8sService(six.with_metaclass(KuryrK8sServiceMeta, class KuryrK8sService(service.Service, periodic_task.PeriodicTasks,
service.Service, metaclass=KuryrK8sServiceMeta):
periodic_task.PeriodicTasks)):
"""Kuryr-Kubernetes controller Service.""" """Kuryr-Kubernetes controller Service."""
def __init__(self): def __init__(self):

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
import itertools import itertools
from six.moves import queue as six_queue import queue as py_queue
import time import time
from oslo_log import log as logging from oslo_log import log as logging
@ -54,7 +54,7 @@ class Async(base.EventHandler):
try: try:
queue = self._queues[group] queue = self._queues[group]
except KeyError: except KeyError:
queue = six_queue.Queue(self._queue_depth) queue = py_queue.Queue(self._queue_depth)
self._queues[group] = queue self._queues[group] = queue
thread = self._thread_group.add_thread(self._run, group, queue) thread = self._thread_group.add_thread(self._run, group, queue)
thread.link(self._done, group) thread.link(self._done, group)
@ -68,7 +68,7 @@ class Async(base.EventHandler):
# avoid tests getting stuck in infinite loops) # avoid tests getting stuck in infinite loops)
try: try:
event = queue.get(timeout=self._grace_period) event = queue.get(timeout=self._grace_period)
except six_queue.Empty: except py_queue.Empty:
break break
# FIXME(ivc): temporary workaround to skip stale events # FIXME(ivc): temporary workaround to skip stale events
# If K8s updates resource while the handler is processing it, # If K8s updates resource while the handler is processing it,

View File

@ -14,11 +14,9 @@
# under the License. # under the License.
import abc import abc
import six
@six.add_metaclass(abc.ABCMeta) class EventHandler(object, metaclass=abc.ABCMeta):
class EventHandler(object):
"""Base class for event handlers.""" """Base class for event handlers."""
@abc.abstractmethod @abc.abstractmethod

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
import abc import abc
import six
from oslo_log import log as logging from oslo_log import log as logging
@ -71,8 +70,7 @@ class Dispatcher(h_base.EventHandler):
handler(event) handler(event)
@six.add_metaclass(abc.ABCMeta) class EventConsumer(h_base.EventHandler, metaclass=abc.ABCMeta):
class EventConsumer(h_base.EventHandler):
"""Consumes events matching specified predicates. """Consumes events matching specified predicates.
EventConsumer is an interface for all event handlers that are to be EventConsumer is an interface for all event handlers that are to be
@ -92,8 +90,7 @@ class EventConsumer(h_base.EventHandler):
raise NotImplementedError() raise NotImplementedError()
@six.add_metaclass(abc.ABCMeta) class EventPipeline(h_base.EventHandler, metaclass=abc.ABCMeta):
class EventPipeline(h_base.EventHandler):
"""Serves as an entry-point for event handling. """Serves as an entry-point for event handling.
Implementing subclasses should override `_wrap_dispatcher` and/or Implementing subclasses should override `_wrap_dispatcher` and/or

View File

@ -14,14 +14,13 @@
# under the License. # under the License.
import abc import abc
import six
from oslo_versionedobjects import base as obj_base from oslo_versionedobjects import base as obj_base
@six.add_metaclass(abc.ABCMeta)
class KuryrK8sObjectBase(obj_base.VersionedObject, class KuryrK8sObjectBase(obj_base.VersionedObject,
obj_base.ComparableVersionedObject): obj_base.ComparableVersionedObject,
metaclass=abc.ABCMeta):
OBJ_PROJECT_NAMESPACE = 'kuryr_kubernetes' OBJ_PROJECT_NAMESPACE = 'kuryr_kubernetes'

View File

@ -12,10 +12,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock import io
import mock
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six
from kuryr_kubernetes.cmd import status from kuryr_kubernetes.cmd import status
from kuryr_kubernetes import constants from kuryr_kubernetes import constants
@ -62,7 +62,7 @@ class TestStatusCmd(test_base.TestCase):
obj = self.cmd._get_annotation(pod) obj = self.cmd._get_annotation(pod)
self.assertEqual(mock_obj, obj) self.assertEqual(mock_obj, obj)
@mock.patch('sys.stdout', new_callable=six.StringIO) @mock.patch('sys.stdout', new_callable=io.StringIO)
def _test_upgrade_check(self, code, code_name, m_stdout): def _test_upgrade_check(self, code, code_name, m_stdout):
method_success_m = mock.Mock() method_success_m = mock.Mock()
method_success_m.return_value = status.UpgradeCheckResult(0, 'foo') method_success_m.return_value = status.UpgradeCheckResult(0, 'foo')

View File

@ -13,13 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from io import StringIO
import mock import mock
from six import StringIO
import requests
from oslo_config import cfg from oslo_config import cfg
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import requests
from kuryr_kubernetes.cni import api from kuryr_kubernetes.cni import api
from kuryr_kubernetes.tests import base as test_base from kuryr_kubernetes.tests import base as test_base

View File

@ -14,15 +14,14 @@
# under the License. # under the License.
import abc import abc
import mock import mock
import six
from kuryr_kubernetes.controller.drivers import base as d_base from kuryr_kubernetes.controller.drivers import base as d_base
from kuryr_kubernetes.tests import base as test_base from kuryr_kubernetes.tests import base as test_base
@six.add_metaclass(abc.ABCMeta) class _TestDriver(d_base.DriverBase, metaclass=abc.ABCMeta):
class _TestDriver(d_base.DriverBase):
ALIAS = 'test_alias' ALIAS = 'test_alias'
@abc.abstractmethod @abc.abstractmethod

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
import mock import mock
from six.moves import queue as six_queue import queue
from kuryr_kubernetes.handlers import asynchronous as h_async from kuryr_kubernetes.handlers import asynchronous as h_async
from kuryr_kubernetes.tests import base as test_base from kuryr_kubernetes.tests import base as test_base
@ -37,7 +37,7 @@ class TestAsyncHandler(test_base.TestCase):
self.assertEqual({group: m_queue}, async_handler._queues) self.assertEqual({group: m_queue}, async_handler._queues)
m_queue.put.assert_called_once_with(event) m_queue.put.assert_called_once_with(event)
@mock.patch('six.moves.queue.Queue') @mock.patch('queue.Queue')
def test_call_new(self, m_queue_type): def test_call_new(self, m_queue_type):
event = mock.sentinel.event event = mock.sentinel.event
group = mock.sentinel.group group = mock.sentinel.group
@ -85,7 +85,7 @@ class TestAsyncHandler(test_base.TestCase):
group = mock.sentinel.group group = mock.sentinel.group
m_queue = mock.Mock() m_queue = mock.Mock()
m_queue.empty.return_value = True m_queue.empty.return_value = True
m_queue.get.side_effect = events + [six_queue.Empty()] m_queue.get.side_effect = events + [queue.Empty()]
m_handler = mock.Mock() m_handler = mock.Mock()
m_count.return_value = list(range(5)) m_count.return_value = list(range(5))
async_handler = h_async.Async(m_handler, mock.Mock(), mock.Mock()) async_handler = h_async.Async(m_handler, mock.Mock(), mock.Mock())
@ -102,7 +102,7 @@ class TestAsyncHandler(test_base.TestCase):
group = mock.sentinel.group group = mock.sentinel.group
m_queue = mock.Mock() m_queue = mock.Mock()
m_queue.empty.side_effect = [False, True, True] m_queue.empty.side_effect = [False, True, True]
m_queue.get.side_effect = events + [six_queue.Empty()] m_queue.get.side_effect = events + [queue.Empty()]
m_handler = mock.Mock() m_handler = mock.Mock()
m_count.return_value = list(range(5)) m_count.return_value = list(range(5))
async_handler = h_async.Async(m_handler, mock.Mock(), mock.Mock()) async_handler = h_async.Async(m_handler, mock.Mock(), mock.Mock())

View File

@ -113,7 +113,6 @@ rfc3986==1.1.0
Routes==2.4.1 Routes==2.4.1
setproctitle==1.1.10 setproctitle==1.1.10
simplejson==3.13.2 simplejson==3.13.2
six==1.10.0
snowballstemmer==1.2.1 snowballstemmer==1.2.1
Sphinx==1.6.2 Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1 sphinxcontrib-websupport==1.0.1

View File

@ -21,7 +21,6 @@ os-vif>=1.12.0 # Apache-2.0
PrettyTable<0.8,>=0.7.2 # BSD PrettyTable<0.8,>=0.7.2 # BSD
pyroute2>=0.5.7;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2) pyroute2>=0.5.7;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)
retrying!=1.3.0,>=1.2.3 # Apache-2.0 retrying!=1.3.0,>=1.2.3 # Apache-2.0
six>=1.10.0 # MIT
stevedore>=1.20.0 # Apache-2.0 stevedore>=1.20.0 # Apache-2.0
grpcio>=1.12.0 # Apache-2.0 grpcio>=1.12.0 # Apache-2.0
protobuf>=3.6.0 # 3-Clause BSD protobuf>=3.6.0 # 3-Clause BSD