a )g@sddlmZmZmZeZddlZddlmZm Z ddl m Z ddl m Z ddlmZddlmZddlmZd d dd ZGd d d ejZddZddZddZdS))absolute_importdivisionprint_functionN)islicechain) GeneratorTypeto_text) string_types)AnsibleVaultEncryptedUnicode)NativeJinjaTextTF)trueZfalseZnullc@seZdZddZdS) Json2PythoncCs |jtvr|Stjt|jdS)N)value)id _JSON_MAPastZConstant)selfZnoderC/usr/lib/python3.9/site-packages/ansible/template/native_helpers.py visit_Names zJson2Python.visit_NameN)__name__ __module__ __qualname__rrrrrrsrc Cstt|d}|sdSt|dkrB|d}t|tr8|St|}n(t|trVt||}ddd|D}| ds||dvrz&t t t t j|d d }WntttfyYn0|S) anReturn a string of concatenated compiled nodes. Throw an undefined error if any of the nodes is undefined. If the result of concat appears to be a dictionary, list or bool, try and convert it to such using literal_eval, the same mechanism as used in jinja2_native. Used in Templar.template() when jinja2_native=False and convert_data=True. rcSsg|] }t|qSrr.0vrrr :z'ansible_eval_concat..){[)TrueFalseevalmode)listrlen isinstancer r rrjoin startswithr literal_evalZfix_missing_locationsrZvisitparse ValueError SyntaxError MemoryError)nodesheadoutrrransible_eval_concat!s.       r6cCsddd|DS)aReturn a string of concatenated compiled nodes. Throw an undefined error if any of the nodes is undefined. Other than that it is equivalent to Jinja2's default concat function. Used in Templar.template() when jinja2_native=False and convert_data=False. rcSsg|] }t|qSrrrrrrr Sr!z"ansible_concat..)r,)r3rrransible_concatLsr7c Cstt|d}|sdSt|dkrX|d}t|tr:|jSt|trH|St|ts|Sn(t|trlt ||}d dd|D}zt t j |dd }Wntttfy|YS0t|tr|d}|||S|S) aReturn a native Python type from the list of compiled nodes. If the result is a single node, its value is returned. Otherwise, the nodes are concatenated as strings. If the result can be parsed with :func:`ast.literal_eval`, the parsed value is returned. Otherwise, the string is returned. https://github.com/pallets/jinja/blob/master/src/jinja2/nativetypes.py rNrrrcSsg|] }t|qSrrrrrrr {r!z)ansible_native_concat..r&r')r)rr*r+r datar r rrr,rr.r/r0r1r2)r3r4r5Zevaledquoterrransible_native_concatVs0          r:)Z __future__rrrtypeZ __metaclass__r itertoolsrrtypesrZansible.module_utils._textr Zansible.module_utils.sixr Zansible.parsing.yaml.objectsr Zansible.utils.native_jinjar rZNodeTransformerrr6r7r:rrrrs      +