Merge "Remove six"

This commit is contained in:
Zuul 2020-05-17 07:34:42 +00:00 committed by Gerrit Code Review
commit 9c33cdb9b3
5 changed files with 4 additions and 23 deletions

View File

@ -13,7 +13,6 @@
# under the License. # under the License.
import logging import logging
import six
import yaml import yaml
from kolla_cli.api.exceptions import InvalidArgument from kolla_cli.api.exceptions import InvalidArgument
@ -66,8 +65,7 @@ class PropertyApi(object):
# string to a property. without this safe_load will turn # string to a property. without this safe_load will turn
# an empty string into a None which is different than an # an empty string into a None which is different than an
# empty string. # empty string.
if isinstance(original_value, six.string_types)\ if isinstance(original_value, str) and value is None:
and value is None:
value = '' value = ''
if current_property.value is None: if current_property.value is None:
current_property_type = None current_property_type = None

View File

@ -27,7 +27,7 @@ CLIENT = ClientApi()
def _get_names(args_list): def _get_names(args_list):
csv_list = args_list[0].strip() csv_list = args_list[0].strip()
names = utils.convert_to_unicode(csv_list).split(',') names = csv_list.split(',')
if 'all' in names: if 'all' in names:
names = None names = None
return names return names

View File

@ -18,7 +18,6 @@ import grp
import logging import logging
import os import os
import pwd import pwd
import six
import subprocess # nosec import subprocess # nosec
import time import time
import yaml import yaml
@ -121,17 +120,6 @@ def get_ansible_command(playbook=False):
return cmd return cmd
def convert_to_unicode(the_string):
"""convert string to unicode.
This is used to fixup extended ascii chars in strings. these chars cause
errors in json pickle/unpickle.
"""
if the_string is None:
return the_string
return six.u(the_string)
def run_cmd(cmd, print_output=True): def run_cmd(cmd, print_output=True):
"""run a system command """run a system command
@ -422,7 +410,7 @@ def safe_decode(obj_to_decode):
new_obj[key] = value new_obj[key] = value
else: else:
new_obj = obj_to_decode new_obj = obj_to_decode
if not isinstance(obj_to_decode, six.text_type): if not isinstance(obj_to_decode, str):
# object is not unicode # object is not unicode
new_obj = obj_to_decode.decode('utf-8') new_obj = obj_to_decode.decode('utf-8')
return new_obj return new_obj
@ -478,7 +466,7 @@ def check_arg(param, param_name, expected_type, none_ok=False, empty_ok=False,
# None arg # None arg
raise MissingArgument(param_name) raise MissingArgument(param_name)
if ((isinstance(param, six.string_types) or if ((isinstance(param, str) or
isinstance(param, dict) or isinstance(param, dict) or
isinstance(param, list)) and isinstance(param, list)) and
not param and not empty_ok): not param and not empty_ok):
@ -488,9 +476,6 @@ def check_arg(param, param_name, expected_type, none_ok=False, empty_ok=False,
# if expected type is None, skip the type checking # if expected type is None, skip the type checking
if expected_type is None: if expected_type is None:
return return
# normalize expected string types for py2 and py3
if expected_type is str:
expected_type = six.string_types
if not isinstance(param, expected_type): if not isinstance(param, expected_type):
# wrong type # wrong type

View File

@ -86,7 +86,6 @@ restructuredtext-lint==1.1.3
rfc3986==1.2.0 rfc3986==1.2.0
setuptools==21.0.0 setuptools==21.0.0
simplejson==3.13.2 simplejson==3.13.2
six==1.10.0
smmap2==2.0.3 smmap2==2.0.3
snowballstemmer==1.2.1 snowballstemmer==1.2.1
Sphinx==1.6.2 Sphinx==1.6.2

View File

@ -9,5 +9,4 @@ jsonpickle>=0.9 # BSD
oslo.i18n>=3.20.0 # Apache-2.0 oslo.i18n>=3.20.0 # Apache-2.0
paramiko>=2.6.0 # LGPL paramiko>=2.6.0 # LGPL
pbr!=2.1.0,>=2.0.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0
six>=1.10.0 # MIT
docker>=2.4.2 # Apache-2.0 docker>=2.4.2 # Apache-2.0