summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwangzihao <wangzihao@yovole.com>2020-10-09 18:01:09 +0800
committerwangzihao <wangzihao@yovole.com>2020-10-09 18:08:32 +0800
commit91ba6d1d7cffea2c97259f7abf044d00cffbccb9 (patch)
tree2032f119fb59798a956bdb175e836a61a0cbf3be
parentc1be8a41d984aa88addfeaea2dc3c2392bfa2dcd (diff)
downloadtrove-91ba6d1d7cffea2c97259f7abf044d00cffbccb9.tar.gz
Remove six.moves
Remove six.moves Replace the following items with Python 3 style code. - six.moves.urllib - six.moves.http_client - six.moves.configparser - six.moves.cStringIO Change-Id: I004b6b9a81079c67451395bfe31ec75d58802c16
-rw-r--r--run_tests.py2
-rwxr-xr-xtools/trove-pylint.py4
-rw-r--r--trove/common/limits.py2
-rw-r--r--trove/common/stream_codecs.py2
-rw-r--r--trove/guestagent/datastore/mysql_common/service.py2
-rw-r--r--trove/tests/fakes/swift.py2
-rw-r--r--trove/tests/unittests/api/common/test_extensions.py5
-rw-r--r--trove/tests/unittests/api/common/test_limits.py2
8 files changed, 10 insertions, 11 deletions
diff --git a/run_tests.py b/run_tests.py
index caa8a1f3..024a93ad 100644
--- a/run_tests.py
+++ b/run_tests.py
@@ -25,7 +25,7 @@ import traceback
import eventlet
from oslo_log import log as logging
import proboscis
-from six.moves import urllib
+import urllib
import wsgi_intercept
from wsgi_intercept.httplib2_intercept import install as wsgi_install
diff --git a/tools/trove-pylint.py b/tools/trove-pylint.py
index fa8a5d97..088203c2 100755
--- a/tools/trove-pylint.py
+++ b/tools/trove-pylint.py
@@ -15,6 +15,7 @@
import fnmatch
import json
from collections import OrderedDict
+import io
import os
import re
import six
@@ -22,7 +23,6 @@ import sys
from pylint import lint
from pylint.reporters import text
-from six.moves import cStringIO as csio
DEFAULT_CONFIG_FILE = "tools/trove-pylint.config"
DEFAULT_IGNORED_FILES = ['trove/tests']
@@ -210,7 +210,7 @@ class LintRunner(object):
def dolint(self, filename):
exceptions = set()
- buffer = csio()
+ buffer = io.StringIO()
reporter = ParseableTextReporter(output=buffer)
options = list(self.config.get('options'))
options.append(filename)
diff --git a/trove/common/limits.py b/trove/common/limits.py
index 4549a7e2..bb1fee00 100644
--- a/trove/common/limits.py
+++ b/trove/common/limits.py
@@ -23,9 +23,9 @@ import math
import re
import time
+from http import client as http_client
from oslo_serialization import jsonutils
from oslo_utils import importutils
-from six.moves import http_client
import webob.dec
import webob.exc
diff --git a/trove/common/stream_codecs.py b/trove/common/stream_codecs.py
index 2aff5640..824273d5 100644
--- a/trove/common/stream_codecs.py
+++ b/trove/common/stream_codecs.py
@@ -16,12 +16,12 @@
import abc
import ast
import csv
+import configparser
import io
import re
import sys
import six
-from six.moves import configparser
import xmltodict
import yaml
diff --git a/trove/guestagent/datastore/mysql_common/service.py b/trove/guestagent/datastore/mysql_common/service.py
index 2bba511a..9f6e5d93 100644
--- a/trove/guestagent/datastore/mysql_common/service.py
+++ b/trove/guestagent/datastore/mysql_common/service.py
@@ -18,10 +18,10 @@ import re
from oslo_log import log as logging
from oslo_utils import encodeutils
import six
-from six.moves import urllib
import sqlalchemy
from sqlalchemy import exc
from sqlalchemy.sql.expression import text
+import urllib
from trove.common import cfg
from trove.common import exception
diff --git a/trove/tests/fakes/swift.py b/trove/tests/fakes/swift.py
index 7b8da07a..79ee401c 100644
--- a/trove/tests/fakes/swift.py
+++ b/trove/tests/fakes/swift.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from http import client as http_client
from hashlib import md5
from unittest.mock import MagicMock, patch
import json
@@ -24,7 +25,6 @@ import uuid
from oslo_log import log as logging
import six
-from six.moves import http_client
from swiftclient import client as swift
diff --git a/trove/tests/unittests/api/common/test_extensions.py b/trove/tests/unittests/api/common/test_extensions.py
index d034c773..a82326dc 100644
--- a/trove/tests/unittests/api/common/test_extensions.py
+++ b/trove/tests/unittests/api/common/test_extensions.py
@@ -13,12 +13,11 @@
# under the License.
+import configparser
import os
import pkg_resources
from unittest import mock
-from six.moves import configparser as config_parser
-
import trove
from trove.common import extensions
from trove.extensions.routes.mgmt import Mgmt
@@ -76,7 +75,7 @@ class TestExtensionLoading(trove_testtools.TestCase):
setup_path = "%s/setup.cfg" % trove_base
# check if we are running as unit test without module installed
if os.path.isfile(setup_path):
- parser = config_parser.ConfigParser()
+ parser = configparser.ConfigParser()
parser.read(setup_path)
entry_points = parser.get(
'entry_points', extensions.ExtensionManager.EXT_NAMESPACE)
diff --git a/trove/tests/unittests/api/common/test_limits.py b/trove/tests/unittests/api/common/test_limits.py
index 7d8ee340..a6aee3fd 100644
--- a/trove/tests/unittests/api/common/test_limits.py
+++ b/trove/tests/unittests/api/common/test_limits.py
@@ -18,10 +18,10 @@ Tests dealing with HTTP rate-limiting.
"""
+from http import client as http_client
from unittest.mock import Mock, MagicMock, patch
from oslo_serialization import jsonutils
import six
-from six.moves import http_client
import webob
from trove.common import limits