Drop six usages

Support of python 2.7 was dropped during the Ussuri cycle so we can now
drop six usages too.

Change-Id: I56a9c0641fd9bce613943ff938d33178d263eedf
This commit is contained in:
Hervé Beraud 2020-05-26 14:44:50 +02:00
parent 1348749dd5
commit d08727effa
6 changed files with 10 additions and 18 deletions

View File

@ -52,7 +52,6 @@ requestsexceptions==1.2.0
restructuredtext-lint==1.1.1
rfc3986==0.3.1
Routes==2.3.1
six==1.10.0
smmap==0.9.0
snowballstemmer==1.2.1
stestr==2.0.0

View File

@ -15,6 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import functools
import random
import sys
import time
@ -26,7 +27,6 @@ from oslo_utils import eventletutils
from oslo_utils import excutils
from oslo_utils import reflection
from oslo_utils import timeutils
import six
from oslo_service._i18n import _
@ -428,7 +428,7 @@ class RetryDecorator(object):
return self._sleep_time
raise LoopingCallDone(result)
@six.wraps(f)
@functools.wraps(f)
def func(*args, **kwargs):
loop = DynamicLoopingCall(_func, *args, **kwargs)
evt = loop.start(periodic_interval_max=self._max_sleep_time)

View File

@ -14,7 +14,6 @@
import copy
import logging
import random
import six
import time
from time import monotonic as now
@ -169,8 +168,7 @@ def _nearest_boundary(last_run, spacing):
return current_time - offset + jitter
@six.add_metaclass(_PeriodicTasksMeta)
class PeriodicTasks(object):
class PeriodicTasks(metaclass=_PeriodicTasksMeta):
def __init__(self, conf):
super(PeriodicTasks, self).__init__()
self.conf = conf

View File

@ -29,7 +29,6 @@ import logging
import os
import random
import signal
import six
import sys
import time
@ -90,8 +89,7 @@ def _check_service_base(service):
% {'service': service, 'base': ServiceBase})
@six.add_metaclass(abc.ABCMeta)
class ServiceBase(object):
class ServiceBase(metaclass=abc.ABCMeta):
"""Base class for all services."""
@abc.abstractmethod
@ -126,8 +124,7 @@ class Singleton(type):
return cls._instances[cls]
@six.add_metaclass(Singleton)
class SignalHandler(object):
class SignalHandler(metaclass=Singleton):
def __init__(self, *args, **kwargs):
super(SignalHandler, self).__init__(*args, **kwargs)
@ -829,7 +826,7 @@ def launch(conf, service, workers=1, restart_method='reload'):
:returns: instance of a launcher that was used to launch the service
"""
if workers is not None and not isinstance(workers, six.integer_types):
if workers is not None and not isinstance(workers, int):
raise TypeError(_("Type of workers should be int!"))
if workers is not None and workers <= 0:

View File

@ -18,7 +18,6 @@
import os
import platform
import six
import socket
import tempfile
import testtools
@ -279,7 +278,7 @@ class TestWSGIServerWithSSL(WsgiTestCase):
key_file=key_file_name,
group=sslutils.config_section)
@testtools.skipIf(six.PY3, "bug/1482633: test hangs on Python 3")
@testtools.skip("bug/1482633: test hangs on Python 3")
def test_ssl_server(self):
def test_app(env, start_response):
start_response('200 OK', {})
@ -298,7 +297,7 @@ class TestWSGIServerWithSSL(WsgiTestCase):
fake_ssl_server.stop()
fake_ssl_server.wait()
@testtools.skipIf(six.PY3, "bug/1482633: test hangs on Python 3")
@testtools.skip("bug/1482633: test hangs on Python 3")
def test_two_servers(self):
def test_app(env, start_response):
start_response('200 OK', {})
@ -332,7 +331,7 @@ class TestWSGIServerWithSSL(WsgiTestCase):
@testtools.skipIf(platform.mac_ver()[0] != '',
'SO_REUSEADDR behaves differently '
'on OSX, see bug 1436895')
@testtools.skipIf(six.PY3, "bug/1482633: test hangs on Python 3")
@testtools.skip("bug/1482633: test hangs on Python 3")
def test_socket_options_for_ssl_server(self):
# test normal socket options has set properly
self.config(tcp_keepidle=500)
@ -352,7 +351,7 @@ class TestWSGIServerWithSSL(WsgiTestCase):
server.wait()
@testtools.skipIf(not netutils.is_ipv6_enabled(), "no ipv6 support")
@testtools.skipIf(six.PY3, "bug/1482633: test hangs on Python 3")
@testtools.skip("bug/1482633: test hangs on Python 3")
@testtools.skip("using raw IPv6 addresses with SSL certs is broken")
def test_app_using_ipv6_and_ssl(self):
greetings = 'Hello, World!!!'

View File

@ -11,7 +11,6 @@ oslo.utils>=3.40.2 # Apache-2.0
oslo.concurrency>=3.25.0 # Apache-2.0
oslo.config>=5.1.0 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0
six>=1.10.0 # MIT
oslo.i18n>=3.15.3 # Apache-2.0
PasteDeploy>=1.5.0 # MIT
Routes>=2.3.1 # MIT