mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-09 05:27:17 +00:00
[PR #10873/6cd46654 backport][stable-11] Avoid six in plugin code (#10875)
Avoid six in plugin code (#10873)
Avoid six in plugin code.
(cherry picked from commit 6cd4665412)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
3b207ba0fd
commit
1e01aeacb4
34 changed files with 70 additions and 120 deletions
|
|
@ -7,7 +7,6 @@ __metaclass__ = type
|
|||
|
||||
import re
|
||||
|
||||
from ansible.module_utils.six import binary_type, text_type
|
||||
from collections.abc import Mapping, Set
|
||||
from ansible.module_utils.common.collections import is_sequence
|
||||
from ansible.utils.unsafe_proxy import (
|
||||
|
|
@ -29,11 +28,11 @@ def make_unsafe(value):
|
|||
return set(make_unsafe(elt) for elt in value)
|
||||
elif is_sequence(value):
|
||||
return type(value)(make_unsafe(elt) for elt in value)
|
||||
elif isinstance(value, binary_type):
|
||||
elif isinstance(value, bytes):
|
||||
if _RE_TEMPLATE_CHARS_BYTES.search(value):
|
||||
value = _make_unsafe(value)
|
||||
return value
|
||||
elif isinstance(value, text_type):
|
||||
elif isinstance(value, str):
|
||||
if _RE_TEMPLATE_CHARS.search(value):
|
||||
value = _make_unsafe(value)
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue