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
# under the License.
import six
def switch_interface_config_select_name(switch_interface_config, 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 names: String or list of strings - interface names to match
"""
if isinstance(names, six.string_types):
if isinstance(names, str):
names = [names]
return {
@ -37,7 +35,7 @@ def switch_interface_config_select_description(switch_interface_config, descript
:param switch_interface_config: Switch interface configuration dict
:param descriptions: String or list of strings - descriptions to match
"""
if isinstance(descriptions, six.string_types):
if isinstance(descriptions, str):
descriptions = [descriptions]
return {

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
from six.moves import configparser
from six import StringIO
import configparser
from io import StringIO
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)
parser = configparser.RawConfigParser()
if six.PY3:
parser.read_file(sio)
else:
parser.readfp(sio)
parser.read_file(sio)
if expected is None:
return

View File

@ -17,7 +17,6 @@ import glob
import itertools
import logging
import os
import six
import subprocess
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
:returns: The output of the command if check_output is true
"""
if isinstance(cmd, six.string_types):
if isinstance(cmd, str):
cmd_string = cmd
else:
cmd_string = " ".join(cmd)
@ -178,7 +177,7 @@ def quote_and_escape(value):
:param value: the string to quote and escape.
:returns: the quoted and escaped string.
"""
if not isinstance(value, six.string_types):
if not isinstance(value, str):
return value
return "'" + value.replace("'", "'\\''") + "'"