diff options
Diffstat (limited to 'oslo_middleware')
-rw-r--r-- | oslo_middleware/base.py | 8 | ||||
-rw-r--r-- | oslo_middleware/cors.py | 3 | ||||
-rw-r--r-- | oslo_middleware/healthcheck/__init__.py | 10 | ||||
-rw-r--r-- | oslo_middleware/healthcheck/__main__.py | 6 | ||||
-rw-r--r-- | oslo_middleware/healthcheck/pluginbase.py | 5 | ||||
-rw-r--r-- | oslo_middleware/tests/test_sizelimit.py | 13 |
6 files changed, 18 insertions, 27 deletions
diff --git a/oslo_middleware/base.py b/oslo_middleware/base.py index 29d32e1..f494675 100644 --- a/oslo_middleware/base.py +++ b/oslo_middleware/base.py @@ -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): diff --git a/oslo_middleware/cors.py b/oslo_middleware/cors.py index 1fac58a..69fe3d6 100644 --- a/oslo_middleware/cors.py +++ b/oslo_middleware/cors.py @@ -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.') diff --git a/oslo_middleware/healthcheck/__init__.py b/oslo_middleware/healthcheck/__init__.py index bd81f0b..66c713e 100644 --- a/oslo_middleware/healthcheck/__init__.py +++ b/oslo_middleware/healthcheck/__init__.py @@ -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()) diff --git a/oslo_middleware/healthcheck/__main__.py b/oslo_middleware/healthcheck/__main__.py index 217fff6..6a56410 100644 --- a/oslo_middleware/healthcheck/__main__.py +++ b/oslo_middleware/healthcheck/__main__.py @@ -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): diff --git a/oslo_middleware/healthcheck/pluginbase.py b/oslo_middleware/healthcheck/pluginbase.py index 5bb8494..ddfd940 100644 --- a/oslo_middleware/healthcheck/pluginbase.py +++ b/oslo_middleware/healthcheck/pluginbase.py @@ -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 diff --git a/oslo_middleware/tests/test_sizelimit.py b/oslo_middleware/tests/test_sizelimit.py index 3d57a61..5d547ac 100644 --- a/oslo_middleware/tests/test_sizelimit.py +++ b/oslo_middleware/tests/test_sizelimit.py @@ -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: |