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
This commit is contained in:
wangzihao 2020-10-09 18:01:09 +08:00
parent c1be8a41d9
commit 91ba6d1d7c
8 changed files with 10 additions and 11 deletions

View File

@ -25,7 +25,7 @@ import traceback
import eventlet import eventlet
from oslo_log import log as logging from oslo_log import log as logging
import proboscis import proboscis
from six.moves import urllib import urllib
import wsgi_intercept import wsgi_intercept
from wsgi_intercept.httplib2_intercept import install as wsgi_install from wsgi_intercept.httplib2_intercept import install as wsgi_install

View File

@ -15,6 +15,7 @@
import fnmatch import fnmatch
import json import json
from collections import OrderedDict from collections import OrderedDict
import io
import os import os
import re import re
import six import six
@ -22,7 +23,6 @@ import sys
from pylint import lint from pylint import lint
from pylint.reporters import text from pylint.reporters import text
from six.moves import cStringIO as csio
DEFAULT_CONFIG_FILE = "tools/trove-pylint.config" DEFAULT_CONFIG_FILE = "tools/trove-pylint.config"
DEFAULT_IGNORED_FILES = ['trove/tests'] DEFAULT_IGNORED_FILES = ['trove/tests']
@ -210,7 +210,7 @@ class LintRunner(object):
def dolint(self, filename): def dolint(self, filename):
exceptions = set() exceptions = set()
buffer = csio() buffer = io.StringIO()
reporter = ParseableTextReporter(output=buffer) reporter = ParseableTextReporter(output=buffer)
options = list(self.config.get('options')) options = list(self.config.get('options'))
options.append(filename) options.append(filename)

View File

@ -23,9 +23,9 @@ import math
import re import re
import time import time
from http import client as http_client
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import importutils from oslo_utils import importutils
from six.moves import http_client
import webob.dec import webob.dec
import webob.exc import webob.exc

View File

@ -16,12 +16,12 @@
import abc import abc
import ast import ast
import csv import csv
import configparser
import io import io
import re import re
import sys import sys
import six import six
from six.moves import configparser
import xmltodict import xmltodict
import yaml import yaml

View File

@ -18,10 +18,10 @@ import re
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import encodeutils from oslo_utils import encodeutils
import six import six
from six.moves import urllib
import sqlalchemy import sqlalchemy
from sqlalchemy import exc from sqlalchemy import exc
from sqlalchemy.sql.expression import text from sqlalchemy.sql.expression import text
import urllib
from trove.common import cfg from trove.common import cfg
from trove.common import exception from trove.common import exception

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from http import client as http_client
from hashlib import md5 from hashlib import md5
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
import json import json
@ -24,7 +25,6 @@ import uuid
from oslo_log import log as logging from oslo_log import log as logging
import six import six
from six.moves import http_client
from swiftclient import client as swift from swiftclient import client as swift

View File

@ -13,12 +13,11 @@
# under the License. # under the License.
import configparser
import os import os
import pkg_resources import pkg_resources
from unittest import mock from unittest import mock
from six.moves import configparser as config_parser
import trove import trove
from trove.common import extensions from trove.common import extensions
from trove.extensions.routes.mgmt import Mgmt from trove.extensions.routes.mgmt import Mgmt
@ -76,7 +75,7 @@ class TestExtensionLoading(trove_testtools.TestCase):
setup_path = "%s/setup.cfg" % trove_base setup_path = "%s/setup.cfg" % trove_base
# check if we are running as unit test without module installed # check if we are running as unit test without module installed
if os.path.isfile(setup_path): if os.path.isfile(setup_path):
parser = config_parser.ConfigParser() parser = configparser.ConfigParser()
parser.read(setup_path) parser.read(setup_path)
entry_points = parser.get( entry_points = parser.get(
'entry_points', extensions.ExtensionManager.EXT_NAMESPACE) 'entry_points', extensions.ExtensionManager.EXT_NAMESPACE)

View File

@ -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 unittest.mock import Mock, MagicMock, patch
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six import six
from six.moves import http_client
import webob import webob
from trove.common import limits from trove.common import limits