mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Move to_str alias into ansible.utils.unicode
@abadger suggested on IRC that it's useful enough to go into ansible.utils.unicode.
This commit is contained in:
@@ -251,3 +251,10 @@ def to_bytes(obj, encoding='utf-8', errors='replace', nonstring=None):
|
||||
# ensure that a filter will return unicode values.
|
||||
def unicode_wrap(func, *args, **kwargs):
|
||||
return to_unicode(func(*args, **kwargs), nonstring='passthru')
|
||||
|
||||
|
||||
# Alias for converting to native strings.
|
||||
if PY3:
|
||||
to_str = to_unicode
|
||||
else:
|
||||
to_str = to_bytes
|
||||
|
||||
Reference in New Issue
Block a user