Remove six

Six is a python 2 and 3 compatibility library, remove it since openstack
use python3

Change-Id: Ib0e84ce417759843eccc2606ccb621242411e6c2
This commit is contained in:
jacky06 2020-05-04 11:06:28 +08:00 committed by Mark Goddard
parent b9d76f6ef5
commit b540482171
3 changed files with 7 additions and 15 deletions

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import six
def switch_interface_config_select_name(switch_interface_config, names): def switch_interface_config_select_name(switch_interface_config, names):
"""Select and return all switch interfaces matching requested names. """Select and return all switch interfaces matching requested names.
@ -21,7 +19,7 @@ def switch_interface_config_select_name(switch_interface_config, names):
:param switch_interface_config: Switch interface configuration dict :param switch_interface_config: Switch interface configuration dict
:param names: String or list of strings - interface names to match :param names: String or list of strings - interface names to match
""" """
if isinstance(names, six.string_types): if isinstance(names, str):
names = [names] names = [names]
return { return {
@ -37,7 +35,7 @@ def switch_interface_config_select_description(switch_interface_config, descript
:param switch_interface_config: Switch interface configuration dict :param switch_interface_config: Switch interface configuration dict
:param descriptions: String or list of strings - descriptions to match :param descriptions: String or list of strings - descriptions to match
""" """
if isinstance(descriptions, six.string_types): if isinstance(descriptions, str):
descriptions = [descriptions] descriptions = [descriptions]
return { return {

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import six import configparser
from six.moves import configparser from io import StringIO
from six import StringIO
def test_file(host, path, owner='root', group='root'): def test_file(host, path, owner='root', group='root'):
@ -42,11 +41,7 @@ def test_ini_file(host, path, owner='root', group='root', expected=None):
sio = StringIO(host.file(path).content_string) sio = StringIO(host.file(path).content_string)
parser = configparser.RawConfigParser() parser = configparser.RawConfigParser()
parser.read_file(sio)
if six.PY3:
parser.read_file(sio)
else:
parser.readfp(sio)
if expected is None: if expected is None:
return return

View File

@ -17,7 +17,6 @@ import glob
import itertools import itertools
import logging import logging
import os import os
import six
import subprocess import subprocess
import sys import sys
@ -151,7 +150,7 @@ def run_command(cmd, quiet=False, check_output=False, **kwargs):
:param check_output: Whether to return the output of the command :param check_output: Whether to return the output of the command
:returns: The output of the command if check_output is true :returns: The output of the command if check_output is true
""" """
if isinstance(cmd, six.string_types): if isinstance(cmd, str):
cmd_string = cmd cmd_string = cmd
else: else:
cmd_string = " ".join(cmd) cmd_string = " ".join(cmd)
@ -178,7 +177,7 @@ def quote_and_escape(value):
:param value: the string to quote and escape. :param value: the string to quote and escape.
:returns: the quoted and escaped string. :returns: the quoted and escaped string.
""" """
if not isinstance(value, six.string_types): if not isinstance(value, str):
return value return value
return "'" + value.replace("'", "'\\''") + "'" return "'" + value.replace("'", "'\\''") + "'"