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:
parent
8845f72f40
commit
48497b2784
@ -21,8 +21,6 @@ import signal
|
|||||||
import uuid
|
import uuid
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
from swiftbench.bench import (BenchController, DistributedBenchController,
|
from swiftbench.bench import (BenchController, DistributedBenchController,
|
||||||
create_containers, delete_containers)
|
create_containers, delete_containers)
|
||||||
from swiftbench.utils import readconf, config_true_value
|
from swiftbench.utils import readconf, config_true_value
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
python-swiftclient>=3.2.0
|
python-swiftclient>=3.2.0
|
||||||
eventlet>=0.17.4 # MIT
|
eventlet>=0.17.4 # MIT
|
||||||
six>=1.9.0
|
|
||||||
|
@ -31,8 +31,6 @@ import eventlet
|
|||||||
import eventlet.pools
|
import eventlet.pools
|
||||||
from eventlet.green.httplib import CannotSendRequest
|
from eventlet.green.httplib import CannotSendRequest
|
||||||
|
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
import swiftclient as client
|
import swiftclient as client
|
||||||
|
|
||||||
from swiftbench.utils import config_true_value, using_http_proxy, \
|
from swiftbench.utils import config_true_value, using_http_proxy, \
|
||||||
|
@ -13,11 +13,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
from six.moves.configparser import ConfigParser, RawConfigParser
|
from configparser import ConfigParser, RawConfigParser
|
||||||
from six.moves.urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from six.moves.urllib.request import getproxies, proxy_bypass
|
from urllib.request import getproxies, proxy_bypass
|
||||||
|
|
||||||
# Used when reading config values
|
# Used when reading config values
|
||||||
TRUE_VALUES = set(('true', '1', 'yes', 'on', 't', 'y'))
|
TRUE_VALUES = set(('true', '1', 'yes', 'on', 't', 'y'))
|
||||||
@ -79,7 +78,7 @@ def config_true_value(value):
|
|||||||
Returns False otherwise.
|
Returns False otherwise.
|
||||||
"""
|
"""
|
||||||
return value is True or \
|
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):
|
def using_http_proxy(url):
|
||||||
@ -97,7 +96,7 @@ def get_size_bytes(value):
|
|||||||
|
|
||||||
For example, '10k' becomes 10240, and '2M' becomes 2097152.
|
For example, '10k' becomes 10240, and '2M' becomes 2097152.
|
||||||
"""
|
"""
|
||||||
if not isinstance(value, six.string_types):
|
if not isinstance(value, str):
|
||||||
raise TypeError
|
raise TypeError
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
multiple = {
|
multiple = {
|
||||||
|
@ -18,7 +18,7 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from six.moves import cStringIO
|
from io import StringIO
|
||||||
|
|
||||||
from swiftbench import utils
|
from swiftbench import utils
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ log_name = yarr'''
|
|||||||
f.write(conf)
|
f.write(conf)
|
||||||
make_filename = lambda: temppath
|
make_filename = lambda: temppath
|
||||||
# setup a file stream
|
# setup a file stream
|
||||||
make_fp = lambda: cStringIO(conf)
|
make_fp = lambda: StringIO(conf)
|
||||||
for conf_object_maker in (make_filename, make_fp):
|
for conf_object_maker in (make_filename, make_fp):
|
||||||
conffile = conf_object_maker()
|
conffile = conf_object_maker()
|
||||||
result = utils.readconf(conffile)
|
result = utils.readconf(conffile)
|
||||||
@ -92,7 +92,7 @@ log_name = %(yarr)s'''
|
|||||||
f.write(conf)
|
f.write(conf)
|
||||||
make_filename = lambda: temppath
|
make_filename = lambda: temppath
|
||||||
# setup a file stream
|
# setup a file stream
|
||||||
make_fp = lambda: cStringIO(conf)
|
make_fp = lambda: StringIO(conf)
|
||||||
for conf_object_maker in (make_filename, make_fp):
|
for conf_object_maker in (make_filename, make_fp):
|
||||||
conffile = conf_object_maker()
|
conffile = conf_object_maker()
|
||||||
result = utils.readconf(conffile, raw=True)
|
result = utils.readconf(conffile, raw=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user