TL ic(ddlZddlmZddlmZddlmZddlmZddl m Z m Z ddl m Z ddlmZmZdd lmZgd Zd Zd Zd ZdZdZdZdZdeeefdZeddZdZGdde Zy)N)List)Path)search_ancestor)inference_state_method_cache) goto_importload_module_from_path)ParserTreeFilter) NO_VALUESValueSet)infer_call_of_leaf))_pytest monkeypatch)r capture)r logging)r tmpdir)r pytestercfd}|S)Nc|jdk(r#|jjdk(rtS||S)Nfixturez_pytest.fixtures) py__name__parent_contextr )value argumentscallbacks Y/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/jedi/plugins/pytest.pywrapperzexecute..wrappersA     *((3359KK y)))rrs` rexecuters* Nrcdfd}|S)Nc.|jj@|j}td|Drt j d|DS|S|j }|jr|jS|jS)Nc3ZK|]#}|jjddk(%yw)Tinclude_module_names)typing GeneratorN)nameget_qualified_names.0vs r z=infer_anonymous_param..get_returns..%s2$66--4-H-.$)+c3ZK|]#}|jdj%yw)__next__N)py__getattribute__execute_annotationr)s rr,z=infer_anonymous_param..get_returns..(s,*((4GGI*r-) tree_node annotationexecute_with_valuesanyr from_sets as_context is_generatormerge_yield_valuesget_return_values)rresultfunction_contexts r get_returnsz*infer_anonymous_param..get_returns"s ?? % % 1..0F$"$$ ))*#*M !++-  ( ( *#668 8#557 7rc|jr|St|\}}|rH|j}t||j|}|rt j fd|DS|S)Nskip_own_modulec3XK|]!}|jD] }|#ywN)infer)r*rrr=s rr,z9infer_anonymous_param..wrapper..Gs9*!(* &*&*s'*)annotation_node _is_a_pytest_param_and_inheritedget_root_context_goto_pytest_fixture string_namer r6) param_nameis_pytest_paramparam_name_is_function_namemodulefixturesfuncr=s rrz&infer_anonymous_param..wrapper7s  % % # # ,Z 8 54 002F+&&!< H))*#+* Jrr)rNrr=s` @rinfer_anonymous_paramrO!s8* , Nrcfd}|S)Nct|\}}|r*t|j|j|}|r|S|SNr?)rErGrFrH)rIrJrKnamesrNs rrz%goto_anonymous_param..wrapperQsO ,Z 8 54 (++-&& ;E  JrrrNrs` rgoto_anonymous_paramrUPs   Nrcfd}|S)Nc|j}t||r2g}t|D]}|t|j z } |r|S|||SrB)rF_is_pytest_func_iter_pytest_modules FixtureFiltervalues)context func_namedecorator_nodesmodule_contextrSrNs rrz%complete_param_names..wrapperase 113 9o 6E"6~"F @~6==?? @ GY88rrrTs` rcomplete_param_namesr``s9 Nrcht||D]"}t|j|}|s |cSyrR)rYrZget)r_r'r@rSs rrGrGms5.~_n-11$7 Lrct|jd}|y|j}t|jj ||jj |j k(fS)z Pytest params are either in a `test_*` function or have a pytest fixture with the decorator @pytest.fixture. This is a heuristic and will work in most cases. funcdef)FF)r tree_nameget_decoratorsrXr'rrH)rIrd decoratorss rrErEtsbj22I>G'')J 7<<--z : j444 55rcL|jdxstd|DS)Ntestc3@K|]}d|jvyw)rN)get_code)r*ns rr,z"_is_pytest_func..sBQyAJJL(Bs) startswithr5)r]r^s rrXrXs*    ' C B/B BCrreturncntjdk\rddlm}tjdk\r |d}n|j dd}tjdk\r)|Dcgc]}|j j d c}S|Dcgc]'}|jj|j)}}|Dcgc]%}|s|jd j d 'c}Sdd l m }|dDcgc]}|jj d c}Scc}wcc}wcc}wcc}w) z Finds pytest plugin modules hooked by setuptools entry points See https://docs.pytest.org/en/stable/how-to/writing_plugins.html#setuptools-entry-points )r) entry_points)rp pytest11)groupr)rp .rL)iter_entry_points)sys version_infoimportlib.metadatarrrbrLsplitpatternmatchrru pkg_resourcesrx module_name)rrpytest_entry_pointsepmatchesxrxs r_find_pytest_plugin_modulesrs   6!3   w &".Z"@ ".."4"4Z"D    v %3FGRBIIOOC(G G .   *G;BGQQAGGH%++C0G G 44EJ4WXb$$S)XXHHYs%"D#,D(D-"D->"D2c#v K|s||jj}|8|j |jj }d}t fd|Dr j d}t|j|jk7r~ t|j|}|j}||jjjd}|r(|j|d}t!||Ed{ j | j|jk(rn }t fd|Drt$t'zD]4} |jj)| D]} | j6y7#t"$rYwxYww)Nc3TK|]}jj|!ywrB)pathrm)r*pfolders rr,z'_iter_pytest_modules..s >&++((+>s%(z conftest.pypytest_pluginsr) get_valuefile_ioget_parent_folderinference_state get_sys_pathr5 get_file_iorr py__file__rr7r2get_used_namesrb create_name_load_pytest_pluginsFileNotFoundError_PYTEST_FIXTURE_MODULESr import_module) r_r@rsys_path last_foldermconftest_module plugins_listr'rS module_valuers @rrYrYs &&(00G**,!11>>@ >X>>((7GGLL!^%>%>%@@ -n.L.LgVA&'llnO))#$;;#=#=#?#C#CDT#UL#.::<?K#7#MMM--/F&6;;+:J:J+J K'>X>>*)+F+HH,*::HHO ,L))+ + ,,N(sEBF9A8F*F(F*AF9A F9(F** F63F95F66F9c#2Kddlm}|jD]z}|jD]e}|jD]P}||}|s|j d}|j j |D]}|jRg|yw)Nr)get_str_or_nonerw)jedi.inference.helpersrrC py__iter__r|rrr7) r_r'rinferred seq_valuerfq_namerSrs rrrs6JJL8!,,. 8I"* 8)%0#MM#.E(6(F(F(T(TUZ([8 *55778  8 88s A B A Bc$eZdZfdZdZxZS)rZc# Kt|D]l}|jjdk(r0t j |}t fd|DsG|Ljj |si|nyw)N import_fromc3K|]6}|jr(j|j|j8ywrB)re _is_fixturer)r*inameselfs rr,z(FixtureFilter._filter..s7$$U%9%95??Ks|j}|jdk7ry|j}|jdk7ry|jd}|jdk(r |j}n|g}|D]}|jd}d|jvs%|jdk(rE|jd }|j } | d k(rt || d } n#|j |} n|j |} | D]$} | jjd dk(s#y y)NrdF decoratedrrgr atom_expr)T)cut_own_trailerr#)r rMr) rrchildrenrk get_last_leafr infer_noder'r() rr\r'rdrrg decorator dotted_name last_trailer last_leafr[rs rrzFixtureFilter._is_fixtures.++ <<9 $NN >>[ (''* ??l *#,,J$J# $I#,,Q/KK0022##{2$/#7#7#;L , : : rs &=E395 ,^   5C YT$s)_Y<#, #,L 83$3r