Remove all usage of ansible.module_utils.six from main branch (#10888)

* Get rid of all six.moves imports.

* Get rid of iteritems.

* Get rid of *_type(s) aliases.

* Replace StringIO import.

* Get rid of PY2/PY3 constants.

* Get rid of raise_from.

* Get rid of python_2_unicode_compatible.

* Clean up global six imports.

* Remove all usage of ansible.module_utils.six.

* Linting.

* Fix xml module.

* Docs adjustments.
This commit is contained in:
Felix Fontein 2025-10-11 08:21:57 +02:00 committed by GitHub
commit a8977afb04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
113 changed files with 188 additions and 352 deletions

View file

@ -281,8 +281,7 @@ command:
import os
import json
import tempfile
from ansible.module_utils.six.moves import shlex_quote
from ansible.module_utils.six import integer_types
from shlex import quote as shlex_quote
from ansible.module_utils.basic import AnsibleModule
@ -599,11 +598,11 @@ def main():
ret_out.append('{0}={{{1}}}'.format(k, process_complex_args(v)))
elif isinstance(v, list):
ret_out.append("{0}={1}".format(k, process_complex_args(v)))
elif isinstance(v, (integer_types, float, str, bool)):
elif isinstance(v, (int, float, str, bool)):
ret_out.append('{0}={1}'.format(k, format_args(v)))
else:
# only to handle anything unforeseen
module.fail_json(msg="Supported types are, dictionaries, lists, strings, integer_types, boolean and float.")
module.fail_json(msg="Supported types are, dictionaries, lists, strings, integers, boolean and float.")
if isinstance(vars, list):
l_out = []
for item in vars:
@ -611,11 +610,11 @@ def main():
l_out.append("{{{0}}}".format(process_complex_args(item)))
elif isinstance(item, list):
l_out.append("{0}".format(process_complex_args(item)))
elif isinstance(item, (str, integer_types, float, bool)):
elif isinstance(item, (str, int, float, bool)):
l_out.append(format_args(item))
else:
# only to handle anything unforeseen
module.fail_json(msg="Supported types are, dictionaries, lists, strings, integer_types, boolean and float.")
module.fail_json(msg="Supported types are, dictionaries, lists, strings, integers, boolean and float.")
ret_out.append("[{0}]".format(",".join(l_out)))
return ",".join(ret_out)