mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fix undefined variables, basestring usage, and some associated python3 issues
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user