Remove six
Remove all usages of six Change-Id: I3a5dedade263337aeef12eac1c4daf2f7e82e306 Story: 2008305 Task: 41190
This commit is contained in:
parent
7f124942b6
commit
feb22145a1
@ -59,7 +59,6 @@ requests==2.14.2
|
||||
requestsexceptions==1.2.0
|
||||
restructuredtext-lint==1.1.1
|
||||
simplejson==3.5.1
|
||||
six==1.10.0
|
||||
smmap==0.9.0
|
||||
snowballstemmer==1.2.1
|
||||
Sphinx==2.0.0
|
||||
|
@ -15,7 +15,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
|
||||
|
||||
class MonascaManager(object):
|
||||
|
@ -16,7 +16,6 @@
|
||||
import numbers
|
||||
|
||||
import prettytable
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from osc_lib import exceptions as exc
|
||||
@ -41,7 +40,7 @@ def arg(*args, **kwargs):
|
||||
|
||||
def json_formatter(js):
|
||||
formatter = (jsonutils.dumps(js, indent=2, ensure_ascii=False))
|
||||
return formatter if six.PY3 else formatter.encode('utf-8')
|
||||
return formatter
|
||||
|
||||
|
||||
def print_list(objs, fields, field_labels=None, formatters=None, sortby=None):
|
||||
@ -66,7 +65,7 @@ def print_list(objs, fields, field_labels=None, formatters=None, sortby=None):
|
||||
pt.add_row(row)
|
||||
field_to_sort_by = field_labels[sortby] if sortby else None
|
||||
pt_string = pt.get_string(sortby=field_to_sort_by)
|
||||
print(pt_string if six.PY3 else pt_string.encode('utf-8'))
|
||||
print(pt_string)
|
||||
|
||||
|
||||
def print_dict(d, formatters=None):
|
||||
@ -83,7 +82,7 @@ def print_dict(d, formatters=None):
|
||||
pt.add_row([field, d[field]])
|
||||
|
||||
pt_string = pt.get_string(sortby='Property')
|
||||
print(pt_string if six.PY3 else pt_string.encode('utf-8'))
|
||||
print(pt_string)
|
||||
|
||||
|
||||
def format_parameters(params):
|
||||
@ -193,7 +192,7 @@ def format_dict(dict):
|
||||
def format_list(in_list):
|
||||
string_list = list()
|
||||
for k in in_list:
|
||||
if isinstance(k, six.text_type):
|
||||
if isinstance(k, str):
|
||||
key = k.encode('utf-8')
|
||||
else:
|
||||
key = k
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import six
|
||||
|
||||
from osc_lib.command import command
|
||||
from osc_lib import utils
|
||||
@ -95,8 +94,7 @@ class MigratingCommandMeta(command.CommandMeta):
|
||||
bases, cls_dict)
|
||||
|
||||
|
||||
@six.add_metaclass(MigratingCommandMeta)
|
||||
class MigratingCommand(command.Command):
|
||||
class MigratingCommand(command.Command, metaclass=MigratingCommandMeta):
|
||||
"""MigratingCommand is temporary command.
|
||||
|
||||
MigratingCommand allows to map function defined
|
||||
|
@ -19,7 +19,6 @@ Command-line interface to the monasca-client API.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import locale
|
||||
import sys
|
||||
|
||||
from osc_lib.api import auth
|
||||
@ -27,7 +26,6 @@ from osc_lib.cli import client_config as cloud_config
|
||||
from osc_lib import shell
|
||||
from osc_lib import utils
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
from monascaclient.osc import migration
|
||||
from monascaclient import version as mc_version
|
||||
@ -100,12 +98,6 @@ def main(args=None):
|
||||
try:
|
||||
if args is None:
|
||||
args = sys.argv[1:]
|
||||
if six.PY2:
|
||||
# Emulate Py3, decode argv into Unicode based on locale so that
|
||||
# commands always see arguments as text instead of binary data
|
||||
encoding = locale.getpreferredencoding()
|
||||
if encoding:
|
||||
args = map(lambda arg: arg.decode(encoding), args)
|
||||
return MonascaShell().run(args)
|
||||
except Exception as e:
|
||||
if '--debug' in args or '-d' in args:
|
||||
|
@ -14,7 +14,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from six.moves.urllib import parse
|
||||
from urllib import parse
|
||||
|
||||
from monascaclient.common import monasca_manager
|
||||
|
||||
|
@ -13,4 +13,3 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
PrettyTable<0.8,>=0.7.2 # BSD
|
||||
PyYAML>=3.12 # MIT
|
||||
|
||||
six>=1.10.0 # MIT
|
||||
|
Loading…
Reference in New Issue
Block a user