L idZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z m Z ddl mZddlmZddlmZmZmZmZddlmZdd lmZdd lmZdd lmZmZdd lm Z m!Z!dd l"m#Z#ddl$m%Z%m&Z&e eZGddZ'GddZ(eddGddZ)GddeZ*e+e%e,e-ee.ee.ffZ/GddZ0Gdde0Z1Gdde0Z2Gdd e0Z3d$d!Z4Gd"d#Z5y)%zCode parsing for coverage.py.) annotationsN)IterableSequence) dataclass)CodeType)CallableOptionalProtocolcast)env) code_objects) short_stack)NoSource NotPython)isolate_module nice_pair)generate_tokens)TArcTLineNoceZdZdZ d ddZddZddZejdddZ dd Z dd Z dd Z dd Z dd ZddZddZejddZddZddZddZy) PythonParserzParse code to find executable lines, excluded lines, etc. This information is all based on static analysis: no code execution is involved. Nc|s |sJd|xsd|_|||_nddlm} ||j|_||_d|_t|_ t|_ t|_ t|_ t|_ d|_i|_d|_d|_i|_y#t$r!}t d|jd||d}~wwxYw) z Source can be provided as `text`, the text itself, or `filename`, from which the text will be read. Excluded lines are those that match `exclude`, a regex string. z*PythonParser needs either text or filenamezNr)get_python_sourcezNo source for code: 'z': F)filenametextcoverage.pythonrOSErrorrexclude _ast_rootset statementsexcludedraw_statements raw_excludedraw_docstrings show_tokens multiline_map _all_arcs_missing_arc_fragments_with_jump_fixers)selfrrrrerrs U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/coverage/parser.py__init__zPythonParser.__init__'sxM!MM ,H  !DI 9 Y-dmm<  *. ),'*e -0E+.%-0E!68,0<@#@BQ Y!6t}}oSNOUXX YsB<< C&C!!C&c t}d}d}tj|jtjD]}|j \}}|jj d||z}|jj d||z} |jfdt|dz| dzD|}|}|S)zFind the lines matching a regex. Returns a set of line numbers, the lines that contain a match for `regex`. The entire line needn't match, just a part of it. Handles multiline regex patterns. r)flags c3VK|] }jj||"ywNr'get).0ir+s r- z.PythonParser.lines_matching..vs)12""&&q!,s&)) r refinditerr MULTILINEspancountupdaterange) r+regexmatches last_startlast_start_linematchstartend start_lineend_lines ` r-lines_matchingzPythonParser.lines_matchingfs!$ [[ F )EJE3(499??4U+SSJ&z3)OOH NN6;JNHWXL6Y J(O )c J |jr:|j|j|_t|j|_d}d}d}d}d}d}|j Jt |j }|D]\}} \} } \} } } |jrBttjj||ddt| | fdd| dd| |tjk(r|d z }n|tjk(r|d z}n|tj k(rj| d k(rQ|dk(rL|jj#t%|| d z}|su|rs|jj'| |}d}nS| d vr|d z }nI| d vrE|d z}n?|tj(k(r,|r(| |k7r#t%|| d zD]}||j*|<d}| j-s^|tj.k7ssd}|ry| }|r||krd}|s|jj'| |sJt1|j |j2 }|j4j7|j9|j;|j|_|j<Jt?j@|j<D]}tC|t>jDt>jFt>jHt>jJfr|jLr|jLd}tC|t>jNrtC|jPt>jRrntC|jPjPtTrJ|jVj7t%|jXt[t\|j^d ztC|t>jDt>jFt>jHfsNtad|jbD|jX}|jj#t%||jXd zs|jj7t%|t[t\|j^d zy)zwParse the source to find the interesting facts about its lines. A handful of attributes are updated. rFTNz>10 z>520r9:z([{z)]})rc34K|]}|jywr3lineno)r6ds r-r8z*PythonParser._raw_parse..s!Hq!((!Hs)default)2rrKr$r r"rrr&printtokenizetok_namer5rtokenINDENTDEDENTOP intersectionrAaddNEWLINEr'stripCOMMENT ByteParserrr#r@_find_statements first_linesrastwalk isinstanceClassDef FunctionDefAsyncFunctionDefModulebodyExprvalueConstantstrr%rSr int end_linenomindecorator_list)r+indentexclude_indent excluding first_lineemptynestingtokgentoktypettextslineno_elinenoltextshould_excludel byte_parsernodefirsts r- _raw_parsezPythonParser._raw_parse}s << $ 3 3DLL AD  1 12DM  yy$$$ +AG0 3 =GULWa,7A!))--gw?!7G"45 %,,&! ELL(! EHH$C++22!%,,S%:J:J0Ka0OP $s@T@T UV !HD4G4G!HRVR]R]^ ==--eJ a.PQMM((z4T__;UXY;Y)Z[% \rLi)maxsizec|dkr!|jj| |  }|S|jj||}|S)zAReturn the first line number of the statement including `lineno`.rr4)r+rSs r-rxzPythonParser.first_linesP A:((,,fWvg>>F ''++FF;F rLcJ|Dchc]}|j|c}Scc}w)zMap the line numbers in `linenos` to the correct first line of the statement. Returns a set of the first lines. )rx)r+linenosrs r-rdzPythonParser.first_liness!-44q"444s c$|j|S)z)Implement `FileReporter.translate_lines`.)rd)r+liness r-translate_lineszPythonParser.translate_liness&&rLc|j|Dchc]'\}}|j||j|f)c}}Scc}}w)z(Implement `FileReporter.translate_arcs`.)fix_with_jumpsrx)r+arcsabs r-translate_arcszPythonParser.translate_arcss=GKGZGZ[_G`aVa#T__Q%78aaas,Ac tj|j|_|j |j|jz}|j |z }|j#||z |_y#t j ttf$r_}t|dr |j}n|jdd}td|jd|jdd|z|d}~wwxYw)zParse source text to find executable lines, excluded lines, etc. Sets the .excluded and .statements attributes, normalized to the first line of multi-line statements. rSr9rzCouldn't parse 'z' as Python source: z at line N)reparserrrrW TokenErrorIndentationError SyntaxErrorhasattrrSargsrrr"r%r#rdr!)r+r,rSignorestartss r- parse_sourcezPythonParser.parse_sources  YYtyy1DN OO !4!44$$v-**62V;##%5{C sH%!Q"4==/1EFXXa[O9VH56   s4A88C5AC00C5cn|j|j|jJ|jS)zGet information about the arcs available in the code. Returns a set of line number pairs. Line numbers have been normalized to the first line of multi-line statements. )r( _analyze_astr+s r-rzPythonParser.arcss4 >> !    ~~)))~~rLc|jJt|j|j|j|j}|j |j }|j|_|jr|j|}t|_ |D]J\}}|j|}|j|}||k7s.|jj||fL|j|_y)zkRun the AstArcAnalyzer and save its results. `_all_arcs` is the set of arcs in the code. N)rAstArcAnalyzerrr#r'analyzerwith_jump_fixersr*rr r(rxr^missing_arc_fragmentsr))r+aaarl1l2fl1fl2s r-rzPythonParser._analyze_ast%s ~~)))T]]DNND1 should be replaced with 3->4, and 1->4 should be removed. For this code, the fixers dict is {(3, 1): ((1, 4), (3, 4))}. The key is the actual measured arc from the end of the with block back to the start of the with-statement. The values are start_next (the with statement to the next statement after the with), and end_next (the end of the with-statement to the next statement after the with). With nested with-statements, we have to trace through a few levels to correct a longer chain of arcs. rr9)r r*r^)r+r to_removeto_addarcend0 start_nextend_nexts r-rzPythonParser.fix_with_jumps<s0E  *Cd,,,1v c"'+'='=c'B$ H D$:$::MM*-+/+A+A*+M(JMM(+!D$:$:: D(1+./ j) *D F"i/ rLctjt}|jD]L\}}|dkDsJd|d|j||j vr1||j vr@||xxdz cc<N|S)zYGet a count of exits from that each line. Excluded lines are excluded. rzl1=z should be greater than zero in r9) collections defaultdictrqrrr")r+ exit_countsrrs r-rzPythonParser.exit_countsds+6*A*A#*F iik !FB6 RcbU"B4==/R R6T]]"T]]" Oq O !rLcB| |dkrd}nd}|j|}|S)z=Apply some defaulting and formatting to an arc's description.rzjump to the function exitzjump to line {lineno}rR)format)r+ action_msgrHs r-_finish_action_msgzPythonParser._finish_action_msgxs2  Qw8 4 &&c&2 rLcX|j|j|jJ|jj||fdg}g}|D]J\}}|j||}d|d|}||d|j |z }|j |Ldj |S)z5Provide an English sentence describing a missing arc.NNzline z didn't z because rRz or )r)rr5rrappendjoin)r+rGrHfragment_pairsmsgsmissing_cause_msgrmsgs r-missing_arc_descriptionz$PythonParser.missing_arc_descriptions  & & .    ..: ::4488% ~V-;  ) z00SAJ% 5C ,#4#;#;5#;#I"JKK KK   {{4  rLc|j|j|jJ|jj||fdg}|j|dd|}|S)z2Provide an English description of an arc's effect.rrr9)r)rr5r)r+rGrHrrs r-arc_descriptionzPythonParser.arc_descriptionsl  & & .    ..: ::4488% ~V,,^A->q-A3G rL)NNN)r str | NonerrrrreturnNone)rBrpr set[TLineNo]rr)rSrrr)rIterable[TLineNo]rr)rrrr)rzIterable[TArc]r set[TArc])rr)rzdict[TLineNo, int])rrrHrrrp)rGrrHrrrp)__name__ __module__ __qualname____doc__r.rKr functools lru_cacherxrdrrrrrrrrrrrLr-rrs #" =C=C=C =C  =C~.h\TY&'5'b<0 @.&P&!&rLrcDeZdZdZ d ddZd dZd dZd dZy) rbz3Parse bytecode to understand the structure of code.NcV||_|||_y|Jt||dd|_y)NexecT) dont_inherit)rcodecompile)r+rrrs r-r.zByteParser.__init__s8   DI' '' hTJDIrLc@fdtjDS)a|Iterate over all the code objects nested within this one. The iteration includes `self` as its first value. We skip code objects named `__annotate__` since they are deferred annotations that usually are never run. If there are errors in the annotations, they will be caught by type checkers or other tools that use annotations. c3jK|]*}|jdk7rtj|,yw) __annotate__)rN)co_namerbr)r6cr+s r-r8z+ByteParser.child_parsers..s3 yyN* tyyq ) ) s03)r rrs`r- child_parserszByteParser.child_parserss !$)),  rLc#`K|jjD] \}}}|s |yw)zyYield the line numbers possible in this code object. Uses co_lines() to produce a sequence: l0, l1, ... N)rco_lines)r+rlines r- _line_numberszByteParser._line_numberss2 )),,. JAq$  s$..c#jK|jD]}|jEd{y7w)zFind the statements in `self.code`. Produce a sequence of line numbers that start statements. Recurses into all code objects reachable from `self.code`. N)rr)r+bps r-rczByteParser._find_statementss5$$& *B'') ) ) * )s '313r)rrprzCodeType | Nonerrrr)rzIterable[ByteParser])rr)rrrrr.rrrcrrLr-rbrbsL= !%# K K K K  K " *rLrbT)frozenorderc*eZdZUdZded<dZded<y)ArcStarta?The information needed to start an arc. `lineno` is the line number the arc starts from. `cause` is an English text fragment used as the `missing_cause_msg` for AstArcAnalyzer.missing_arc_fragments. It will be used to describe why an arc wasn't executed, so should fit well into a sentence of the form, "Line 17 didn't run because {cause}." The fragment can include "{lineno}" to have `lineno` interpolated into it. As an example, this code:: if something(x): # line 1 func(x) # line 2 more_stuff() # line 3 would have two ArcStarts: - ArcStart(1, "the condition on line 1 was always true") - ArcStart(1, "the condition on line 1 was never true") The first would be used to create an arc from 1 to 3, creating a message like "line 1 didn't jump to line 3 because the condition on line 1 was always true." The second would be used for the arc from 1 to 2, creating a message like "line 1 didn't jump to line 2 because the condition on line 1 was never true." rrSrpcauseN)rrrr__annotations__rrrLr-rrs: OE3OrLrc0eZdZdZ d ddZy) TAddArcFnz&The type for AstArcAnalyzer.add_arc().Ncy)ab Record an arc from `start` to `end`. `missing_cause_msg` is a description of the reason the arc wasn't taken if it wasn't taken. For example, "the condition on line 10 was never true." `action_msg` is a description of what the arc does, like "jump to line 10" or "exit from function 'fooey'." Nrr+rGrHrrs r-__call__zTAddArcFn.__call__srLr rGrrHrrrrrrr)rrrrrrrLr-rrsB0 )-!%    &      rLrc0eZdZdZddZddZddZddZy)Blocka; Blocks need to handle various exiting statements in their own ways. All of these methods take a list of exits, and a callable `add_arc` function that they can use to add arcs if needed. They return True if the exits are handled, or False if the search should continue up the block stack. cy)zProcess break exits.Frr+exitsadd_arcs r-process_break_exitszBlock.process_break_exits%rLcy)zProcess continue exits.Frrs r-process_continue_exitszBlock.process_continue_exits)rrLcy)zProcess raise exits.Frrs r-process_raise_exitszBlock.process_raise_exits-rrLcy)zProcess return exits.Frrs r-process_return_exitszBlock.process_return_exits1rrLNr set[ArcStart]rrrbool)rrrrrrrrrrLr-rrsrLrc(eZdZdZddZddZddZy) LoopBlockz@A block on the block stack representing a `for` or `while` loop.c0||_t|_yr3)rGr break_exits)r+rGs r-r.zLoopBlock.__init__9s *-%rLc:|jj|yNT)rr@rs r-rzLoopBlock.process_break_exits?s &rLcb|D]*}||j|j|j,yr )rSrGrr+rrxits r-rz LoopBlock.process_continue_exitsCs, 7C CJJ CII 6 7rLN)rGrrrr)rrrrr.rrrrLr-rr6sJ0 rLrc(eZdZdZddZddZddZy) FunctionBlockz>A block on the block stack representing a function definition.c ||_||_yr3rGname)r+rGrs r-r.zFunctionBlock.__init__Ls  rLc|D]9}||j|j |jd|j;y)Nzexcept from function TrSrGrrr s r-rz!FunctionBlock.process_raise_exitsRC C    ' }5   rLc|D]9}||j|j |jd|j;y)Nzreturn from function Trr s r-rz"FunctionBlock.process_return_exits\rrLN)rGrrrprrr)rrrrr.rrrrLr-rrIsH rLrc eZdZdZddZddZy)TryBlockz6A block on the block stack representing a `try` block.c ||_||_yr3) handler_start final_start)r+rrs r-r.zTryBlock.__init__js*&rLcz|j/|D]*}||j|j|j,yr )rrSrr s r-rzTryBlock.process_raise_exitsps<    ) C D$6$6 B CrLN)rTLineNo | Nonerrrrr)rrrrr.rrrLr-rrgs@' rLrc|xtjdx\dt|jfSxtjdx)\|j dvrdt |j fSyxtjdxE\t|jtjrt|j\}}|| fSytjdxz\|jDcgc] }t|}}td|D}|rAt|jtj rt"nt}d|d|DfSyycc}w)zIs this a compile-time constant test expression? We don't try to mimic all of CPython's optimizations. We just have to handle the kinds of constant expressions people might actually use. rT)TrueFalser __debug__c3&K|] \}}| ywr3r)r6is_constrs r-r8z(is_constant_test_expr..s?;8Qh?c3&K|] \}}| ywr3r)r6rvs r-r8z(is_constant_test_expr..s3da3r#)FF)rerorrnNameidevalUnaryOprgopNotis_constant_test_exproperandBoolOpvaluesallOrany)r is_constantvalr%retsr*s r-r,r,zs%  S\\^djj)) ) SXXZww@@T$'']** S[[]$''377+#8#F S"G++ ZZ\6:kkB)!,BDB?$??K&tww7SSR3d3333    Cs,EcxeZdZdZ d#dZd$dZd%dZd&dZd'dZeZ d(dZ d) d*d Z d+d Z d,d Z d-d Zd.d ZeZd/dZeZeZd0dZd1dZhdZd2dZ d) d3dZd4dZd4dZd4dZd4dZd5dZd6dZeZd7dZ d8dZ!e!Z"eZ#eZ$d9dZ%d:dZ&d;dZ'dd!Z+d?d"Z,e,Z-y)@raAnalyze source text with an AST to find executable code paths. The .analyze() method does the work, and populates these attributes: `arcs`: a set of (from, to) pairs of the the arcs possible in the code. `missing_arc_fragments`: a dict mapping (from, to) arcs to lists of message fragments explaining why the arc is missing from execution:: { (start, end): [(missing_cause_msg, action_msg), ...], } For an arc starting from line 17, they should be usable to form complete sentences like: "Line 17 didn't {action_msg} because {missing_cause_msg}". NOTE: Starting in July 2024, I've been whittling this down to only report arc that are part of true branches. It's not clear how far this work will go. c||_||_|Dchc]}|j||c}|_||_t t tjdd}|r[td|jtd|jttj|jddt|_ tjt |_g|_t|_t|_t|_t|_t t tjdd|_ycc}w) NCOVERAGE_AST_DUMP0z Statements: zMultiline map: T)include_attributesruCOVERAGE_TRACK_ARCS)r root_noder5r! multilinerrqosgetenvrVredumpr rrrlistr block_stackcurrent_with_startsall_with_starts with_entries with_exitsdebug)r+rr=r!r>rdump_asts r-r.zAstArcAnalyzer.__init__s ! "8BC19==A.C"BII&93?@A  L 12 3 ODNN#34 5 #((4>>d1M N"u 4?4K4KD4Q"(* 25 -0U'*u%(U#bii(=sCDE 7DsEctj|jD]3}|jj}t |d|d}|,||5y)zFExamine the AST tree from `self.root_node` to determine possible arcs._code_object__N)rerfr= __class__rgetattr)r+r node_namecode_object_handlers r-rzAstArcAnalyzer.analyzesQHHT^^, *D//I")$. 0Ld"S ".#D)  *rLci}|jDchc]#}|d|jvr||jvr|%}}|jD]}|Dchc]}|d|k(s |d}}|s!t|dk(s Jd|d||j }|j Dchc]}|d|k(s |d}}|D]}||f||ff|||f<|Scc}wcc}wcc}w)aKGet a dict with data for fixing jumps out of with statements. Returns a dict. The keys are arcs leaving a with-statement by jumping back to its start. The values are pairs: first, the arc from the start to the next statement, then the arc that exits the with without going to the start. rr9zExpected one arc, got z with start = )rrErFlenpoprG) r+fixersr with_nextsrGnextsnxtendsrHs r-rzAstArcAnalyzer.with_jump_fixerss"yy 1v---#T=N=N2N   )) BE'1ESVu_SVEEEu:? T&r5)r+rrNhandlerrs r-rYzAstArcAnalyzer.line_for_node%sy NN++  Xswwi01 2 DGI;/ 6   4=D;;D~~!!$--rLcl|jr|jdj}|S|j}|S)zSCompute first line number for things that can be decorated (classes and functions).r)rtrS)r+rrSs r-_line_decoratedzAstArcAnalyzer._line_decorated;s8   ((+22F [[F rLc8|j|jSr3)rYrnr+rs r- _line__AssignzAstArcAnalyzer._line__AssignCs!!$**--rLc|jrA|jd|jdjS|jdjS|jSNr)keysrSr/rls r- _line__DictzAstArcAnalyzer._line__DictHsK 99yy|'yy|***{{1~,,,;; rLcn|jr|j|jdS|jSro)eltsrYrSrls r- _line__ListzAstArcAnalyzer._line__ListVs, 99%%diil3 3;; rLcy)Nr9rrls r- _line__ModulezAstArcAnalyzer._line__Module\srL> rmPassAssertAssignDeleteGlobalImportNonlocal AnnAssign AugAssign ImportFromc`|jj}tttt j gttft|d|d}| ||}|Stjr||jvrtd|t|j|h}|S)aFind the set of arc starts that exit this node. Return a set of ArcStarts, exits from this node to the next. Because a node represents an entire sub-tree (including its children), the exits from a node can be arbitrarily complex:: if something(1): if other(2): doit(3) else: doit(5) There are three exits from line 1: they start at lines 1, 3 and 5. There are two exits from line 2: lines 3 and 5. _handle__Nz*** Unhandled: )rLrr r rrergr rrMr TESTING OK_TO_DEFAULT RuntimeErrorrY)r+rrNrh arc_startss r- node_exitszAstArcAnalyzer.node_exitsns"NN++  XswwiX67 8 DIi[14 8    J {{D$6$66&'?@@#4#5#5d#;<=JrLc|| t}n|h}n|J|D]a}|j|}||jvr#|D])}|j|j||j +|j |}c|S)aProcess the body of a compound statement. `body` is the body node to process. `from_start` is a single `ArcStart` that starts an arc into this body. `prev_starts` is a set of ArcStarts that can all be the start of arcs into this body. Only one of `from_start` and `prev_starts` should be given. Records arcs within the body by calling `self.add_arc`. Returns a set of ArcStarts, the exits from this body. )r rYr!rrSrr)r+rl from_start prev_starts body_noderS prev_starts r-rZzAstArcAnalyzer.process_bodys(  !!e )l % %% 5I'' 2FT__,) J  Z.. 8H8HI J//)4K  5rLcj|jD] }|j||js yy)z0Add arcs due to jumps from `exits` being breaks.N)rdrrr+rblocks r-rz"AstArcAnalyzer.process_break_exits1((* E(( = rLcj|jD] }|j||js yy)z3Add arcs due to jumps from `exits` being continues.N)rdrrrs r-rz%AstArcAnalyzer.process_continue_exitss1((* E++E4<<@ rLcj|jD] }|j||js yy)z0Add arcs due to jumps from `exits` being raises.N)rdrrrs r-rz"AstArcAnalyzer.process_raise_exitsrrLcj|jD] }|j||js yy)z1Add arcs due to jumps from `exits` being returns.N)rdrrrs r-rz#AstArcAnalyzer.process_return_exitss1((* E))%> rLcv|j|}t|d}|j|htS)Nz*the break on line {lineno} wasn't executedr)rYrrr )r+rhere break_starts r-_handle__BreakzAstArcAnalyzer._handle__Breaks6!!$'t+WX    +/u rLc||j}|j}|j}|rd}|D].}|j|}|||k7r|j|||}0|J|j|||}|js.Jd|jd|j d|j|Jt |hS)zBAdd arcs for things that can be decorated (classes and functions).NzOops: node.body = z in @)rSrtrYrrlrr)r+r main_linelastdecsdec_node dec_starts r-_handle_decoratedz AstArcAnalyzer._handle_decorateds![[ #{{"" D  ! ..x8 # T(9LLy1   ! # ## LLy )D 99 V 3tyynDq V V9rLcv|j|}t|d}|j|htS)Nz-the continue on line {lineno} wasn't executedr)rYrrr )r+rrcontinue_starts r-_handle__Continuez AstArcAnalyzer._handle__Continues7!!$'!$.]^ ##^$45u rLcB|j|j}|jjt |t |d}|j |j|}|D])}|j|j||j+|jj}t|tsJ|j}t |d}|jr$|j |j|}||z}|S|j||S)NrGz'the loop on line {lineno} never startedrrz)the loop on line {lineno} didn't complete)rYiterrCrrrrZrlrrSrrRrgrorelser^)r+rrGrrr my_block else_exitss r- _handle__ForzAstArcAnalyzer._handle__For s""499-   67e+TU !!$)) !C 7C LLUCII 6 7##'')(I...$$e+VW ;;**4;;:*NJ Z E  IIj ! rLcD|j|j}t|j\}}t}|r|r-t |d}||j |j |z}|r|s-t |d}||j |j|z}|S)N-the condition on line {lineno} was never truerr.the condition on line {lineno} was always true)rYtestr,r rrZrlr)r+rrG constant_testr4rrs r- _handle__IfzAstArcAnalyzer._handle__If"s""499-2499= s!%/^_J T&&tyyZ&H HEC!%/_`J T&&t{{z&J JE rLc|j|}|}t}|jD]_}|j|j}|j ||dt |d}||j |j|z}|}aj}t|tjr*|jd}t|tjr*t|tjr?|j3|j}t|tjr |j3t|tjxr|jduxr|jdu} | s|jt d|S)Nz+the pattern on line {lineno} always matchedz*the pattern on line {lineno} never matchedrr)rYr casespatternrrrZrlrgreMatchOrpatternsMatchAsguardr^) r+rrGrDrcase case_startrr had_wildcards r-_handle__MatchzAstArcAnalyzer._handle__Match.sR""4( JJ $D++DLL9J LLZ1^ _!BJ T&&tyyZ&H HE#J $,,#++.&&r*G#++.#++.7??3NooG#++.7??3N w , _D1H _TZZ[_M_  II+XY  rLcv|j|}t|d}|j|htS)Nz*the raise on line {lineno} wasn't executedr)rYrrr )r+rr raise_starts r-_handle__RaisezAstArcAnalyzer._handle__RaiseLs6!!$'t+WX    +/u rLcv|j|}t|d}|j|htS)Nz+the return on line {lineno} wasn't executedr)rYrrr )r+rr return_starts r-_handle__ReturnzAstArcAnalyzer._handle__ReturnSs6!!$',YZ  !!<.1u rLc|jr|j|jd}nd}|jr|j|jd}nd}||Jt||}|jj ||j|}|j |jt|}|jrd|_ n|jjt}|jrQ|jD]B}|j|}d} t|| } ||j |j| z}D|jr|j |j|}||z}|jr=|jj|} |j |j| } |r| }|S)Nrrz3the exception caught by line {lineno} didn't happenr)r) handlersrY finalbodyrrCrrZrlrrrRr r) r+rrr try_blockrGr handler_exits handler_node from_causer final_from final_exitss r- _handle__TryzAstArcAnalyzer._handle__TryZs == ..t}}Q/?@M M >>,,T^^A->?KK(K,CCC]K8   *""4(!!$))!H >>&*I #    "'*u == $  ] $ 2 2< @ R %m:F !2!2<3D3DQ[!2!\\  ] ;;%%dkku%EE  >>    "J++DNN +SK$ rLc|j|jx}}t|j\}}|jj t |t |d}|j|j|}|D])}|j|j||j+t}|jj} t| t sJ|j| j t |d}|j"r$|j|j"|} || z}|S|s|j%||S)Nrrrrr)rYrr,rCrrrrZrlrrSrr rRrgr@rrr^) r+rrGto_toprrrrr rrs r-_handle__WhilezAstArcAnalyzer._handle__Whiles%++DII660; q   78e+Z[ !!$)) !C 8C LLVSYY 7 8##'')(I... X))*e+[\ ;;**4;;:*NJ Z E  ! *% rLctjjr3|jDcgc]}|j |j }}n|j |g}|D]8}|j j||jj|:|j|jt|d}|d}|j j|t|h}|rL|D]E}|j|j||jj|j|fG|}|Scc}w)Nrr)r PYBEHAVIORexit_with_through_ctxmgritemsrY context_exprrDr^rErZrlrremoverrSrG)r+ritemrrGr with_exitr s r- _handle__WithzAstArcAnalyzer._handle__Withs >> 2 2HL Sd(():):;SFS((./F ,E  $ $ ( ( /  $ $U + ,!!$))8L!Mr    ''.e_%  9 SZZ/##SZZ$78 9E %Ts"E) rrpr=ast.ASTr!rr>zdict[TLineNo, TLineNo]rrr)rzdict[TArc, tuple[TArc, TArc]])r ast.Modulerr)rast.FunctionDefrr)rz ast.ClassDefrrrr)rzIterable[Block])rrrr)rrrr)rz ast.Assignrr)rzast.Dictrr)rzast.Listrr)rrrr)rrrr)rlzSequence[ast.AST]rzArcStart | Nonerzset[ArcStart] | Nonerr)rrrr)rz ast.Breakrr)rrrr)rz ast.Continuerr)rzast.Forrr)rzast.Ifrr)rz ast.Matchrr)rz ast.Raiserr)rz ast.Returnrr)rzast.Tryrr)rz ast.Whilerr)rzast.Withrr).rrrrr.rrr\r^_code_object__AsyncFunctionDefr`rrdrYrjrm_line__ClassDefrq_line__FunctionDef_line__AsyncFunctionDefrtrvrrrZrrrrrr_handle__ClassDefrr_handle__AsyncFor_handle__FunctionDef_handle__AsyncFunctionDefrrrrr_handle__TryStarrr_handle__AsyncWithrrLr-rrs($F$F$F! $F * $F  $FL*>(&?"U)-!% ]]]& ]  ]  ]$*.,.&O )-  M!L'+,0 %%$%* %  %^   "  0* (%, 1 <5n$,,'rLr)rrrztuple[bool, bool])6r __future__rrerrr?r;rYrWcollections.abcrr dataclassesrtypesrtypingrr r r coverager coverage.bytecoder coverage.debugrcoverage.exceptionsrr coverage.miscrrcoverage.phystokensrcoverage.typesrrrrbrrdictrBtuplerp TArcFragmentsrrrrr,rrrLr-rs$"  .!55*&33/(B~~B 5*5*z $d#$D  .T4hsmXc]&B CDDE 8&E< u &4k'k'rL