mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 21:30:22 -07:00
Fix undefined variables, basestring usage, and some associated python3 issues
This commit is contained in:
parent
9f7b0dfc30
commit
225fa5d092
84 changed files with 652 additions and 963 deletions
|
@ -52,7 +52,7 @@ except ImportError:
|
|||
# which is essentially a cut/paste from an earlier (2.6) version of python's
|
||||
# ast.py
|
||||
from compiler import ast, parse
|
||||
from ansible.module_utils.six import binary_type, string_types, text_type
|
||||
from ansible.module_utils.six import binary_type, integer_types, string_types, text_type
|
||||
|
||||
def literal_eval(node_or_string):
|
||||
"""
|
||||
|
@ -68,8 +68,7 @@ except ImportError:
|
|||
node_or_string = node_or_string.node
|
||||
|
||||
def _convert(node):
|
||||
# Okay to use long here because this is only for python 2.4 and 2.5
|
||||
if isinstance(node, ast.Const) and isinstance(node.value, (text_type, binary_type, int, float, long, complex)):
|
||||
if isinstance(node, ast.Const) and isinstance(node.value, (text_type, binary_type, float, complex) + integer_types):
|
||||
return node.value
|
||||
elif isinstance(node, ast.Tuple):
|
||||
return tuple(map(_convert, node.nodes))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue