Merge "Drop use of six"
This commit is contained in:
commit
5f179a1868
@ -37,7 +37,6 @@ PyYAML==3.12
|
||||
requests==2.14.2
|
||||
requestsexceptions==1.2.0
|
||||
rfc3986==0.3.1
|
||||
six==1.10.0
|
||||
smmap==0.9.0
|
||||
statsd==3.2.1
|
||||
stestr==2.0.0
|
||||
|
@ -15,18 +15,12 @@
|
||||
|
||||
"""Base class(es) for WSGI Middleware."""
|
||||
|
||||
import six
|
||||
|
||||
from inspect import getfullargspec
|
||||
from oslo_config import cfg
|
||||
import webob.dec
|
||||
import webob.request
|
||||
import webob.response
|
||||
|
||||
if six.PY2:
|
||||
from inspect import getargspec as getfullargspec
|
||||
else:
|
||||
from inspect import getfullargspec
|
||||
|
||||
|
||||
class NoContentTypeResponse(webob.response.Response):
|
||||
|
||||
|
@ -18,7 +18,6 @@ import logging
|
||||
import debtcollector
|
||||
from oslo_config import cfg
|
||||
from oslo_middleware import base
|
||||
import six
|
||||
import webob.exc
|
||||
|
||||
|
||||
@ -209,7 +208,7 @@ class CORS(base.ConfigurableMiddleware):
|
||||
|
||||
# NOTE(dims): Support older code that still passes in
|
||||
# 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/
|
||||
LOG.warning('DEPRECATED: The `allowed_origin` keyword argument in '
|
||||
'`add_origin()` should be a list, found String.')
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import collections
|
||||
import gc
|
||||
import io
|
||||
import json
|
||||
import platform
|
||||
import socket
|
||||
@ -26,7 +27,6 @@ import jinja2
|
||||
from oslo_utils import reflection
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
import stevedore
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
@ -395,7 +395,7 @@ Reason
|
||||
('text/html', self._make_html_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
|
||||
# always return text/plain (because sending an error from this
|
||||
# middleware actually can cause issues).
|
||||
@ -437,8 +437,8 @@ Reason
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
buf = six.StringIO()
|
||||
for stack in six.itervalues(active_frames):
|
||||
buf = io.StringIO()
|
||||
for stack in active_frames.values():
|
||||
traceback.print_stack(stack, file=buf)
|
||||
threadstacks.append(buf.getvalue())
|
||||
buf.seek(0)
|
||||
@ -449,7 +449,7 @@ Reason
|
||||
def _get_greenstacks():
|
||||
greenstacks = []
|
||||
if greenlet is not None:
|
||||
buf = six.StringIO()
|
||||
buf = io.StringIO()
|
||||
for gt in _find_objects(greenlet.greenlet):
|
||||
traceback.print_stack(gt.gr_frame, file=buf)
|
||||
greenstacks.append(buf.getvalue())
|
||||
|
@ -12,15 +12,15 @@
|
||||
# under the License.
|
||||
|
||||
import argparse
|
||||
from http import server
|
||||
import socketserver
|
||||
|
||||
from six.moves import SimpleHTTPServer # noqa
|
||||
from six.moves import socketserver
|
||||
import webob
|
||||
|
||||
from oslo_middleware import healthcheck
|
||||
|
||||
|
||||
class HttpHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
class HttpHandler(server.SimpleHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
@webob.dec.wsgify
|
||||
def dummy_application(req):
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class HealthcheckResult(object):
|
||||
"""Result of a ``healthcheck`` method call should be this object."""
|
||||
@ -27,8 +25,7 @@ class HealthcheckResult(object):
|
||||
self.details = details
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class HealthcheckBaseExtension(object):
|
||||
class HealthcheckBaseExtension(metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, oslo_conf, conf):
|
||||
self.oslo_conf = oslo_conf
|
||||
|
@ -12,9 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import io
|
||||
|
||||
from oslo_config import fixture as config
|
||||
from oslotest import base as test_base
|
||||
import six
|
||||
import webob
|
||||
|
||||
from oslo_middleware import sizelimit
|
||||
@ -25,14 +26,14 @@ class TestLimitingReader(test_base.BaseTestCase):
|
||||
def test_limiting_reader(self):
|
||||
BYTES = 1024
|
||||
bytes_read = 0
|
||||
data = six.StringIO("*" * BYTES)
|
||||
data = io.StringIO("*" * BYTES)
|
||||
for chunk in sizelimit.LimitingReader(data, BYTES):
|
||||
bytes_read += len(chunk)
|
||||
|
||||
self.assertEqual(BYTES, bytes_read)
|
||||
|
||||
bytes_read = 0
|
||||
data = six.StringIO("*" * BYTES)
|
||||
data = io.StringIO("*" * BYTES)
|
||||
reader = sizelimit.LimitingReader(data, BYTES)
|
||||
byte = reader.read(1)
|
||||
while len(byte) != 0:
|
||||
@ -44,7 +45,7 @@ class TestLimitingReader(test_base.BaseTestCase):
|
||||
def test_read_default_value(self):
|
||||
BYTES = 1024
|
||||
data_str = "*" * BYTES
|
||||
data = six.StringIO(data_str)
|
||||
data = io.StringIO(data_str)
|
||||
reader = sizelimit.LimitingReader(data, BYTES)
|
||||
res = reader.read()
|
||||
self.assertEqual(data_str, res)
|
||||
@ -54,7 +55,7 @@ class TestLimitingReader(test_base.BaseTestCase):
|
||||
|
||||
def _consume_all_iter():
|
||||
bytes_read = 0
|
||||
data = six.StringIO("*" * BYTES)
|
||||
data = io.StringIO("*" * BYTES)
|
||||
for chunk in sizelimit.LimitingReader(data, BYTES - 1):
|
||||
bytes_read += len(chunk)
|
||||
|
||||
@ -63,7 +64,7 @@ class TestLimitingReader(test_base.BaseTestCase):
|
||||
|
||||
def _consume_all_read():
|
||||
bytes_read = 0
|
||||
data = six.StringIO("*" * BYTES)
|
||||
data = io.StringIO("*" * BYTES)
|
||||
reader = sizelimit.LimitingReader(data, BYTES - 1)
|
||||
byte = reader.read(1)
|
||||
while len(byte) != 0:
|
||||
|
@ -8,7 +8,6 @@ oslo.config>=5.2.0 # Apache-2.0
|
||||
oslo.context>=2.19.2 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
six>=1.10.0 # MIT
|
||||
stevedore>=1.20.0 # Apache-2.0
|
||||
WebOb>=1.8.0 # MIT
|
||||
debtcollector>=1.2.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user