Drop use of six

Change-Id: I53005107bf4c05809182dc3865c5dc72c77b1054
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-05-05 13:00:00 -05:00
parent a9f4f3fe91
commit 37ceca6d0c
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
8 changed files with 18 additions and 29 deletions

View File

@ -38,7 +38,6 @@ PyYAML==3.12
requests==2.14.2 requests==2.14.2
requestsexceptions==1.2.0 requestsexceptions==1.2.0
rfc3986==0.3.1 rfc3986==0.3.1
six==1.10.0
smmap==0.9.0 smmap==0.9.0
statsd==3.2.1 statsd==3.2.1
stestr==2.0.0 stestr==2.0.0

View File

@ -15,18 +15,12 @@
"""Base class(es) for WSGI Middleware.""" """Base class(es) for WSGI Middleware."""
import six from inspect import getfullargspec
from oslo_config import cfg from oslo_config import cfg
import webob.dec import webob.dec
import webob.request import webob.request
import webob.response import webob.response
if six.PY2:
from inspect import getargspec as getfullargspec
else:
from inspect import getfullargspec
class NoContentTypeResponse(webob.response.Response): class NoContentTypeResponse(webob.response.Response):

View File

@ -18,7 +18,6 @@ import logging
import debtcollector import debtcollector
from oslo_config import cfg from oslo_config import cfg
from oslo_middleware import base from oslo_middleware import base
import six
import webob.exc import webob.exc
@ -209,7 +208,7 @@ class CORS(base.ConfigurableMiddleware):
# NOTE(dims): Support older code that still passes in # NOTE(dims): Support older code that still passes in
# a string for allowed_origin instead of a list # a string for allowed_origin instead of a list
if isinstance(allowed_origin, six.string_types): if isinstance(allowed_origin, str):
# TODO(krotscheck): https://review.opendev.org/#/c/312687/ # TODO(krotscheck): https://review.opendev.org/#/c/312687/
LOG.warning('DEPRECATED: The `allowed_origin` keyword argument in ' LOG.warning('DEPRECATED: The `allowed_origin` keyword argument in '
'`add_origin()` should be a list, found String.') '`add_origin()` should be a list, found String.')

View File

@ -15,6 +15,7 @@
import collections import collections
import gc import gc
import io
import json import json
import platform import platform
import socket import socket
@ -26,7 +27,6 @@ import jinja2
from oslo_utils import reflection from oslo_utils import reflection
from oslo_utils import strutils from oslo_utils import strutils
from oslo_utils import timeutils from oslo_utils import timeutils
import six
import stevedore import stevedore
import webob.dec import webob.dec
import webob.exc import webob.exc
@ -395,7 +395,7 @@ Reason
('text/html', self._make_html_response), ('text/html', self._make_html_response),
('application/json', self._make_json_response), ('application/json', self._make_json_response),
]) ])
self._accept_order = tuple(six.iterkeys(self._accept_to_functor)) self._accept_order = tuple(self._accept_to_functor)
# When no accept type matches instead of returning 406 we will # When no accept type matches instead of returning 406 we will
# always return text/plain (because sending an error from this # always return text/plain (because sending an error from this
# middleware actually can cause issues). # middleware actually can cause issues).
@ -437,8 +437,8 @@ Reason
except AttributeError: except AttributeError:
pass pass
else: else:
buf = six.StringIO() buf = io.StringIO()
for stack in six.itervalues(active_frames): for stack in active_frames.values():
traceback.print_stack(stack, file=buf) traceback.print_stack(stack, file=buf)
threadstacks.append(buf.getvalue()) threadstacks.append(buf.getvalue())
buf.seek(0) buf.seek(0)
@ -449,7 +449,7 @@ Reason
def _get_greenstacks(): def _get_greenstacks():
greenstacks = [] greenstacks = []
if greenlet is not None: if greenlet is not None:
buf = six.StringIO() buf = io.StringIO()
for gt in _find_objects(greenlet.greenlet): for gt in _find_objects(greenlet.greenlet):
traceback.print_stack(gt.gr_frame, file=buf) traceback.print_stack(gt.gr_frame, file=buf)
greenstacks.append(buf.getvalue()) greenstacks.append(buf.getvalue())

View File

@ -12,15 +12,15 @@
# under the License. # under the License.
import argparse import argparse
from http import server
import socketserver
from six.moves import SimpleHTTPServer # noqa
from six.moves import socketserver
import webob import webob
from oslo_middleware import healthcheck from oslo_middleware import healthcheck
class HttpHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): class HttpHandler(server.SimpleHTTPRequestHandler):
def do_GET(self): def do_GET(self):
@webob.dec.wsgify @webob.dec.wsgify
def dummy_application(req): def dummy_application(req):

View File

@ -15,8 +15,6 @@
import abc import abc
import six
class HealthcheckResult(object): class HealthcheckResult(object):
"""Result of a ``healthcheck`` method call should be this object.""" """Result of a ``healthcheck`` method call should be this object."""
@ -27,8 +25,7 @@ class HealthcheckResult(object):
self.details = details self.details = details
@six.add_metaclass(abc.ABCMeta) class HealthcheckBaseExtension(metaclass=abc.ABCMeta):
class HealthcheckBaseExtension(object):
def __init__(self, oslo_conf, conf): def __init__(self, oslo_conf, conf):
self.oslo_conf = oslo_conf self.oslo_conf = oslo_conf

View File

@ -12,9 +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 io
from oslo_config import fixture as config from oslo_config import fixture as config
from oslotest import base as test_base from oslotest import base as test_base
import six
import webob import webob
from oslo_middleware import sizelimit from oslo_middleware import sizelimit
@ -25,14 +26,14 @@ class TestLimitingReader(test_base.BaseTestCase):
def test_limiting_reader(self): def test_limiting_reader(self):
BYTES = 1024 BYTES = 1024
bytes_read = 0 bytes_read = 0
data = six.StringIO("*" * BYTES) data = io.StringIO("*" * BYTES)
for chunk in sizelimit.LimitingReader(data, BYTES): for chunk in sizelimit.LimitingReader(data, BYTES):
bytes_read += len(chunk) bytes_read += len(chunk)
self.assertEqual(BYTES, bytes_read) self.assertEqual(BYTES, bytes_read)
bytes_read = 0 bytes_read = 0
data = six.StringIO("*" * BYTES) data = io.StringIO("*" * BYTES)
reader = sizelimit.LimitingReader(data, BYTES) reader = sizelimit.LimitingReader(data, BYTES)
byte = reader.read(1) byte = reader.read(1)
while len(byte) != 0: while len(byte) != 0:
@ -44,7 +45,7 @@ class TestLimitingReader(test_base.BaseTestCase):
def test_read_default_value(self): def test_read_default_value(self):
BYTES = 1024 BYTES = 1024
data_str = "*" * BYTES data_str = "*" * BYTES
data = six.StringIO(data_str) data = io.StringIO(data_str)
reader = sizelimit.LimitingReader(data, BYTES) reader = sizelimit.LimitingReader(data, BYTES)
res = reader.read() res = reader.read()
self.assertEqual(data_str, res) self.assertEqual(data_str, res)
@ -54,7 +55,7 @@ class TestLimitingReader(test_base.BaseTestCase):
def _consume_all_iter(): def _consume_all_iter():
bytes_read = 0 bytes_read = 0
data = six.StringIO("*" * BYTES) data = io.StringIO("*" * BYTES)
for chunk in sizelimit.LimitingReader(data, BYTES - 1): for chunk in sizelimit.LimitingReader(data, BYTES - 1):
bytes_read += len(chunk) bytes_read += len(chunk)
@ -63,7 +64,7 @@ class TestLimitingReader(test_base.BaseTestCase):
def _consume_all_read(): def _consume_all_read():
bytes_read = 0 bytes_read = 0
data = six.StringIO("*" * BYTES) data = io.StringIO("*" * BYTES)
reader = sizelimit.LimitingReader(data, BYTES - 1) reader = sizelimit.LimitingReader(data, BYTES - 1)
byte = reader.read(1) byte = reader.read(1)
while len(byte) != 0: while len(byte) != 0:

View File

@ -8,7 +8,6 @@ oslo.config>=5.2.0 # Apache-2.0
oslo.context>=2.19.2 # Apache-2.0 oslo.context>=2.19.2 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0
six>=1.10.0 # MIT
stevedore>=1.20.0 # Apache-2.0 stevedore>=1.20.0 # Apache-2.0
WebOb>=1.8.0 # MIT WebOb>=1.8.0 # MIT
debtcollector>=1.2.0 # Apache-2.0 debtcollector>=1.2.0 # Apache-2.0