mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Add clarifying comments
This commit is contained in:
parent
2035bc8a44
commit
b616ce046b
@ -111,6 +111,9 @@ def decode(data, encoding=None, errors='strict', keep=False,
|
|||||||
data = salt.utils.stringutils.to_unicode(
|
data = salt.utils.stringutils.to_unicode(
|
||||||
data, encoding, errors, normalize)
|
data, encoding, errors, normalize)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_unicode raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply means we
|
||||||
|
# are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
@ -138,6 +141,9 @@ def decode_dict(data, encoding=None, errors='strict', keep=False,
|
|||||||
key = salt.utils.stringutils.to_unicode(
|
key = salt.utils.stringutils.to_unicode(
|
||||||
key, encoding, errors, normalize)
|
key, encoding, errors, normalize)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_unicode raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply
|
||||||
|
# means we are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
@ -160,6 +166,9 @@ def decode_dict(data, encoding=None, errors='strict', keep=False,
|
|||||||
value = salt.utils.stringutils.to_unicode(
|
value = salt.utils.stringutils.to_unicode(
|
||||||
value, encoding, errors, normalize)
|
value, encoding, errors, normalize)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_unicode raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply
|
||||||
|
# means we are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
@ -194,6 +203,9 @@ def decode_list(data, encoding=None, errors='strict', keep=False,
|
|||||||
item = salt.utils.stringutils.to_unicode(
|
item = salt.utils.stringutils.to_unicode(
|
||||||
item, encoding, errors, normalize)
|
item, encoding, errors, normalize)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_unicode raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply
|
||||||
|
# means we are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
@ -240,6 +252,9 @@ def encode(data, encoding=None, errors='strict', keep=False,
|
|||||||
try:
|
try:
|
||||||
return salt.utils.stringutils.to_bytes(data, encoding, errors)
|
return salt.utils.stringutils.to_bytes(data, encoding, errors)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_bytes raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply
|
||||||
|
# means we are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
@ -265,6 +280,9 @@ def encode_dict(data, encoding=None, errors='strict', keep=False,
|
|||||||
try:
|
try:
|
||||||
key = salt.utils.stringutils.to_bytes(key, encoding, errors)
|
key = salt.utils.stringutils.to_bytes(key, encoding, errors)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_bytes raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply
|
||||||
|
# means we are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
@ -285,6 +303,9 @@ def encode_dict(data, encoding=None, errors='strict', keep=False,
|
|||||||
try:
|
try:
|
||||||
value = salt.utils.stringutils.to_bytes(value, encoding, errors)
|
value = salt.utils.stringutils.to_bytes(value, encoding, errors)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_bytes raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply
|
||||||
|
# means we are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
@ -318,6 +339,9 @@ def encode_list(data, encoding=None, errors='strict', keep=False,
|
|||||||
try:
|
try:
|
||||||
item = salt.utils.stringutils.to_bytes(item, encoding, errors)
|
item = salt.utils.stringutils.to_bytes(item, encoding, errors)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# to_bytes raises a TypeError when input is not a
|
||||||
|
# string/bytestring/bytearray. This is expected and simply
|
||||||
|
# means we are going to leave the value as-is.
|
||||||
pass
|
pass
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
if not keep:
|
if not keep:
|
||||||
|
Loading…
Reference in New Issue
Block a user