mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Py3: Replace six.text_type with str
On Python 3, six.text_type (singular) is 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:
@@ -1441,12 +1441,12 @@ if six.PY2:
|
||||
"""
|
||||
if isinstance(value, six.binary_type):
|
||||
return value.decode(sys.getfilesystemencoding())
|
||||
elif isinstance(value, six.text_type):
|
||||
elif isinstance(value, str):
|
||||
return value
|
||||
else:
|
||||
raise TypeError("expect {0} or {1}, not {2}".format(
|
||||
six.binary_type.__name__,
|
||||
six.text_type.__name__,
|
||||
str.__name__,
|
||||
type(value).__name__))
|
||||
else:
|
||||
fsdecode = os.fsdecode #pylint: disable=no-member
|
||||
@@ -1522,7 +1522,7 @@ def decode_json(data):
|
||||
# default
|
||||
return 'utf-8'
|
||||
|
||||
if isinstance(data, six.text_type):
|
||||
if isinstance(data, str):
|
||||
return data
|
||||
|
||||
return data.decode(detect_encoding(data), 'surrogatepass')
|
||||
|
||||
Reference in New Issue
Block a user