uBFj1ddlZddlZddlZddlZddlmZddlmZddlm Z dZ dZ ddZ d Z d Zd Zd Zd ZdZdZGddeZedZddZdZdZdS)N)chain)contextmanager)treec|j}d|vsd|vrdStjtjdd}t tjtj |dzt|S)Nz dist-packagesz site-packagesFlibpythonz\d.\d) partsospathjoinsysprefixboolrematchescapestr)r r base_paths DC:\PYTHON\_runtimes\venv\Lib\site-packages\jedi/inference/helpers.pyis_stdlib_pathr sm JE%?e#;#;u SZ99I 9--8#d))DD E EEctj|}g}|jD]c}t|tjrtj|}||_nt |}||_||d||_|S)zO Much, much faster than copy.deepcopy, but just for parser tree nodes. )copychildren isinstancerLeafparent deep_ast_copyappend)objnew_obj new_childrenchild new_childs rrrs innGL'' eTY ' ' ' %((I&I  %e,,I&I I&&&&#G NrFc|j}|jdkr ddlm}||jS|jdks||jd|jdfvrC|dkrddlm}|S|jdkr| |S| |S|j}|j |}|r|}n|d z}|jd kr5|} | d z} |j| } | jdkrn|j| d z|} n|jd} |jd |} | d kr| d} | d d } | | } ddl m } | D]}| || |} | S)a Creates a "call" node that consist of all ``trailer`` and ``power`` objects. E.g. if you call it with ``append``:: list([]).append(3) or None You would get a node with the content ``list([]).append`` back. This generates a copy of the original ast node. If you're using the leaf, e.g. the bracket `)` it will return ``list([])``. We use this function for two purposes. Given an expression ``bar.foo``, we may want to - infer the type of ``foo`` to offer completions after foo - infer the type of ``bar`` to be able to jump to the definition of foo The option ``cut_own_trailer`` must be set to true for the second purpose. fstringr)compiledtrailer:) NO_VALUESatom error_nodeTawaitN) infer_trailer) rtypejedi.inferencer'get_string_value_setinference_staterjedi.inference.base_valuer+ infer_nodeindexjedi.inference.syntax_treer0)contextleafcut_own_trailerr(r'r+powerr7cutstartbasetrailersvaluesr0s rinfer_call_of_leafrB-s&kG|y  ++++++,,W-DEEE |y  D1A!1DgFVWYFZ0[$[$[ 3;; ; ; ; ; ; ;  <6 ! !%%g.. .!!$''' NE N  ) )Eai z\!!  QJE>%(DyI%%   >%!)C-0~a >!C%( w{ABB<    % %F88888899w88 Mrc |j}ttjd|DS#t$r|jdkr|gcYSgcYSwxYw)Nc34K|]}t|VdSN)get_names_of_node).0cs r z$get_names_of_node..xs+'O'O(9!(<(<'O'O'O'O'O'Orname)rlistr from_iterableAttributeErrorr1)noders rrFrFoswQ=E''O'Oh'O'O'OOOPPP  9  6MMMIII s4AAAc||o(t|dtSN)default) is_compiledrget_safe_valuervalues r is_stringrV{s5      V:e.B.B4.B.P.PRU#V#VVrc>t|pt|SrE) is_numberrVrTs r is_literalrYs U   /y///rcV|d}t||r|SdSrP)rSr)rUaccepts r_get_safe_value_or_noner\s9   . .E%   rc,t|tSrE)r\intrTs rget_int_or_noner_ "5# . ..rc,t|tSrE)r\rrTs rget_str_or_nonerbr`rc>t|ttfduSrE)r\r^floatrTs rrXrXs "53, 7 7t CCrceZdZdS)SimpleGetItemNotFoundN)__name__ __module__ __qualname__rrrfrfsDrrfc'LK dVdS#|$r}t|d}~wwxYwrE)rf)exception_classeses rreraise_getitem_errorsrnsE'  '''#A&&&'s ##cDd}g}|ddD]}|dvr|s|t|jz } |jdkr1|jdddD]}||||urnZn3|jdkr||||urn |dkr|sg}||fS)Nrr-).z... dotted_namerJ,)lenrUr1rr)nodesis_import_from until_nodelevelnamesrNns rparse_dotted_namesr{s E Eabb  <   )TZ( Y- ' ']33Q3'   Q ??E# E Y& LL   z!!" S[[!   %<rcn||dd|dS)Nr)) import_modulepy__getattribute__)r4rys rvalues_from_qualified_namesrs0  ( (ss 4 4 G Gb R RRrcP|j}|dS|ddvS)NFr)pandasnumpy tensorflow matplotlib)get_root_context string_names)r9rs ris_big_annoying_libraryrs3++--:Lu ?M MMr)FrE)rr rr itertoolsr contextlibrparsorrrrBrFrVrYr\r_rbrX Exceptionrfrnr{rrrjrrrs %%%%%% F F F,????D Q Q QWWW000 //////DDD     I   ''':SSSNNNNNr