From b5404821712d0b9282b1156cb9dc9171015ca86e Mon Sep 17 00:00:00 2001 From: jacky06 Date: Mon, 4 May 2020 11:06:28 +0800 Subject: [PATCH] Remove six Six is a python 2 and 3 compatibility library, remove it since openstack use python3 Change-Id: Ib0e84ce417759843eccc2606ccb621242411e6c2 --- ansible/filter_plugins/switches.py | 6 ++---- kayobe/tests/molecule/utils.py | 11 +++-------- kayobe/utils.py | 5 ++--- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/ansible/filter_plugins/switches.py b/ansible/filter_plugins/switches.py index 5384e1bf3..c71eafe65 100644 --- a/ansible/filter_plugins/switches.py +++ b/ansible/filter_plugins/switches.py @@ -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 { diff --git a/kayobe/tests/molecule/utils.py b/kayobe/tests/molecule/utils.py index 97fa054b0..07e311b7f 100644 --- a/kayobe/tests/molecule/utils.py +++ b/kayobe/tests/molecule/utils.py @@ -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 diff --git a/kayobe/utils.py b/kayobe/utils.py index 3ac785093..2ad91cc33 100644 --- a/kayobe/utils.py +++ b/kayobe/utils.py @@ -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("'", "'\\''") + "'"