Py3: Replace six.string_types with str

In Python 3, six.string_types is just an alias for str.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Christian Heimes
2018-09-26 12:24:33 +02:00
parent 78c722d4c3
commit 964a9bdcec
26 changed files with 66 additions and 75 deletions

View File

@@ -447,7 +447,7 @@ def run(args, stdin=None, raiseonerr=True, nolog=(), env=None,
p_out = None
p_err = None
if isinstance(nolog, six.string_types):
if isinstance(nolog, str):
# We expect a tuple (or list, or other iterable) of nolog strings.
# Passing just a single string is bad: strings are iterable, so this
# would result in every individual character of that string being
@@ -585,7 +585,7 @@ def run(args, stdin=None, raiseonerr=True, nolog=(), env=None,
def nolog_replace(string, nolog):
"""Replace occurences of strings given in `nolog` with XXXXXXXX"""
for value in nolog:
if not value or not isinstance(value, six.string_types):
if not value or not isinstance(value, str):
continue
quoted = urllib.parse.quote(value)
@@ -954,7 +954,7 @@ def user_input(prompt, default = None, allow_empty = True):
return ''
raise RuntimeError("Failed to get user input")
if isinstance(default, six.string_types):
if isinstance(default, str):
while True:
try:
ret = input("%s [%s]: " % (prompt, default))