"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/ansible/template/native_helpers.py" between
ansible-2.14.0.tar.gz and ansible-2.14.1rc1.tar.gz

About: Ansible is an IT Configuration Management, Deployment & Orchestration tool.
Release candidate.

native_helpers.py  (ansible-2.14.0):native_helpers.py  (ansible-2.14.1rc1)
skipping to change at line 125 skipping to change at line 125
# short-circuit literal_eval for anything other than strings # short-circuit literal_eval for anything other than strings
if not isinstance(out, string_types): if not isinstance(out, string_types):
return out return out
else: else:
if isinstance(nodes, GeneratorType): if isinstance(nodes, GeneratorType):
nodes = chain(head, nodes) nodes = chain(head, nodes)
out = ''.join([to_text(v) for v in nodes]) out = ''.join([to_text(v) for v in nodes])
try: try:
return ast.literal_eval( evaled = ast.literal_eval(
# In Python 3.10+ ast.literal_eval removes leading spaces/tabs # In Python 3.10+ ast.literal_eval removes leading spaces/tabs
# from the given string. For backwards compatibility we need to # from the given string. For backwards compatibility we need to
# parse the string ourselves without removing leading spaces/tabs. # parse the string ourselves without removing leading spaces/tabs.
ast.parse(out, mode='eval') ast.parse(out, mode='eval')
) )
except (ValueError, SyntaxError, MemoryError): except (ValueError, SyntaxError, MemoryError):
return out return out
if isinstance(evaled, string_types):
quote = out[0]
return f'{quote}{evaled}{quote}'
return evaled
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)