a )gt@sddlmZmZmZeZddlZddZzddlm Z WnBe yzddl mZm Z ddl mZmZmZmZdd Z Yn0d ZdS) )absolute_importdivisionprint_functionNcCs tdS)a8Get the current exception. This code needs to work on Python 2.4 through 3.x, so we cannot use "except Exception, e:" (SyntaxError on Python 3.x) nor "except Exception as e:" (SyntaxError on Python 2.4-2.5). Instead we must use :: except Exception: e = get_exception() )sysexc_inforrC/usr/lib/python3.9/site-packages/ansible/module_utils/pycompat24.py get_exception#s r ) literal_eval)astparse) binary_type integer_types string_types text_typecsJddddt|tr"t|dd}t|tjr4|j}fdd|S) a Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, numbers, tuples, lists, dicts, booleans, and None. NTF)NoneTrueFalseeval)modecst|tjr*t|jttttftr*|jSt|tj rFt t |j St|tj rbtt |j St|tjrtfdd|DSt|tjr|jvrˆ|jSnt|tjrˆ|j StddS)Nc3s"|]\}}||fVqdS)Nr).0kv)_convertrr Rz1literal_eval.._convert..zmalformed string) isinstancer ZConstvaluerrfloatcomplexrTupletuplemapZnodesListlistDictdictitemsNamenameZUnarySubexpr ValueError)noderZ _safe_namesrr rJs$        zliteral_eval.._convert)rrr r Z Expressionr-)Znode_or_stringrr.r r =s    r )r r )Z __future__rrrtypeZ __metaclass__rr r r ImportErrorZcompilerr Zansible.module_utils.sixrrrr__all__rrrr s