uBFj(ddlmZddlmZddlmZddlmZddlm Z ddl m Z m Z m Z ddlmZddlmZd ZGd d eZd Zd ZdZdS)) defaultdict) Parameter)debug)PushBackIterator)analysis)LazyKnownValue LazyTreeValueLazyUnknownValue)iterable) ParamNamect|tr:|j}|jjdkr|j}t j|j|||SdS)Nargument) isinstancer dataparenttyperaddcontext) error_name lazy_valuemessagenodes BC:\PYTHON\_runtimes\venv\Lib\site-packages\jedi/inference/param.py_add_argument_issuer sX*m,,K ; z ) );D|J. D'JJJ KKc2eZdZdfd ZdZdZdZxZS)ExecutedParamNameFcvt||j|||_||_dS)N) arguments)super__init__name _lazy_value _is_default)selffunction_valuer param_noder is_default __class__s rr!zExecutedParamName.__init__s: INNN%%rc4|jSN)r#inferr%s rr,zExecutedParamName.infers%%'''rc^|jrdS|}|tjtjfvrdS|dsdStfd|D}tj d||d|S)NTF)execute_annotationc3pK|]0}D]}||V1dSr+)gather_annotation_classesis_sub_class_of).0c1c2 annotationss r z6ExecutedParamName.matches_signature..)sqII + E E G GII((,,IIIIIIIrzparam compare %s: %s <=> %sBLUE)color) r$r, py__class__get_kindrVAR_POSITIONAL VAR_KEYWORDinfer_annotationanyrdbg)r%argument_valuesmatchesr6s @rmatches_signaturez#ExecutedParamName.matches_signatures   4**,,2244 ==??y79NO O O4++u+EE  4IIII /IIIII  /?Kv G G G Grc2d|jjd|jdS)N)r)__name__ string_namer-s r__repr__zExecutedParamName.__repr__0s#!^444d6F6F6FGGr)F)rG __module__ __qualname__r!r,rCrI __classcell__)r)s@rrrsq&&&&&& ((($HHHHHHHrrc > fd}gg}i}|j|}D]}|||jj<t tt}td}i} d} d} D]}d} t|d\} }| d} || }| | vr]d} djd| d } D]7} tj|jd |j| 8n+t#|||| | <n#t$$r||| <YnwxYwt|d\} }| | | |jj#t$$rYnwxYw|jd kr{g}|M| ||D]5\} }| r|| |fn| |6t+j|j|}t1|}n|jd krF| ||t+j|jt5|}t1|}i}n||jzt9}| si D]T}t;t=} tj|jd|j| Unt?||j}d} n|}| t#|||| tA|t8s|d| |jj<| rtC|tC| z D]}||}|sy| sw|jsp|jsi D]T}t;t=} tj|jd|j| U|"D]8\} }djd| d } tGd|| 9t |}|r|d\}}|||fS)a Return a tuple of: - a list of `ExecutedParamName`s corresponding to the arguments of the function execution `function_value`, containing the inferred value of those arguments (whether explicit or default) - a list of the issues encountered while building that list For example, given: ``` def foo(a, b, c=None, d='d'): ... foo(42, c='c') ``` Then for the execution of `foo`, this will return a tuple containing: - a list with entries for each parameter a, b, c & d; the entries for a, c, & d will have their values (42, 'c' and 'd' respectively) included. - a list with a single entry about the lack of a value for `b` c tt}r't d||dSdt jd|dS)Nztype-error-too-many-argumentsrznon-public warning: %s)_error_argument_countlenget_calling_nodesappendrrwarning)rmrfuncdefissues unpacked_vas r too_many_argsz:get_executed_param_names_and_issues..too_many_argsHs !'3{+;+; < <  & & ( ( 7 MM#3      MM$    M2A 6 6 6 6 6rcgSr+r[rrz5get_executed_param_names_and_issues..gsBrF)NNNT TypeError: z-() got multiple values for keyword argument 'z'.ztype-error-multiple-valuesrOztype-error-too-few-arguments)r(z'() got an unexpected keyword argument 'ztype-error-keyword-argumentr)$ tree_nodeget_default_param_context get_paramsr"valuelistunpackriterrnextrRrSrrrrrKeyError star_count push_backr FakeTupleinference_staterFakeDictdictdefaultr rPrQr rsetitemsr)r&rrY result_params param_dictdefault_param_contextparamvar_arg_iteratornon_matching_keys keys_used keys_onlyhad_multiple_value_errorr(keyr key_paramrUcontextualized_nodelazy_value_listseq result_argdctkrremaining_arguments first_keyrVrWrXs ` @@@r#get_executed_param_names_and_issuesr4s(77777777"FMJ&G+DDFF##%%--', 5:#$$y''0011K'[(9(9::#JJ//II$##%%R<R<  -|<< XoI H&sO )##/3,,#LLL###/A/8/J/J/L/L+ $L)<)D)E)<)A1NNN&7& 9h&H&HIcNN 2 2 2)1!#&&& 2 !!1<@@MC)o,   5:+;!< = = =     D   q  O#&&x000%555MC(22C?CCC#**84444$^%C_UUC',,JJ   " "# h'''#N$BDIZD[D[\\C',,J "  =(!1!3!3J$ 3<3N3N3P3P  / 5gs;?O?O P PA"MM ( $7$?$B$7$<,- !"!"!""//Dem!T!TJ!%JJ% . IujZ      *&677 <*7*;Iej& 'Z3y>>1  AqME% )A ' +0= ,5+F+F+H+H'-gs;7G7GHHAMM %8%@%C%8%=qJJJ -2244   ZZ|||SSS " -       /00" 3A 6 : j!!! &  s$EE*)E*%F)) F65F6c.t||dS)a| Return a list of `ExecutedParamName`s corresponding to the arguments of the function execution `function_value`, containing the inferred value of those arguments (whether explicit or default). Any issues building this list (for example required arguments which are missing in the invocation) are ignored. For example, given: ``` def foo(a, b, c=None, d='d'): ... foo(42, c='c') ``` Then for the execution of `foo`, this will return a list containing entries for each parameter a, b, c & d; the entries for a, c, & d will have their values (42, 'c' and 'd' respectively) included. r)r)r&rs rget_executed_param_namesrs$ /~y I I! LLrc|}td|D}|dkrd}ndt||z z}d|jd|t|d|dS) Nc36K|]}|js|jdVdS)r^N)rprj)r3ps rr7z(_error_argument_count..s0KK!KalKAKKKKKKrrzexactly z from %s to r]z () takes z arguments (z given).)rcsumrQr")rV actual_countparamsdefault_argumentsbefores rrPrPs    ! !FKKvKKKKKA#f++0A"AB|||VVS[[[[,,, @ArN) collectionsrinspectrjedirjedi.inference.utilsrjedi.inferencerjedi.inference.lazy_valuerr r jedi.inference.valuer jedi.inference.namesr rrrrrPr[rrrs<######111111######$$$$$$$$$$))))))******KKKHHHHH HHH>l!l!l!^MMM* A A A A Ar