Remove six and py27 tox

Replace the following items with Python 3 style code.

- six.moves
- six.string_types

Change-Id: I77a0450e6e682f568de2ecde45765b0fd8762e20
This commit is contained in:
xuanyandong 2020-09-30 09:20:50 +08:00
parent 8845f72f40
commit 48497b2784
6 changed files with 9 additions and 15 deletions

View File

@ -21,8 +21,6 @@ import signal
import uuid
from optparse import OptionParser
from six.moves import range
from swiftbench.bench import (BenchController, DistributedBenchController,
create_containers, delete_containers)
from swiftbench.utils import readconf, config_true_value

View File

@ -1,3 +1,2 @@
python-swiftclient>=3.2.0
eventlet>=0.17.4 # MIT
six>=1.9.0

View File

@ -31,8 +31,6 @@ import eventlet
import eventlet.pools
from eventlet.green.httplib import CannotSendRequest
from six.moves import range
import swiftclient as client
from swiftbench.utils import config_true_value, using_http_proxy, \

View File

@ -13,11 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import six
import sys
from six.moves.configparser import ConfigParser, RawConfigParser
from six.moves.urllib.parse import urlparse
from six.moves.urllib.request import getproxies, proxy_bypass
from configparser import ConfigParser, RawConfigParser
from urllib.parse import urlparse
from urllib.request import getproxies, proxy_bypass
# Used when reading config values
TRUE_VALUES = set(('true', '1', 'yes', 'on', 't', 'y'))
@ -79,7 +78,7 @@ def config_true_value(value):
Returns False otherwise.
"""
return value is True or \
(isinstance(value, six.string_types) and value.lower() in TRUE_VALUES)
(isinstance(value, str) and value.lower() in TRUE_VALUES)
def using_http_proxy(url):
@ -97,7 +96,7 @@ def get_size_bytes(value):
For example, '10k' becomes 10240, and '2M' becomes 2097152.
"""
if not isinstance(value, six.string_types):
if not isinstance(value, str):
raise TypeError
value = value.strip()
multiple = {

View File

@ -18,7 +18,7 @@ import os
import tempfile
import unittest
from six.moves import cStringIO
from io import StringIO
from swiftbench import utils
@ -46,7 +46,7 @@ log_name = yarr'''
f.write(conf)
make_filename = lambda: temppath
# setup a file stream
make_fp = lambda: cStringIO(conf)
make_fp = lambda: StringIO(conf)
for conf_object_maker in (make_filename, make_fp):
conffile = conf_object_maker()
result = utils.readconf(conffile)
@ -92,7 +92,7 @@ log_name = %(yarr)s'''
f.write(conf)
make_filename = lambda: temppath
# setup a file stream
make_fp = lambda: cStringIO(conf)
make_fp = lambda: StringIO(conf)
for conf_object_maker in (make_filename, make_fp):
conffile = conf_object_maker()
result = utils.readconf(conffile, raw=True)

View File

@ -1,5 +1,5 @@
[tox]
envlist = py37,py27,pypy,pep8
envlist = py37,pypy,pep8
minversion = 1.6
[testenv]