j7iN dZddlmZddlZddlmZddlmZddlmZddlm Z ddlm Z ddl Z ddl Z ddl ZddlZddlZddlZddlZddlZddlZdd lmZdd lmZddlZddlZddlZddlZdd lmZdd lmZej>d k\rddl m!Z!nddl m!Z!ej>dkrddl"m#Z#nddl$m#Z#ddl%m&Z&ddl%m'Z'ddl%m(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl3m5Z5ddl6m7Z7ddl8m9Z:erddl+m;Z;GddZ<e7d Z=ej|j~d!e*Z@d"d#xsd$zZAd%e@zeAzZBe<ZCGd&d'ejjejjZG dYd(ZH dZd)ZId[d*ZJd+f d\d,ZK d] d^d-ZLd_d.ZMd`d/ZNd_d0ZOdad1ZPdbd2ZQ dcd3ZRddd4ZSded5ZTejd6ejd7ejd8ejd9iZYiejd:ejd;ejd<ejd=ejd>ejd?ejd@ejdAejdBejdCejdDejdEejdFejdGejdHejdIejdJejdKejdLejdMejdNejdOejdPiZqdfdQZre jdRSdgdTZtGdUdVejZvdhdWZwdidXZxy)jz5Rewrite assertion AST to produce nice error messages.) annotationsN) defaultdict)Callable)Iterable)Iterator)Sequence)Path)PurePath)IO) TYPE_CHECKING) )TraversableResources)r ) FileReader)DEFAULT_REPR_MAX_SIZE)saferepr)saferepr_unlimited)version)util)Config)FixtureFunctionDefinition)Session) absolutepath) fnmatch_ex)StashKey)format_explanation)AssertionStatec eZdZy)SentinelN)__name__ __module__ __qualname__b/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.pyr r =sr%r rz-pytest-.pyco.ceZdZdZddZddZejjjZ d ddZ ddZ ddZ ddZ dd Zdd Zdd Zdd Zdd ZddZy)AssertionRewritingHookz1PEP302/PEP451 import hook which rewrites asserts.c||_ |jd|_d|_i|_t |_d|_dh|_ i|_ d|_ y#t$r ddg|_YOwxYw)N python_filesz test_*.pyz *_test.pyFconftest) configgetinifnpats ValueErrorsession_rewritten_namesset _must_rewrite _writing_pyc_basenames_to_check_rewrite_marked_for_rewrite_cache_session_paths_checked)selfr0s r&__init__zAssertionRewritingHook.__init__Osz  5 --7DK(, 13'*u",6<(:<&&+# 5& 4DK 5sAA/.A/c ||_d|_y)NF)r4r;)r<r4s r& set_sessionz"AssertionRewritingHook.set_session_s &+#r%Nc|jry|jjt}|j ||ry|j d||j ||}|-|+|D]&}tjj||}|&n|c|jWt|jtjjr)tj j#|jsy|j}|j%|||sytjj||||j&S)Nzfind_module called for: )loadersubmodule_search_locations)r8r0stashassertstate_key_early_rewrite_bailouttrace _find_spec importlibrspec_from_file_locationorigin isinstancerA machinerySourceFileLoaderospathexists_should_rewriterB)r<namerOtargetstatespec _path_strfns r& find_specz AssertionRewritingHook.find_specfs'    !!/2  & &tU 3 .tf56tT* +>+O+OP77>>$++.B##D"e4~~55  '+'F'F 6  r%cyNr$)r<rUs r& create_modulez$AssertionRewritingHook.create_modulesr%c|jJ|jjJt|jj}|jjt }||j |j<tj }t|}|r#t|}|sd}|jd||jddtz}||z }t|||j} | M|jd|t!||j\} } |r2d|_ t%|| | |d|_n|jd|t'| |j(y#d|_wxYw)NFzread only directory: z rewriting Tzfound cached rewritten pyc for )__spec__rJr r0rCrDr5r!sysdont_write_bytecode get_cache_dir try_makedirsrFrRPYC_TAIL _read_pyc _rewrite_testr8 _write_pycexec__dict__) r<modulerWrTwrite cache_dirok cache_namepycco source_stats r& exec_modulez"AssertionRewritingHook.exec_modulesY***%%111 &//(( ) !!/213foo.+++!"% i(B 3I;?@WWSb\H, *$r3 , : KK*RF+ ,+B  ? R!).D%s (E)) E2c|j|jsd|_|jjD]h}t|j t j }|jjt jj|ddj|j d}|d|jvryt|jd}|jD]1}t jj|ryt||s1y|j!||ry|j#d|y)a'A fast way to get out of rewriting modules. Profiling has shown that the call to PathFinder.find_spec (inside of the find_spec from this class) is a major slowdown, so, this method tries to filter what we're sure won't be rewritten before getting to it. Trr*Fr'z early skip of rewriting module: )r4r; _initialpathsstrsplitrNsepr9addrOsplitextr with_suffixr2dirnamer_is_marked_for_rewriterF)r<rRrT initial_pathpartsrOpats r&rEz-AssertionRewritingHook._early_rewrite_bailouts << #D,G,G*.D ' $ : : U L)//70044RWW5E5EeBi5PQR5ST  U 3 988 8++E2;; Cwws##t$    & &tU 3 6tf=>r%ctjj|dk(r|jd|y|j9|jj t |r|jd|yt|}|jD]$}t||s|jd|y|j||S)Nz conftest.pyzrewriting conftest file: Tz.matched test file (was specified on cmdline): zmatched test file ) rNrObasenamerFr4 isinitpathrr r2rr|)r<rRrWrTfn_pathrs r&rQz&AssertionRewritingHook._should_rewrites 77  B = 0 KK3B6: ; << #||&&|B'78 LRFST2,;; C#w' 078  **477r%c  |j|S#t$rf|jD]E}||k(s|j|dzs|j d|d|dd|j|<Yyd|j|<YywxYw)Nr*zmatched marked file z (from )TF)r:KeyErrorr7 startswithrF)r<rRrTmarkeds r&r|z-AssertionRewritingHook._is_marked_for_rewrites 11$7 7 ,, 6>T__Vc\%BKK"6thgfZq QR;?D2248  49D * *4 0 s1B(B-B?Bct|jtjj |j }|D]j}tj|}t j|jxsdr:t|jt|rZ|j|l|jj||jj!y)zMark import names as needing to be rewritten. The named module or package as well as any nested modules will be rewritten on import. N)r6 intersectionr_modules differencer5AssertionRewriteris_rewrite_disabled__doc__rK __loader__type_warn_already_importedr7updater:clear)r<namesalready_importedrRmods r& mark_rewritez#AssertionRewritingHook.mark_rewrites J # #CKK 0 ; ;Drlsr%c t|d}|5 tj|}t |j }|j }|jd}t|dk7r|d|d dddy|ddtjjk7r|d|d dddy|dd d k7r|d|d  dddy|d d } tj| d |dzk7r|d|d dddy|d d} tj| d |dzk7r|d|d dddy tj|} t!| t"j$s|d|d dddy| cdddS#t$rYywxYw#t$r }|d|d|Yd}~dddyd}~wwxYw#t$r }|d|d|Yd}~dddyd}~wwxYw#1swYyxYw)zsPossibly read a pytest pyc containing rewritten code. Return rewritten code if successful or None if not. rNz _read_pyc(z ): OSError z): invalid pyc (too short)z!): invalid pyc (bad magic number)rz"): invalid pyc (unsupported flags)rlittlerz): out of datez): invalid pyc (incorrect size)z): marshal.load error z): not a code object)rrrNrrrrrlenrHrr from_bytesrload ExceptionrKrCodeType) rrnrFr stat_resultrrdatar mtime_data size_dataros r&rdrdksM #t_ # ''&/K ,,-E&&D772;D t9  Jvh&@A B## 8y~~22 2 Jvh&GH I## !9+ + Jvh&HI J%##&!BZ >>*h /5:3E E Jvhn5 6-##.BK >>)X .$2C C Jvh&EF G5##6 b!B"enn- Jvh&:; <E##FG##   Jvhk!5 6##  .  Jvh&>r%c~|d}n|jtj}|dk\ry|dk\r tdzStS)zJGet `maxsize` configuration for saferepr based on the given config object.Nr ) get_verbosityrVERBOSITY_ASSERTIONSr)r0 verbositys r&rrsD ~ (()D)DE A~A~$r))  r%cddg}t|ts4t|ttj }|j d|D]\}}|j||}|S)zFormat the custom assertion message given. For strings this simply replaces newlines with '\n~' so that util.format_explanation() will preserve them instead of escaping newlines. For other objects saferepr() is used first. )r ~)%%%)rr)rKrurrrrappendr)rreplacesr1r2s r&_format_assertmsgrsd{+H c3 s5dllCD'"Bkk"b!" Jr%crt|rt|tS t|d S#t$rYywxYw)Nr!T)callablerKrhasattrr)rs r&_should_repr_global_namer s>}#8993 +++ s * 66cdd|xrdxsdj|zdz}|jddS)N(z or z and rrr)joinr) explanationsis_or explanations r&_format_booloprs9%*F6w<<\JJSPK   sD ))r%cttt|||dD]\}}} | }|sntj 't j |||||dz}||SS#t$rd}YLwxYw)NTstrictr)ziprangerrr _reprcompare) opsresultsexplseach_objiresexpldonecustoms r&_call_reprcomparer s E#c(OWeDI 3 7D    $""3q68A;QH  M K D sA,, A:9A:cTtjtj|||yyrZr_assertion_pass)linenoorigrs r&_call_assertion_passr&s% ' VT40(r%c*tjrdSdS)zCheck if any plugins implement the pytest_assertion_pass hook in order not to generate explanation unnecessarily (might be expensive).TFr"r$r%r&_check_if_assertion_pass_implr(s''42U2r%znot %sz~%sz-%sz+%s|^&z<>+-*/z//rz==z!=z>=**iszis notinznot in@c#rK|tj|D]}t|Ed{y7w)zARecursively yield node and all its children in depth-first order.N)riter_child_nodes traverse_node)nodechilds r&r8r8)s6 J%%d+( '''('s +757rrc i d g d td fd }tjtj|j}|D]g\}}\}}}}|tj k(r|dk(r| ( +|tj k(r |dvr dz n|tj k(r |dvr dz s& j||dj| dk(r|tj k(rm|dk(rh|vr7t dk(r)|t d zt|z } d d|  d <n$|vr d d| d <n j|d|||tjtjhvr |< s@|vsF j|j|j S) z._write_and_reset:sK(((WWU^224;;DAM U r%assertz([{rz)]},rsrr) r6tokenizeioBytesIOreadlineNAMEOPrrxrNEWLINE ENDMARKER)srcrDtokenstprr$offset_lineoffset_in_trimmedr?r@rArBrCs @@@@@r&_get_assertion_exprsrW0sC EE $M5J  rzz#77 8F17'-F$VVa  6X#5"M  &X[[ Vu_ x{{"v  T&']+v&!hkk 1fmZ'CJ!O(.U2Y(?#d)(K% %b *<+< =E"Iz) %b '6 2E"ILLgv/ "(((*<*<== "63 T"v&='@ Jr%ceZdZdZ dfd ZddZeddZddZddZ ddZ ddZ dd Z d d Z d!d Zd"d Zd#d Zd$dZd%dZd&dZd'dZd(dZd)dZd*dZd+dZd,dZd-dZxZS).ra Assertion rewriting implementation. The main entrypoint is to call .run() with an ast.Module instance, this will then find all the assert statements and rewrite them to provide intermediate values and a detailed assertion error. See http://pybites.blogspot.be/2011/07/behind-scenes-of-pytests-new-assertion.html for an overview of how this works. The entry point here is .run() which will iterate over all the statements in an ast.Module and for each ast.Assert statement it finds call .visit() with it. Then .visit_Assert() takes over and is responsible for creating new ast statements to replace the original assert statement: it rewrites the test of an assertion to provide intermediate values and replace it with an if statement which raises an assertion error with a detailed explanation in case the expression is false and calls pytest_assertion_pass hook if expression is true. For this .visit_Assert() uses the visitor pattern to visit all the AST nodes of the ast.Assert.test field, each visit call returning an AST node and the corresponding explanation string. During this state is kept in several instance attributes: :statements: All the AST statements which will replace the assert statement. :variables: This is populated by .variable() with each variable used by the statements so that they can all be set to None at the end of the statements. :variable_counter: Counter to create new unique variables needed by statements. Variables are created using .variable() and have the form of "@py_assert0". :expl_stmts: The AST statements which will be executed to get data from the assertion. This is the code which will construct the detailed assertion message that is used in the AssertionError or for the pytest_assertion_pass hook. :explanation_specifiers: A dict filled by .explanation_param() with %-formatting placeholders and their corresponding expressions to use in the building of an assertion message. This is used by .pop_format_context() to build a message. :stack: A stack of the explanation_specifiers dicts maintained by .push_format_context() and .pop_format_context() which allows to build another %-formatted string while already building one. :scope: A tuple containing the current scope used for variables_overwrite. :variables_overwrite: A dict filled with references to variables that change value within an assert. This happens when a variable is reassigned with the walrus operator This state, except the variables_overwrite, is reset on every new assert statement visited and used by the other visitors. ct|||_||_||j d|_nd|_||_d|_tt|_ y)Nenable_assertion_pass_hookFr$) superr=rr0r1rZrscoperdictvariables_overwrite)r<rr0r __class__s r&r=zAssertionRewriter.__init__sa &  .4mm,/D +/4D + *,    r%c|jsyt|dd}|du}||j|ryd}|jD]}}|xtjdx>\tj dx)\xt dx\}|r|j|ryd}n$tjdx \dk(rdk(rn n|d z }ttjr&|jr|jdj}n |j}tjd d |d tjd d|d g}|Dcgc]}tj|g|d } }| |j|||f|_|g} | r| j} t| tjtj ztj"zr4t%g|j| |_| j't(| t(k(r|jdd|_t| tj*sJtj,| D]\} } t| t.rg}t1| D]}\}}t|tj2r!|j5|j7|A|j'|t|tj*sm| j'|t9| | |t| tj*st| tj:r| j'| | ryycc}w)z5Find all assert statements in *mod* and rewrite them.N docstringr)valuer$F)levelri __future__rbuiltins @py_builtins)r$ col_offsetz_pytest.assertion.rewrite @pytest_arrs)bodygetattrrrExprConstantru ImportFromrK FunctionDefdecorator_listr$aliasImportr\popAsyncFunctionDefClassDeftupler_SCOPE_END_MARKERAST iter_fieldslist enumerateAssertextendvisitsetattrexpr)r<rdocexpect_docstringpositemr$aliasesrpimportsnodesr9rRfieldnewrr:s r&rzAssertionRewriter.runsxx c;-$; ?t77< HH DESXXECLL$D|suE$F//4',$ F ^^A!LB 1HC  dCOO ,1D1D((+22F[[F IIj.A N II+   KR AFCJJwv! <  $SV +.%99;D$#2F2F F UV"#6TZZ#6#67  ./((!ZZ_ dCGG, ,,"t4 ( eeT*)+C$-e$445%eSZZ8JJtzz%'89JJu-)%9 % U 34D$,ucgg.'uchh7LL'% ( s Mc d|vS)NPYTEST_DONT_REWRITEr$)ras r&rz%AssertionRewriter.is_rewrite_disableds $ 11r%c~dtt|jz}|jj ||S)zGet a new variable.z @py_assert)runextvariable_counter variablesrrs r&variablezAssertionRewriter.variables5c$t'<'<"=>> d# r%c F|j}|jjtjtj |tj g|tjtj |tj|S)zGive *expr* a name.) r statementsrrAssignNameStore copy_locationLoad)r<rrRs r&assignzAssertionRewriter.assignsb}} szz388D#))++F*GNO  $ !;TBBr%c&|jd|S)z Call saferepr on the expression.r)helper)r<rs r&displayzAssertionRewriter.displays{{;--r%ctjdtj}tj||tj}tj|t |gS)zCall a helper in this module.rh)rrr AttributeCallry)r<rRargspy_nameattrs r&rzAssertionRewriter.helpersG((<4}}WdCHHJ7xxd4j"--r%ctjdtj}tj||tjS)z!Return the builtin called *name*.rf)rrrr)r<rR builtin_names r&builtinzAssertionRewriter.builtins1xx ; }}\4<3tD$9$9:;; 15##I.i$&&r%c\i|_|jj|jy)aCreate a new formatting context. The format context is used for when an explanation wants to have a variable value formatted in the assertion message. In this case the value required can be added using .explanation_param(). Finally .pop_format_context() is used to format a string of %-formatted values as added by .explanation_param(). N)rstackr)r<s r&push_format_contextz%AssertionRewriter.push_format_context/s$<># $556r%c |jj}|jr|jd|_|jDcgc]}t j |}}t j |t|j}t j|t j|}dtt|jz}|jr|jj!||j"j!t j$t j&|t j(g|t j&|t j*Scc}w)aZFormat the %-formatted string with current format context. The expl_expr should be an str ast.expr instance constructed from the %-placeholders created by .explanation_param(). This will add the required code to format said string to .expl_stmts and return the ast.Name instance of the formatted string. rsz @py_format)rrrrkeysrrlDictryvaluesBinOpModrurrrZformat_variablesr expl_stmtsrrrr)r< expl_exprcurrentkeyr format_dictformrRs r&pop_format_contextz$AssertionRewriter.pop_format_context<s**.." ::*.**R.D 'DKLLN&SSs||C'8&S&ShhtT'..*:%;< yyCGGI{;c$t'<'<"=>>  * *  ! ! ( ( . szz388D#))++F*GNOxxchhj))'Ts Fct|tjsJ|j|}||j |j |fS)z1Handle expressions we don't have custom code for.)rKrrrrr)r<r9rs r& generic_visitzAssertionRewriter.generic_visitPsC$)))kk$D**4<<+<===r%c  t|jtjrit |jj dk\rGddl}ddlm}|jJ|j|dd|j|jg|_ g|_ tj|_|j"rg|_g|_g|_|j+|j-|j\}}tj.tj0|}|j"r|j3tj4|}|j6r|j9d|j6}d} ntj4d }d } tj:tj4| tj<|} tj:|tj<| } tj>d tj@} |j9d | } tjB| | gg}tjD|d}g}|jG|j(|jI||j9d |}tK|jL|j}tjN|j9d tj4|jtj4||}tjP|j9dg|j(|g}|g}tjP|||}|jjI||j$r|j$Dcgc]*}tj>|tjR,}}tjT|tj4d}|jjI|nJ|j(}|jjItjP||g|j6r"|j9d|j6}d|z}ntj4d }d |z}tj:|tj<tj4|}|j3|}|j9d |} tj>d tj@} tjB| | gg}tjD|d}|jI||jr|jDcgc]*}tj>|tjR,}}tjT|tj4d}|jjI||jD]6}tW|D]&}tY|ddtjZ||(8|jScc}wcc}w)a.Return the AST statements to replace the ast.Assert instance. This rewrites the test of an assertion to provide intermediate values and replace it with an if statement which raises an assertion error with a detailed explanation in case the expression is false. rrNrz5assertion is always true, perhaps remove parentheses?)categoryrr$rz >assert rzassert AssertionError_format_explanationr&r(r$).rKtestrTuplereltswarningsrrr warn_explicitr$rr itertoolscountrrZrrrrr}UnaryOpNotrrlmsgrrAddrrrRaiser|rrWrrkIfrrr8rjr)r<assert_rr top_conditionrnegationr assertmsggluestrerr_explanationerr_msgerr_namefmtexcraise_statements_failfmt_passr%hook_call_passhook_impl_teststatements_pass main_testrRr clear_formatritemplaterstmtr9s r& visit_AssertzAssertionRewriter.visit_AssertVs gllCII .3w||7H7H3IQ3N  H##/ //  " "*K))~~ # +-$& ) 1  * */1D !02 *,   "%)ZZ %=" {;;swwy-8  * *))#,,{*CDC{{ KK(;W[[I &LL, #!ii W(=swwy#NOii 3779oFGxx 0#((*=H++3W=C((8cUB/CYYsD)F O  " "4?? 3  " "6 *{{#8#>H' 4W^^DD XX *LL0LL& N!VV ;<2$//2>2N 0>.>Ox/JI OO " "9 -$$<@{{ KK(;W[[I *[8 LL, '+5 yyCGGIs||K7PQH))(3C++3S9Cxx 0#((*=H((8cUB/CYYsD)F KK  >>AEP$ 4PIPJJy#,,t*<=E OO " "5 )OO 5D%d+ 54408%%dG4  5 5 K-6Qs )/Y /Yctj|jdgg}|jj}tj tj |tjg|g}|jd|}tjtj||g}tj||j|tj |}||j|fSNlocalsr )rrrrSidComparerlInrBoolOpOrIfExprr)r<rRlocs target_idinlocsdoreprrrs r&visit_NamedExprz!AssertionRewriter.visit_NamedExprsxx X.B7KKNN S\\)4svvxj4&I7>zz#&&(VV$45yyt||D13<< 3JKT++D111r%ctj|jdgg}tjtj|j tj g|g}|jd|}tjtj||g}tj||j|tj|j }||j|fSr) rrrrrlrrrrrrrr)r<rRrrrrrs r& visit_NamezAssertionRewriter.visit_Namesxx X.B7S\\$''2SVVXJG7>zz#&&(VV$45yyt||D13<<3HIT++D111r%c |j}|jtjgtj}tj |dtj}t t|jtj}|jx}}|j}t|jdz } |jt|jD]T\} } | rg} |jj!tj" | g| |_ | tj$dx\tj&dx\tj(dx\}||jd| Dcgc]}t+|ds|j,c}vrS|j}| j.|j0|j2|<|| j.j4_n|j|j7| \}}|j!tj8tj(|tj:g||j=tj>|}tj@||gg}|jj!tjB|| | ks|} |r(tjDtjF| } g}|jj!tj"| |g|x|_ }W||_ ||_ |jId|tj>|}|j=|}tj(|tj|jK|fScc}w)Nrr)leftrSrrr)&rrrListrrrrKoprrrrrrrzrrr NamedExprrrrrr^r\rSr}rrrrlrrkrrrr)r<boolopres_var expl_listapprrisave fail_savelevelsrv fail_innercondrr pytest_temprr expl_formatcallinner expl_templates r& visit_BoolOpzAssertionRewriter.visit_BoolOps--/KKSXXZ 89 mmIx<Jvyy#&&12oo%tOO V]]#a'   "fmm, /DAq-/ &&svvdJ'CD", ]]I#((2H"&,mmBQ&7'!"71d;K''+mmo JK&&00 26z!$;;swwy$7D(*&&svvdE2'>?)..$; /<# $4ieATU &&}5xx,d.D.DT.JJJ1's O O ct|jj}|j|j\}}|j t jt j|j||}|||fzfSrZ) UNARY_MAPrr_r}operandrrrr)r<unarypattern operand_res operand_explrs r& visit_UnaryOpzAssertionRewriter.visit_UnaryOpsjEHH../$(JJu}}$=! \kk#++CKK+,NPUVWG|o---r%c \t|jj}|j|j\}}|j|j \}}d|d|d|d}|j tjtj||j||}||fS)Nr  r) BINOP_MAPrr_r}rrightrrrr) r<binopsymbol left_expr left_expl right_expr right_explrrs r& visit_BinOpzAssertionRewriter.visit_BinOps588--.#zz%**5 9!%EKK!8 J)AfXQzl!< kk   cii 588ZH% P Kr%c|j|j\}}g}g}g}|jD]}t|tj rX|j |jj|jivr&|j|j|j }|j|\}} |j| |j||jD]} | jtj dxM\} | |jj|jivr#|j|j| | _ n|j| j\}} |jt j| j|| jr"|j| jdz| z|jd| zdj|dj!|} t j"t j$||||} |j'| }|j)|j+|} | d| d| d}||fS) Nr=r2z{}({})z, z {z = z })r}funcrrKrrrr^getr\rkeywordsrbkeywordargformatr rrrrr)r<rnew_func func_expl arg_explsnew_args new_kwargsr"rrr!rnew_callres_expl outer_expls r& visit_CallzAssertionRewriter.visit_Call#s"jj3)  99 !C#sxx(SVVt7O7O7S7S B8...tzz:366B 3IC   T " OOC  !}} .G--XX_d.F.F.J.JJJ/)%)$<$?$$SXXh*%MtTkk(#))$,,s*;< zhZs4&= Jr%c|j|j\}}tj||j}|d|zfS)Nr.)r}rbrStarredctx)r<starredrr new_starreds r& visit_StarredzAssertionRewriter.visit_StarredDs;JJw}}- Tkk#w{{3 C$J&&r%c t|jtjs|j |S|j |j \}}|jtjtj||jtj|}|j|j|}d}|||||jfz}||fS)Nz%s {%s = %s.%s }) rKr/rrrr}rbrrrrrr)r<rrb value_explrr*rrs r&visit_Attributez!AssertionRewriter.visit_AttributeJs$((CHH-%%d+ + JJtzz2zkk   cmmE499chhjI4 P ))$,,s*;<"h*dii@@Dyr%c  |j|jxtjdxN\}||jj |j ivr$|j|j ||_nTtjdx?\tjdx*\}|j|j|j |<n|j|j\}}t|jtjtjzrd|d}tt|jDcgc]}|j}}|Dcgc]*}tj|tj ,} }|Dcgc]*}tj|tj",} }t%tt|j|j|j&d} g} g} |g}| D]\}}}||f rdk(r\tjdxp\tjdx[\ctjdxE\}}||k(r>|j|j(_||j|j |<n|j|\}}t|tjtjzrd|d}|j-|t.|j0}| j-tj2||d|d|}| j-tj2|tj4tj||g|g|}|j6j-tj8| |g|||}}|j;d tj<| tj tj<| tj tj<| tj tj<|tj }t|jd kDr)tjtj>| }n| d }||jA|jC|fScc}wcc}wcc}w) Nrrr rTrrrr rr)"rrrrr^rr\rr}rKrrrrrrrrr comparatorsrSrrrr_rlrrrrrAndrr)r<compname_idrleft_resrr res_variablesr load_names store_namesitrsymsrr next_operandnext_res next_explsymrres_expr expl_callrs r& visit_ComparezAssertionRewriter.visit_CompareVs   "ii%%D4L4L4P4P B5*%!44TZZ@I &=chh&<=BF))((4Y?>"jj3) diiszz!9 :I;a(I27DHH 2FGQG GGT%U!chhq#((*&=%U %U9FGAsxx399;/G G s488}%txx1A1A$ O "!*#% 6 Ar<*MM@)?YHH(')-1]]_L''*DPD,,TZZ8A #'**\": Hi, cjj(@A {!, NN8 $BLL)C KK S) *[#a {3D LLd+ ,((XthZ)PRVWH OO " "3::{1~.>#I J"*IiH' 6*KK  IIdCHHJ ' IIj#((* - IIeSXXZ ( IIgsxxz *   txx=1 JJswwy*=CQ-CD**4+B+B9+MNNNQH%UGs S&(/S+/S0)r str | Noner0 Config | Nonerrrr)r ast.Modulerr)rarurr)rru)rast.exprrast.Name)rrKrrK)rRrurrKrrK)rRrur ast.Attribute)rrKrrurG)rrKrrL)r9ast.ASTrtuple[ast.Name, str])rz ast.Assertrzlist[ast.stmt])rRz ast.NamedExprrztuple[ast.NamedExpr, str])rRrLrrO)rz ast.BoolOprrO)r z ast.UnaryOprrO)rz ast.BinOprrO)rzast.CallrrO)r0z ast.Starredrztuple[ast.Starred, str])rrMrrO)r9z ast.Comparerztuple[ast.expr, str])r!r"r#rr=r staticmethodrrrrrrrrrrrrrrrrr,r2r5rG __classcell__)r_s@r&rrgs8t % /< FK  $M(^22C .. = ' 7*(> wr 22,K\.  B' 5Or%rc tj|dy#tttf$rYyt $rYyt $r7}|jtjtjhvrYd}~yd}~wwxYw)z~Attempt to create the given directory and sub-directories exist. Returns True if successful or if it already exists. T)exist_okFN) rNmakedirsFileNotFoundErrorNotADirectoryErrorFileExistsErrorPermissionErrorrrEROFSENOSYS)rkrs r&rbrbsm  I-  1? C   77u{{ELL1 1 s%A9A9A9,A43A44A9ctjr/ttjt|jddz S|jdz S)zKReturn the cache directory to write .pyc files for the given .py file path.rrs __pycache__)r_pycache_prefixr r~parent) file_paths r&rarasF  C&&'$ "0E*FFF-//r%)rz IO[bytes]rpos.stat_resultrotypes.CodeTyperr) rTrrorarpr`rnr rr)rWr r0rrz%tuple[os.stat_result, types.CodeType])rr rnr rFzCallable[[str], None]rztypes.CodeType | Noner) rrJrrrrHr0rIrr)robjectrru)r0rIrz int | None)rrbrr)r z Iterable[str]rrrru) r Sequence[str]rzSequence[bool]rrcrzSequence[object]rru)r$rr%rurrurr)rr)r9rNrzIterator[ast.AST])rPrrzdict[int, str])rkr rr)r_r rr )yrrdrr collectionsrcollections.abcrrrrr functools importlib.abcrHimportlib.machineryimportlib.utilrIrrrNpathlibr r rr_rHrtypingr r version_infoimportlib.resources.abcrimportlib.readersrimportlib.resources.readers_pytest._io.safereprrrr_pytest._versionr_pytest.assertionr_pytest.configr_pytest.fixturesr _pytest.mainr_pytest.pathlibrr _pytest.stashr_pytest.assertion.utilrrrr rDimplementation cache_tag PYTEST_TAGPYC_EXTrcrvabcMetaPathFinderLoaderr,rrfrerdrrrrr rr r&r(rInvertUSubUAddr BitOrBitXorBitAndLShiftRShiftrSubMultDivFloorDivrEqNotEqLtLtEGtGtEPowIsIsNotrNotInMatMultrr8 lru_cacherW NodeVisitorrrbrar$r%r&rs ;" #$$$$      w<2g,67)3$"!6 (&"M0  -(+,."",,-XgY ? #-# .  g %JfSY]]999==;O;OfSR  . 4B   $      2=K. ..$9..h# < < <<  <  <?( !,*       (1 3 WWh E388UCHHe T  IIs JJ JJ JJ   JJ   GGS  GGS HHc GGS LL$ GGT FFD IIt FFC GGT  FFC! "GGT# $GGTFFDIIxFFDIIxKK/  6(Q3 3ldOdON2 0r%