Fix undefined variables, basestring usage, and some associated python3 issues

This commit is contained in:
Toshio Kuratomi 2017-07-22 18:15:46 -07:00
commit 225fa5d092
84 changed files with 652 additions and 963 deletions

View file

@ -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))