§
    0›j­­  ã                  óF  — d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZmZ ddlmZ ddlmZmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZmZ ddl m!Z! ddl"m#Z#m$Z$  ee¦  «        Z G d„ d¦  «        Z% edd¬¦  «         G d„ d¦  «        ¦   «         Z& G d„ de¦  «        Z'e(e#e)e*ee+         ee+         f                  f         Z, G d„ d¦  «        Z- G d„ de-¦  «        Z. G d„ de-¦  «        Z/ G d„ de-¦  «        Z0d%d"„Z1 G d#„ d$¦  «        Z2dS )&zCode parsing for coverage.py.é    )ÚannotationsN)ÚCallableÚIterableÚSequence)Ú	dataclass)ÚOptionalÚProtocolÚcast)Úenv)Ú
ByteParser)Úshort_stack)ÚNoSourceÚ	NotPython)Úisolate_moduleÚ	nice_pair)Úgenerate_tokens)ÚTArcÚTLineNoc                  óÚ   — e Zd ZdZ	 	 	 d)d*d	„Zd+d„Zd,d„Z ej        d¬¦  «        d-d„¦   «         Z	d.d„Z
d/d„Zd0d„Zd,d„Zd1d„Zd,d„Zd0d „Zej        d2d"„¦   «         Zd3d%„Zd4d'„Zd4d(„ZdS )5ÚPythonParserz™Parse code to find executable lines, excluded lines, etc.

    This information is all based on static analysis: no code execution is
    involved.

    NÚtextú
str | NoneÚfilenameÚexcludeÚreturnÚNonec                óü  — |s|s
J d¦   «         ‚|pd| _         |�|| _        nJddlm} 	  || j         ¦  «        | _        n-# t          $ r }t          d| j         › d|› �¦  «        |‚d}~ww xY w|| _        d| _        t          ¦   «         | _	        t          ¦   «         | _
        t          ¦   «         | _        t          ¦   «         | _        t          ¦   «         | _        d| _        i | _        d| _        d| _        i | _        dS )	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 filenamez<code>Nr   )Úget_python_sourcezNo source for code: 'z': F)r   r   Úcoverage.pythonr   ÚOSErrorr   r   Ú	_ast_rootÚsetÚ
statementsÚexcludedÚraw_statementsÚraw_excludedÚraw_docstringsÚshow_tokensÚmultiline_mapÚ	_all_arcsÚ_missing_arc_fragmentsÚ_with_jump_fixers)Úselfr   r   r   r   Úerrs         úN/home/lighthouse/health/venv/lib64/python3.11/site-packages/coverage/parser.pyÚ__init__zPythonParser.__init__&   s7  € ð ÐM�xÐMÐMÐ!MÑMÔMÐMØ Ð, HˆŒØÐØ!ˆDŒIˆIà9Ð9Ð9Ð9Ð9Ð9ðYØ-Ð-¨d¬mÑ<Ô<�”	�	øÝð Yð Yð YÝÐN°t´}ÐNÐNÈÐNÐNÑOÔOÐUXÐXøøøøðYøøøð ˆŒð *.ˆŒõ
 ),©¬ˆŒõ '*¡e¤eˆŒõ -0©E¬EˆÔõ +.©%¬%ˆÔõ -0©E¬EˆÔð !ˆÔð 68ˆÔð ,0ˆŒØ<@ˆÔ#Ø@BˆÔÐÐs   ©? ¿
A)Á	A$Á$A)ÚregexÚstrúset[TLineNo]c           	     óš  ‡ — t          ¦   «         }d}d}t          j        |‰ j        t          j        ¬¦  «        D ]�}|                     ¦   «         \  }}|‰ j                             d||¦  «        z   }|‰ j                             d||¦  «        z   }	|                     ˆ fd„t          |dz   |	dz   ¦  «        D ¦   «         ¦  «         |}|}Œ‘|S )zâFind 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ú
c              3  óN   •K  — | ]}‰j                              ||¦  «        V — Œ d S ©N©r)   Úget)Ú.0Úir-   s     €r/   ú	<genexpr>z.PythonParser.lines_matching.<locals>.<genexpr>u   sG   øè è € ð ð Ø12�Ô"×&Ò& q¨!Ñ,Ô,ðð ð ð ð ð ó    é   é   )	r"   ÚreÚfinditerr   Ú	MULTILINEÚspanÚcountÚupdateÚrange)
r-   r1   ÚmatchesÚ
last_startÚlast_start_lineÚmatchÚstartÚendÚ
start_lineÚend_lines
   `         r/   Úlines_matchingzPythonParser.lines_matchinge   sç   ø€ õ !$¡¤ˆàˆ
ØˆÝ”[ ¨¬	½¼ÐFÑFÔFð 	)ð 	)ˆEØŸš™œ‰JˆE�3Ø(¨4¬9¯?ª?¸4ÀÈUÑ+SÔ+SÑSˆJØ&¨¬¯ª¸¸zÈ3Ñ)OÔ)OÑOˆHØ�NŠNð ð ð ð Ý6;¸JÈ¹NÈHÐWXÉLÑ6YÔ6Yðñ ô ñ ô ð ð ˆJØ(ˆOˆOØˆr>   c           
     ó–  — | j         r8|                      | j         ¦  «        | _        t          | j        ¦  «        | _        d}d}d}d}d}d}| j        €J ‚t          | j        ¦  «        }|D �]”\  }}	\  }
}\  }}}| j        rJt          t          j
                             ||¦  «        d›dt          |
|f¦  «        d›d|	d›d|›�¦  «         |t          j        k    r|d	z  }nÎ|t          j        k    r|d	z  }n¸|t          j        k    rn|	d
k    rT|dk    rN| j                             t%          ||d	z   ¦  «        ¦  «        }|s |r| j                             |¦  «         |}d}nN|	dv r|d	z  }nD|	dv r|d	z  }n:|t          j        k    r*|r&||k    r t%          ||d	z   ¦  «        D ]}|| j        |<   Œd}|	                     ¦   «         r<|t          j        k    r,d}|s(|
}|r||k    rd}|r| j                             |¦  «         �Œ–|sGt1          | j        | j        ¬¦  «        }| j                             |                     ¦   «         ¦  «         |                      | j        ¦  «        | _        | j        €J ‚t?          j         | j        ¦  «        D �]¼}tC          |t>          j"        t>          j#        t>          j$        t>          j%        f¦  «        r´|j&        r­|j&        d         }tC          |t>          j'        ¦  «        r†tC          |j(        t>          j)        ¦  «        rgtC          |j(        j(        tT          ¦  «        rH| j+                             t%          |j,        t[          t\          |j/        ¦  «        d	z   ¦  «        ¦  «         tC          |t>          j"        t>          j#        t>          j$        f¦  «        r˜ta          d„ |j1        D ¦   «         |j,        ¬¦  «        }| j                             t%          ||j,        d	z   ¦  «        ¦  «        rC| j                             t%          |t[          t\          |j/        ¦  «        d	z   ¦  «        ¦  «         �Œ¾dS )zwParse the source to find the interesting facts about its lines.

        A handful of attributes are updated.

        r   FTNz>10ú z>5Ú20r?   ú:z([{z)]})r   r   c              3  ó$   K  — | ]}|j         V — Œd S r8   ©Úlineno)r;   Úds     r/   r=   z*PythonParser._raw_parse.<locals>.<genexpr>â   s$   è è € Ð!HÐ!H¨q !¤(Ð!HÐ!HÐ!HÐ!HÐ!HÐ!Hr>   )Údefault)2r   rP   r&   r"   r$   r   r   r(   ÚprintÚtokenizeÚtok_namer:   r   ÚtokenÚINDENTÚDEDENTÚOPÚintersectionrG   ÚaddÚNEWLINEr)   ÚstripÚCOMMENTr   r   r%   rF   Úfind_statementsÚfirst_linesr!   ÚastÚwalkÚ
isinstanceÚClassDefÚFunctionDefÚAsyncFunctionDefÚModuleÚbodyÚExprÚvalueÚConstantr2   r'   rW   r
   ÚintÚ
end_linenoÚminÚdecorator_list)r-   ÚindentÚexclude_indentÚ	excludingÚ
first_lineÚemptyÚnestingÚtokgenÚtoktypeÚttextÚslinenoÚ_ÚelinenoÚltextÚshould_excludeÚlÚbyte_parserÚnodeÚfirsts                      r/   Ú
_raw_parsezPythonParser._raw_parse|   s  € ð Œ<ð 	3Ø $× 3Ò 3°D´LÑ AÔ AˆDÔÝ Ô 1Ñ2Ô2ˆDŒMð ˆàˆàˆ	àˆ
àˆàˆàŒyÐ$Ð$Ð$Ý  ¤Ñ+Ô+ˆØAGð 0	3ñ 0	3Ñ=ˆG�U™L˜W a©,¨7°A¸ØÔð 	Ýõ !Ô)×-Ò-¨g°wÑ?Ô?Ð?Ð?Ð?Ý! 7¨GÐ"4Ñ5Ô5Ð5Ð5Ð5Ø˜˜˜Ø˜ðñô ð ð �%œ,Ò&Ð&Ø˜!‘��Ø�EœLÒ(Ð(Ø˜!‘��Ø�EœHÒ$Ð$Ø˜C’<�< G¨q¢L LØ%)¤]×%?Ò%?ÅÀjÐRYÐ\]ÑR]Ñ@^Ô@^Ñ%_Ô%_�NØ$ð )¨ð )ð œ×)Ò)¨'Ñ2Ô2Ð2Ø)/˜Ø$(˜	øØ˜e�^�^Ø˜q‘L�G�GØ˜e�^�^Ø˜q‘L�GøØ�EœMÒ)Ð)Øð ; '¨ZÒ"7Ð"7õ # :¨w¸©{Ñ;Ô;ð ;ð ;˜Ø0:˜Ô*¨1Ñ-Ð-Ø�
à�{Š{‰}Œ}ð 
3 ­HÔ,<Ò!<Ð!<à�Ø!ð 3à!(�Jà ð * V¨~Ò%=Ð%=Ø$)˜	Ø ð 3Øœ×)Ò)¨'Ñ2Ô2Ð2ùð ð 	FÝ$¨$¬)¸d¼mÐLÑLÔLˆKØÔ×&Ò& {×'BÒ'BÑ'DÔ'DÑEÔEÐEà×(Ò(¨¬Ñ7Ô7ˆŒð Œ~Ð)Ð)Ð)Ý”H˜Tœ^Ñ,Ô,ð 	\ñ 	\ˆDå˜$¥¤­s¬ÅÔ@TÕVYÔV`Ð aÑbÔbð 
Ø”9ð 	Ø œI aœL�Eå" 5­#¬(Ñ3Ô3ðå& u¤{µC´LÑAÔAðõ ' u¤{Ô'8½#Ñ>Ô>ðð
 Ô+×2Ò2Ý! %¤,µµS¸%Ô:JÑ0KÔ0KÈaÑ0OÑPÔPñô ð õ
 ˜$¥¤­s¬ÅÔ@TÐ UÑVÔVð \Ý Ð!HÐ!H°DÔ4GÐ!HÑ!HÔ!HÐRVÔR]Ð^Ñ^Ô^�
Ø”=×-Ò-­e°JÀÄÈaÁÑ.PÔ.PÑQÔQð \Ø”M×(Ò(­¨z½4ÅÀTÄ_Ñ;UÔ;UÐXYÑ;YÑ)ZÔ)ZÑ[Ô[Ð[ùð%	\ð 	\r>   iè  )ÚmaxsizerW   r   c                ó†   — |dk     r| j                              | | ¦  «         }n| j                              ||¦  «        }|S )zAReturn the first line number of the statement including `lineno`.r   r9   )r-   rW   s     r/   rz   zPythonParser.first_lineæ   sK   € ð �AŠ:ˆ:ØÔ(×,Ò,¨f¨W°v°gÑ>Ô>Ð>ˆFˆFàÔ'×+Ò+¨F°FÑ;Ô;ˆFØˆr>   ÚlinenosúIterable[TLineNo]c                ó    ‡ — ˆ fd„|D ¦   «         S )zŠMap the line numbers in `linenos` to the correct first line of the
        statement.

        Returns a set of the first lines.

        c                ó:   •— h | ]}‰                      |¦  «        ’ŒS © ©rz   )r;   r…   r-   s     €r/   ú	<setcomp>z+PythonParser.first_lines.<locals>.<setcomp>ö   s%   ø€ Ð4Ð4Ð4 q�—’ Ñ"Ô"Ð4Ð4Ð4r>   r�   )r-   rŒ   s   ` r/   rg   zPythonParser.first_linesï   s   ø€ ð 5Ð4Ð4Ð4¨GÐ4Ñ4Ô4Ð4r>   Úlinesc                ó,   — |                       |¦  «        S )z)Implement `FileReporter.translate_lines`.)rg   )r-   r“   s     r/   Útranslate_lineszPythonParser.translate_linesø   s   € à×Ò Ñ&Ô&Ð&r>   ÚarcsúIterable[TArc]ú	set[TArc]c                óF   ‡ — ˆ fd„‰                       |¦  «        D ¦   «         S )z(Implement `FileReporter.translate_arcs`.c                ój   •— h | ]/\  }}‰                      |¦  «        ‰                      |¦  «        f’Œ0S r�   r‘   )r;   ÚaÚbr-   s      €r/   r’   z.PythonParser.translate_arcs.<locals>.<setcomp>þ   s:   ø€ ÐaÐaÐa¹V¸aÀ�—’ Ñ#Ô# T§_¢_°QÑ%7Ô%7Ð8ÐaÐaÐar>   )Úfix_with_jumps)r-   r–   s   ` r/   Útranslate_arcszPythonParser.translate_arcsü   s,   ø€ àaÐaÐaÐaÀt×GZÒGZÐ[_ÑG`ÔG`ÐaÑaÔaÐar>   c                óÐ  — 	 t          j        | j        ¦  «        | _        |                      ¦   «          n{# t
          j        t          t          f$ r\}t          |d¦  «        r|j
        }n|j        d         d         }t          d| j        › d�|j        d         ›d|› �z   ¦  «        |‚d}~ww xY w| j        | j        z  }| j        |z
  }|                      |¦  «        |z
  | _        dS )zÁParse source text to find executable lines, excluded lines, etc.

        Sets the .excluded and .statements attributes, normalized to the first
        line of multi-line statements.

        rW   r?   r   zCouldn't parse 'z' as Python source: z	 at line N)rh   Úparser   r!   r‰   r[   Ú
TokenErrorÚIndentationErrorÚSyntaxErrorÚhasattrrW   Úargsr   r   r$   r'   r%   rg   r#   )r-   r.   rW   ÚignoreÚstartss        r/   Úparse_sourcezPythonParser.parse_source   s   € ð	Ý œY t¤yÑ1Ô1ˆDŒNØ�OŠOÑÔÐÐøÝÔ#Õ%5µ{ÐCð 	ð 	ð 	Ý�s˜HÑ%Ô%ð (Øœ��àœ !œ Qœ�ÝØF 4¤=ÐFÐFÐFØ”X˜a”[Ð5Ð5¨VÐ5Ð5ñ6ñô ð ðøøøøð	øøøð ” Ô!4Ñ4ˆØÔ$ vÑ-ˆØ×*Ò*¨6Ñ2Ô2°VÑ;ˆŒˆˆs   ‚25 µB-ÁAB(Â(B-c                óX   — | j         €|                      ¦   «          | j         €J ‚| j         S )zÃGet 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_ast©r-   s    r/   r–   zPythonParser.arcs  s4   € ð Œ>Ð!Ø×ÒÑÔÐØŒ~Ð)Ð)Ð)ØŒ~Ðr>   c                óê  — | j         €J ‚t          | j        | j         | j        | j        ¦  «        }|                     ¦   «          |j        }|                     ¦   «         | _        | j        r|  	                    |¦  «        }t          ¦   «         | _        |D ]Q\  }}|                      |¦  «        }|                      |¦  «        }||k    r| j                             ||f¦  «         ŒR|j        | _        dS )zkRun the AstArcAnalyzer and save its results.

        `_all_arcs` is the set of arcs in the code.

        N)r!   ÚAstArcAnalyzerr   r%   r)   Úanalyzer–   Úwith_jump_fixersr,   r�   r"   r*   rz   rb   Úmissing_arc_fragmentsr+   )r-   Úaaar–   Úl1Úl2Úfl1Úfl2s          r/   rª   zPythonParser._analyze_ast$  së   € ð Œ~Ð)Ð)Ð)Ý˜Tœ]¨D¬N¸DÔ<OÐQUÔQcÑdÔdˆØ�Š‰ŒˆØŒxˆØ!$×!5Ò!5Ñ!7Ô!7ˆÔØÔ!ð 	-Ø×&Ò& tÑ,Ô,ˆDå™œˆŒØð 	/ð 	/‰FˆB�Ø—/’/ "Ñ%Ô%ˆCØ—/’/ "Ñ%Ô%ˆCØ�cŠzˆzØ”×"Ò" C¨ :Ñ.Ô.Ð.øà&)Ô&?ˆÔ#Ð#Ð#r>   c                óÚ  — t          ¦   «         }t          ¦   «         }|D ]¶}|| j        v r«|d         }|                     |¦  «         | j        |         \  }}|| j        v rC|                     |¦  «         | j        |         \  }}|                     |¦  «         || j        v °C|                     ||d         f¦  «         |                     |¦  «         Œ·t          |¦  «        |z  |z
  }|S )a•  Adjust arcs to fix jumps leaving `with` statements.

        Consider this code:

            with open("/tmp/test", "w") as f1:
                a = 2
                b = 3
            print(4)

        In 3.10+, we get traces for lines 1, 2, 3, 1, 4.  But we want to present
        it to the user as if it had been 1, 2, 3, 4.  The arc 3->1 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.

        r   r?   )r"   r,   rb   )r-   r–   Ú	to_removeÚto_addÚarcÚend0Ú
start_nextÚend_nexts           r/   r�   zPythonParser.fix_with_jumps;  sþ   € õ0 ‘E”Eˆ	Ý‘”ˆØð 
	*ð 
	*ˆCØ�dÔ,Ð,Ð,Ø˜1”v�Ø—’˜cÑ"Ô"Ð"Ø'+Ô'=¸cÔ'BÑ$�
˜HØ  DÔ$:Ð:Ð:Ø—M’M *Ñ-Ô-Ð-Ø+/Ô+AÀ*Ô+MÑ(�J Ø—M’M (Ñ+Ô+Ð+ð ! DÔ$:Ð:Ð:ð —
’
˜D (¨1¤+Ð.Ñ/Ô/Ð/Ø—’˜jÑ)Ô)Ð)øÝ�D‘	”	˜FÑ" iÑ/ˆØˆr>   údict[TLineNo, int]c                óê   — t          j        t          ¦  «        }|                      ¦   «         D ]D\  }}|dk    sJ d|›d| j        › �¦   «         ‚|| j        v rŒ*|| j        v rŒ4||xx         dz  cc<   ŒE|S )zYGet a count of exits from that each line.

        Excluded lines are excluded.

        r   zl1=z  should be greater than zero in r?   )ÚcollectionsÚdefaultdictrs   r–   r   r$   )r-   Úexit_countsr²   r³   s       r/   rÁ   zPythonParser.exit_countsc  s“   € õ +6Ô*AÅ#Ñ*FÔ*FˆØ—i’i‘k”kð 	!ð 	!‰FˆB�Ø˜’6�6�6ÐR˜bÐRÐRÀ4Ä=ÐRÐR‘6”6�6Ø�T”]Ð"Ð"àØ�T”]Ð"Ð"àØ˜ˆOˆOŒO˜qÑ ˆOˆO‰OˆOàÐr>   Ú
action_msgrM   c                óL   — |€|dk     rd}nd}|                      |¬¦  «        }|S )z=Apply some defaulting and formatting to an arc's description.Nr   zjump to the function exitzjump to line {lineno}rV   )Úformat)r-   rÂ   rM   s      r/   Ú_finish_action_msgzPythonParser._finish_action_msgw  s9   € àÐØ�QŠwˆwØ8�
�
à4�
Ø×&Ò&¨cÐ&Ñ2Ô2ˆ
ØÐr>   rL   c                óf  — | j         €|                      ¦   «          | j         €J ‚| j                              ||fdg¦  «        }g }|D ]V\  }}|                      ||¦  «        }d|› d|› �}|�|d|                     |¬¦  «        › �z  }|                     |¦  «         ŒWd                     |¦  «        S )z5Provide an English sentence describing a missing arc.N©NNzline z didn't z	 because rV   z or )r+   rª   r:   rÅ   rÄ   ÚappendÚjoin)r-   rL   rM   Úfragment_pairsÚmsgsÚmissing_cause_msgrÂ   Úmsgs           r/   Úmissing_arc_descriptionz$PythonParser.missing_arc_description�  sà   € àÔ&Ð.Ø×ÒÑÔÐØÔ.Ð:Ð:Ð:àÔ4×8Ò8¸%À¸ÈÀ~ÑVÔVˆàˆØ-;ð 	ð 	Ñ)Ð˜zØ×0Ò0°¸SÑAÔAˆJØ5˜%Ð5Ð5¨Ð5Ð5ˆCØ Ð,ØÐKÐ#4×#;Ò#;À5Ð#;Ñ#IÔ#IÐKÐKÑK�à�KŠK˜ÑÔÐÐà�{Š{˜4Ñ Ô Ð r>   c                óÎ   — | j         €|                      ¦   «          | j         €J ‚| j                              ||fdg¦  «        }|                      |d         d         |¦  «        }|S )z2Provide an English description of an arc's effect.NrÇ   r   r?   )r+   rª   r:   rÅ   )r-   rL   rM   rÊ   rÂ   s        r/   Úarc_descriptionzPythonParser.arc_description”  so   € àÔ&Ð.Ø×ÒÑÔÐØÔ.Ð:Ð:Ð:àÔ4×8Ò8¸%À¸ÈÀ~ÑVÔVˆØ×,Ò,¨^¸AÔ->¸qÔ-AÀ3ÑGÔGˆ
ØÐr>   )NNN)r   r   r   r   r   r   r   r   )r1   r2   r   r3   ©r   r   )rW   r   r   r   )rŒ   r�   r   r3   )r“   r�   r   r3   )r–   r—   r   r˜   )r   r˜   )r   r½   )rÂ   r   rM   r   r   r2   )rL   r   rM   r   r   r2   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r0   rP   r‰   Ú	functoolsÚ	lru_cacherz   rg   r•   rž   r¨   r–   rª   r�   rÁ   rÅ   rÎ   rÐ   r�   r>   r/   r   r      sŸ  € € € € € ðð ð  Ø#Ø"ð	=Cð =Cð =Cð =Cð =Cð~ð ð ð ð.h\ð h\ð h\ð h\ðT €YÔ Ð&Ñ&Ô&ðð ð ñ 'Ô&ðð5ð 5ð 5ð 5ð'ð 'ð 'ð 'ðbð bð bð bð<ð <ð <ð <ð0
ð 
ð 
ð 
ð@ð @ð @ð @ð.&ð &ð &ð &ðP Ôðð ð ñ Ôðð&ð ð ð ð!ð !ð !ð !ð&ð ð ð ð ð r>   r   T)ÚfrozenÚorderc                  ó,   — e Zd ZU dZded<   dZded<   dS )Ú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."

    r   rW   Ú r2   ÚcauseN)rÒ   rÓ   rÔ   rÕ   Ú__annotations__rÝ   r�   r>   r/   rÛ   rÛ   ¤  s2   € € € € € € ðð ð: €O€O�OØ€E€O€O€O�O€O€Or>   rÛ   c                  ó    — e Zd ZdZ	 	 ddd„ZdS )Ú	TAddArcFnz&The type for AstArcAnalyzer.add_arc().NrL   r   rM   rÌ   r   rÂ   r   r   c                ó   — dS )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'."

        Nr�   ©r-   rL   rM   rÌ   rÂ   s        r/   Ú__call__zTAddArcFn.__call__Ê  s   € € € r>   rÇ   ©
rL   r   rM   r   rÌ   r   rÂ   r   r   r   )rÒ   rÓ   rÔ   rÕ   rã   r�   r>   r/   rà   rà   Ç  s;   € € € € € Ø0Ð0ð )-Ø!%ðð ð ð ð ð ð r>   rà   c                  ó2   — e Zd ZdZdd„Zdd	„Zdd
„Zdd„ZdS )Ú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.
    Úexitsúset[ArcStart]Úadd_arcrà   r   Úboolc                ó   — dS )zProcess break exits.Fr�   ©r-   rç   ré   s      r/   Úprocess_break_exitszBlock.process_break_exitsì  ó   € àˆur>   c                ó   — dS )zProcess continue exits.Fr�   rì   s      r/   Úprocess_continue_exitszBlock.process_continue_exitsð  rî   r>   c                ó   — dS )zProcess raise exits.Fr�   rì   s      r/   Úprocess_raise_exitszBlock.process_raise_exitsô  rî   r>   c                ó   — dS )zProcess return exits.Fr�   rì   s      r/   Úprocess_return_exitszBlock.process_return_exitsø  rî   r>   N©rç   rè   ré   rà   r   rê   )rÒ   rÓ   rÔ   rÕ   rí   rð   rò   rô   r�   r>   r/   ræ   ræ   á  sn   € € € € € ðð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ð ð r>   ræ   c                  ó*   — e Zd ZdZdd„Zdd„Zdd„ZdS )Ú	LoopBlockz@A block on the block stack representing a `for` or `while` loop.rL   r   r   r   c                ó:   — || _         t          ¦   «         | _        d S r8   )rL   r"   Úbreak_exits)r-   rL   s     r/   r0   zLoopBlock.__init__   s   € àˆŒ
å*-©%¬%ˆÔÐÐr>   rç   rè   ré   rà   rê   c                ó:   — | j                              |¦  «         dS ©NT)rù   rF   rì   s      r/   rí   zLoopBlock.process_break_exits  s   € ØÔ×Ò Ñ&Ô&Ð&Øˆtr>   c                óH   — |D ]} ||j         | j        |j        ¦  «         ŒdS rû   )rW   rL   rÝ   ©r-   rç   ré   Úxits       r/   rð   z LoopBlock.process_continue_exits
  s3   € Øð 	7ð 	7ˆCØˆG�C”J ¤
¨C¬IÑ6Ô6Ð6Ð6Øˆtr>   N)rL   r   r   r   rõ   )rÒ   rÓ   rÔ   rÕ   r0   rí   rð   r�   r>   r/   r÷   r÷   ý  sV   € € € € € ØJÐJð0ð 0ð 0ð 0ðð ð ð ðð ð ð ð ð r>   r÷   c                  ó*   — e Zd ZdZdd„Zdd„Zdd„ZdS )ÚFunctionBlockz>A block on the block stack representing a function definition.rL   r   Únamer2   r   r   c                ó"   — || _         || _        d S r8   ©rL   r  )r-   rL   r  s      r/   r0   zFunctionBlock.__init__  s   € àˆŒ
àˆŒ	ˆ	ˆ	r>   rç   rè   ré   rà   rê   c                ó\   — |D ](} ||j         | j         |j        d| j        ›�¦  «         Œ)dS )Nzexcept from function T©rW   rL   rÝ   r  rý   s       r/   rò   z!FunctionBlock.process_raise_exits  óO   € Øð 	ð 	ˆCØˆGØ”
Ø”�Ø”	Ø5¨¬	Ð5Ð5ñ	ô ð ð ð ˆtr>   c                ó\   — |D ](} ||j         | j         |j        d| j        ›�¦  «         Œ)dS )Nzreturn from function Tr  rý   s       r/   rô   z"FunctionBlock.process_return_exits#  r  r>   N)rL   r   r  r2   r   r   rõ   )rÒ   rÓ   rÔ   rÕ   r0   rò   rô   r�   r>   r/   r   r     sV   € € € € € ØHÐHðð ð ð ðð ð ð ðð ð ð ð ð r>   r   c                  ó"   — e Zd ZdZdd„Zdd„ZdS )ÚTryBlockz6A block on the block stack representing a `try` block.Úhandler_startúTLineNo | NoneÚfinal_startr   r   c                ó"   — || _         || _        d S r8   )r
  r  )r-   r
  r  s      r/   r0   zTryBlock.__init__1  s   € à*ˆÔà&ˆÔÐÐr>   rç   rè   ré   rà   rê   c                óV   — | j         �!|D ]} ||j        | j         |j        ¦  «         ŒdS rû   )r
  rW   rÝ   rý   s       r/   rò   zTryBlock.process_raise_exits7  s?   € ØÔÐ)Øð Cð C�Ø�˜œ
 DÔ$6¸¼	ÑBÔBÐBÐBØˆtr>   N)r
  r  r  r  r   r   rõ   )rÒ   rÓ   rÔ   rÕ   r0   rò   r�   r>   r/   r	  r	  .  sB   € € € € € Ø@Ð@ð'ð 'ð 'ð 'ðð ð ð ð ð r>   r	  r‡   úast.ASTr   útuple[bool, bool]c                ój  — | xt           j        d˜ x�\    dt          | j        ¦  «        fS  xt           j        d˜ x�#\    | j        dv rdt          | j        ¦  «        fS nÔ xt           j        d˜ x�?\    t          | j	        t           j
        ¦  «        rt          | j        ¦  «        \  }}|| fS n„ t           j        d˜ x�s\   d„ | j        D ¦   «         }t          d„ |D ¦   «         ¦  «        }|rDt          | j	        t           j        ¦  «        rt"          nt          }d |d„ |D ¦   «         ¦  «        fS n dS )	zÊIs 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.

    r�   NT)ÚTrueÚFalser   Ú	__debug__c                ó,   — g | ]}t          |¦  «        ‘ŒS r�   )Úis_constant_test_expr)r;   Úvs     r/   ú
<listcomp>z)is_constant_test_expr.<locals>.<listcomp>S  s!   € ÐBÐBÐB°Õ)¨!Ñ,Ô,ÐBÐBÐBr>   c              3  ó    K  — | ]	\  }}|V — Œ
d S r8   r�   )r;   Úis_constr�   s      r/   r=   z(is_constant_test_expr.<locals>.<genexpr>T  s&   è è € Ð?Ð?©;¨8°Q˜hÐ?Ð?Ð?Ð?Ð?Ð?r>   c              3  ó    K  — | ]	\  }}|V — Œ
d S r8   r�   )r;   r�   r  s      r/   r=   z(is_constant_test_expr.<locals>.<genexpr>W  s&   è è € Ð3Ð3¡d a¨ Ð3Ð3Ð3Ð3Ð3Ð3r>   )FF)rh   rr   rê   rq   ÚNameÚidÚevalÚUnaryOprj   ÚopÚNotr  ÚoperandÚBoolOpÚvaluesÚallÚOrÚany)r‡   Úis_constantÚvalÚretsr   s        r/   r  r  A  sd  € ð Ø�SŒ\ˆ^ˆ^ˆ^ˆ^‰^ˆ^Ø�˜dœjÑ)Ô)Ð)Ð)ð à�SŒXˆZˆZˆZˆZ‰ZˆZØŒwÐ@Ð@Ð@Ø�T $¤'™]œ]Ð*Ð*ð Að ð �SŒ[ˆ]ˆ]ˆ]ˆ]‰]ˆ]Ý˜$œ'¥3¤7Ñ+Ô+ð ,Ý#8¸¼Ñ#FÔ#FÑ �˜SØ"¨ GÐ+Ð+ð,ð õ ŒZˆ\ˆ\ˆ\ˆ\‰\ØBÐB°d´kÐBÑBÔBˆDÝÐ?Ð?¸$Ð?Ñ?Ô?Ñ?Ô?ˆKØð 4Ý& t¤wµ´Ñ7Ô7Ð@•S�S½S�Ø˜R˜RÐ3Ð3¨dÐ3Ñ3Ô3Ñ3Ô3Ð3Ð3ð4ð ð ˆ<r>   c                  óF  — e Zd ZdZdNd„ZdOd„ZdPd„ZdQd„ZdRd„ZeZ	dSd„Z
	 	 dTdUd„ZdVd „ZdWd!„ZdXd"„ZdYd$„ZeZdZd&„ZeZeZd[d(„Zd\d)„Zh d*£Zd]d,„Z	 	 dTd^d3„Zd_d5„Zd_d6„Zd_d7„Zd_d8„Zd`d:„Zdad;„ZeZdbd=„Z dcd?„Z!e!Z"eZ#eZ$dddA„Z%dedC„Z&dfdE„Z'dgdG„Z(dhdI„Z)e)Z*didK„Z+djdM„Z,e,Z-dS )kr­   aó  Analyze 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.

    r   r2   Ú	root_noder  r#   r3   Ú	multilineúdict[TLineNo, TLineNo]r   r   c                óØ  ‡— || _         || _        ˆfd„|D ¦   «         | _        ‰| _        t	          t          t          j        dd¦  «        ¦  «        ¦  «        }|rWt          d| j        › �¦  «         t          d| j        › �¦  «         t          t          j
        | j        dd¬¦  «        ¦  «         t          ¦   «         | _        t          j        t          ¦  «        | _        g | _        t          ¦   «         | _        t          ¦   «         | _        t          ¦   «         | _        t          ¦   «         | _        t	          t          t          j        d	d¦  «        ¦  «        ¦  «        | _        d S )
Nc                ó<   •— h | ]}‰                      ||¦  «        ’ŒS r�   )r:   )r;   r…   r-  s     €r/   r’   z*AstArcAnalyzer.__init__.<locals>.<setcomp>y  s'   ø€ ÐCÐCÐC°1˜9Ÿ=š=¨¨AÑ.Ô.ÐCÐCÐCr>   ÚCOVERAGE_AST_DUMPÚ0zStatements: zMultiline map: Té   )Úinclude_attributesrw   ÚCOVERAGE_TRACK_ARCS)r   r,  r#   r-  rê   rs   ÚosÚgetenvrZ   rh   Údumpr"   r–   r¿   rÀ   Úlistr°   Úblock_stackÚcurrent_with_startsÚall_with_startsÚwith_entriesÚ
with_exitsÚdebug)r-   r   r,  r#   r-  Údump_asts       ` r/   r0   zAstArcAnalyzer.__init__p  s6  ø€ ð !ˆŒØ"ˆŒØCÐCÐCÐC¸
ÐCÑCÔCˆŒØ"ˆŒõ ��BœIÐ&9¸3Ñ?Ô?Ñ@Ô@ÑAÔAˆàð 	OåÐ2 ¤Ð2Ð2Ñ3Ô3Ð3ÝÐ4 D¤NÐ4Ð4Ñ5Ô5Ð5Ý•#”(˜4œ>¸dÈ1ÐMÑMÔMÑNÔNÐNå"™uœuˆŒ	Ý4?Ô4KÍDÑ4QÔ4QˆÔ"Ø(*ˆÔõ 25±´ˆÔ Ý-0©U¬UˆÔÝ'*¡u¤uˆÔÝ%(¡U¤UˆŒõ �#�bœiÐ(=¸sÑCÔCÑDÔDÑEÔEˆŒ
ˆ
ˆ
r>   c                ó˜   — t          j        | j        ¦  «        D ]/}|j        j        }t          | d|› �d¦  «        }|� ||¦  «         Œ0dS )zFExamine the AST tree from `self.root_node` to determine possible arcs.Ú_code_object__N)rh   ri   r,  Ú	__class__rÒ   Úgetattr)r-   r‡   Ú	node_nameÚcode_object_handlers       r/   r®   zAstArcAnalyzer.analyze–  sd   € å”H˜Tœ^Ñ,Ô,ð 	*ð 	*ˆDØœÔ/ˆIÝ")¨$Ð0LÀÐ0LÐ0LÈdÑ"SÔ"SÐØ"Ð.Ø#Ð# DÑ)Ô)Ð)øð		*ð 	*r>   údict[TArc, tuple[TArc, TArc]]c                ó"  ‡ ‡— i }ˆ fd„‰ j         D ¦   «         }‰ j        D ]oŠˆfd„|D ¦   «         }|sŒt          |¦  «        dk    sJ d|› d‰›�¦   «         ‚|                     ¦   «         }ˆfd„‰ j        D ¦   «         }|D ]}‰|f||ff||‰f<   ŒŒp|S )aK  Get 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.

        c                óD   •— h | ]}|d          ‰j         v ¯|‰j        v¯|’ŒS )r   )r<  r=  )r;   r¹   r-   s     €r/   r’   z2AstArcAnalyzer.with_jump_fixers.<locals>.<setcomp>¨  sB   ø€ ð 
ð 
ð 
àØ�1Œv˜Ô-Ð-Ð-°#¸TÔ=NÐ2NÐ2Nð à2NÐ2NÐ2Nr>   c                ó8   •— h | ]}|d          ‰k    ¯|d         ’ŒS )r   r?   r�   ©r;   r¹   rL   s     €r/   r’   z2AstArcAnalyzer.with_jump_fixers.<locals>.<setcomp>®  s&   ø€ ÐEÐEÐE °S¸´V¸u²_°_�S˜”V°_°_°_r>   r?   zExpected one arc, got z with start = c                ó8   •— h | ]}|d          ‰k    ¯|d         ’ŒS )r?   r   r�   rK  s     €r/   r’   z2AstArcAnalyzer.with_jump_fixers.<locals>.<setcomp>³  s&   ø€ ÐIÐIÐI˜s¸¸Q¼À5º¸�C˜”F¸¸¸r>   )r–   r<  ÚlenÚpopr>  )r-   ÚfixersÚ
with_nextsÚnextsÚnxtÚendsrM   rL   s   `      @r/   r¯   zAstArcAnalyzer.with_jump_fixersž  sû   øø€ ð ˆð
ð 
ð 
ð 
à”yð
ñ 
ô 
ˆ
ð
 Ô)ð 	Bð 	BˆEØEÐEÐEÐE zÐEÑEÔEˆEØð ØÝ�u‘:”: ’?�?�?Ð$T¸UÐ$TÐ$TÈ%Ð$TÐ$T‘?”?�?Ø—)’)‘+”+ˆCØIÐIÐIÐI d¤oÐIÑIÔIˆDØð Bð B�Ø).°¨°s¸C°jÐ'A�˜˜U�|Ñ$Ð$ðBàˆr>   r‡   ú
ast.Modulec                óô   — |                       |¦  «        }|j        rD|                      |j        ¦  «        }|D ]%}|                      |j        | |j        d¦  «         Œ&d S |                      || ¦  «         d S )Nzexit the module)Úline_for_nodero   Úprocess_bodyré   rW   rÝ   ©r-   r‡   rL   rç   rþ   s        r/   Ú_code_object__Modulez#AstArcAnalyzer._code_object__Module½  s‘   € Ø×"Ò" 4Ñ(Ô(ˆØŒ9ð 	(Ø×%Ò% d¤iÑ0Ô0ˆEØð Oð O�Ø—’˜SœZ¨%¨°´Ð<MÑNÔNÐNÐNðOð Oð �LŠL˜  Ñ'Ô'Ð'Ð'Ð'r>   úast.FunctionDefc                ó  — |                       |¦  «        }| j                             t          ||j        ¬¦  «        ¦  «         |                      |j        ¦  «        }|                      |¦  «         | j                             ¦   «          d S )Nr  )	rV  r:  rÈ   r   r  rW  ro   rô   rN  )r-   r‡   rL   rç   s       r/   Ú_code_object__FunctionDefz(AstArcAnalyzer._code_object__FunctionDefÇ  s   € Ø×"Ò" 4Ñ(Ô(ˆØÔ×Ò¥°EÀÄ	Ð JÑ JÔ JÑKÔKÐKØ×!Ò! $¤)Ñ,Ô,ˆØ×!Ò! %Ñ(Ô(Ð(ØÔ×ÒÑÔÐÐÐr>   úast.ClassDefc                óÄ   — |                       |¦  «        }|                      |j        ¦  «        }|D ]-}|                      |j        | |j        d|j        ›�¦  «         Œ.d S )Nzexit class )rV  rW  ro   ré   rW   rÝ   r  rX  s        r/   Ú_code_object__ClassDefz%AstArcAnalyzer._code_object__ClassDefÐ  ss   € Ø×"Ò" 4Ñ(Ô(ˆØ×!Ò! $¤)Ñ,Ô,ˆØð 	Uð 	UˆCØ�LŠL˜œ e V¨S¬YÐ8SÀdÄiÐ8SÐ8SÑTÔTÐTÐTð	Uð 	Ur>   NrL   r   rM   rÌ   r   rÂ   c           
     óZ  — | j         r8t          d|› d|› d|›d|›�¦  «         t          t          ¦   «         d¬¦  «         | j                             ||f¦  «         || j        v r| j                             ||f¦  «         |€|�&| j        ||f                              ||f¦  «         dS dS )z@Add an arc, including message fragments to use if it is missing.zAdding possible arc: (z, z): z

)rM   N)	r?  rZ   r   r–   rb   r;  r=  r°   rÈ   râ   s        r/   ré   zAstArcAnalyzer.add_arcÖ  sØ   € ð Œ:ð 	-ÝÐa¨5ÐaÐa°CÐaÐaÐ<MÐaÐaÐS]ÐaÐaÑbÔbÐbÝ•+‘-”- VÐ,Ñ,Ô,Ð,ØŒ	�Š�u˜c�lÑ#Ô#Ð#Ø�DÔ,Ð,Ð,ØÔ×!Ò! 5¨# ,Ñ/Ô/Ð/àÐ(¨JÐ,BØÔ&¨¨s |Ô4×;Ò;Ð=NÐPZÐ<[Ñ\Ô\Ð\Ð\Ð\ð -CÐ,Br>   úIterable[Block]c                ó*   — t          | j        ¦  «        S )z.Yield the blocks in nearest-to-farthest order.)Úreversedr:  r«   s    r/   Únearest_blockszAstArcAnalyzer.nearest_blocksè  s   € å˜Ô(Ñ)Ô)Ð)r>   c                ó  — |j         j        }t          t          t          t
          j        gt          f                  t          | d|› �d¦  «        ¦  «        }|� ||¦  «        }n|j	        }| j
                             ||¦  «        S )z}What is the right line number to use for this node?

        This dispatches to _line__Node functions where needed.

        Ú_line__N)rC  rÒ   r
   r   r   rh   ÚASTr   rD  rW   r-  r:   )r-   r‡   rE  ÚhandlerÚlines        r/   rV  zAstArcAnalyzer.line_for_nodeì  s�   € ð ”NÔ+ˆ	ÝÝ•X�sœw˜i­Ð0Ô1Ô2Ý�DÐ/ IÐ/Ð/°Ñ6Ô6ñ
ô 
ˆð ÐØ�7˜4‘=”=ˆDˆDà”;ˆDØŒ~×!Ò! $¨Ñ-Ô-Ð-r>   c                óH   — |j         r|j         d         j        }n|j        }|S )zSCompute first line number for things that can be decorated (classes and functions).r   )rv   rW   )r-   r‡   rW   s      r/   Ú_line_decoratedzAstArcAnalyzer._line_decorated  s+   € àÔð 	!ØÔ(¨Ô+Ô2ˆFˆFà”[ˆFØˆr>   ú
ast.Assignc                ó6   — |                       |j        ¦  «        S r8   )rV  rq   ©r-   r‡   s     r/   Ú_line__AssignzAstArcAnalyzer._line__Assign
  s   € Ø×!Ò! $¤*Ñ-Ô-Ð-r>   úast.Dictc                ó€   — |j         r1|j         d         �|j         d         j        S |j        d         j        S |j        S ©Nr   )ÚkeysrW   r$  rn  s     r/   Ú_line__DictzAstArcAnalyzer._line__Dict  s@   € ØŒ9ð 	ØŒy˜Œ|Ð'Ø”y ”|Ô*Ð*ð ”{ 1”~Ô,Ð,à”;Ðr>   úast.Listc                ó^   — |j         r |                      |j         d         ¦  «        S |j        S rr  )ÚeltsrV  rW   rn  s     r/   Ú_line__ListzAstArcAnalyzer._line__List  s.   € ØŒ9ð 	Ø×%Ò% d¤i°¤lÑ3Ô3Ð3à”;Ðr>   c                ó   — dS )Nr?   r�   rn  s     r/   Ú_line__ModulezAstArcAnalyzer._line__Module#  s   € Øˆqr>   >   rp   ÚPassÚAssertÚAssignÚDeleteÚGlobalÚImportÚNonlocalÚ	AnnAssignÚ	AugAssignÚ
ImportFromrè   c                óx  — |j         j        }t          t          t          t
          j        gt          t                   f                  t          | d|› �d¦  «        ¦  «        }|� ||¦  «        }nJt          j        r|| j        vrt          d|› �¦  «        ‚t          |                      |¦  «        ¦  «        h}|S )a  Find 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: )rC  rÒ   r
   r   r   rh   rg  r"   rÛ   rD  r   ÚTESTINGÚOK_TO_DEFAULTÚRuntimeErrorrV  )r-   r‡   rE  rh  Ú
arc_startss        r/   Ú
node_exitszAstArcAnalyzer.node_exits5  s¾   € ð" ”NÔ+ˆ	ÝÝ•X�sœw˜i­­X¬Ð6Ô7Ô8Ý�DÐ1 iÐ1Ð1°4Ñ8Ô8ñ
ô 
ˆð ÐØ ˜ ™œˆJˆJõ Œ{ð AØ DÔ$6Ð6Ð6Ý&Ð'?¸Ð'?Ð'?Ñ@Ô@Ð@õ # 4×#5Ò#5°dÑ#;Ô#;Ñ<Ô<Ð=ˆJØÐr>   ro   úSequence[ast.AST]Ú
from_startúArcStart | NoneÚprev_startsúset[ArcStart] | Nonec                óú   — |€|€t          ¦   «         }n|h}n|�J ‚|D ]\}|                      |¦  «        }|| j        vrŒ!|D ]#}|                      |j        ||j        ¦  «         Œ$|                      |¦  «        }Œ]|S )aÛ  Process 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"   rV  r#   ré   rW   rÝ   r‹  )r-   ro   r�  r�  Ú	body_noderW   Ú
prev_starts          r/   rW  zAstArcAnalyzer.process_bodyX  s­   € ð( ÐØÐ!Ý!™eœe��à)˜l��àÐ%Ð%Ð%ð ð 	5ð 	5ˆIØ×'Ò'¨	Ñ2Ô2ˆFØ˜Tœ_Ð,Ð,ØØ)ð Jð J�
Ø—’˜ZÔ.°¸
Ô8HÑIÔIÐIÐIØŸ/š/¨)Ñ4Ô4ˆKˆKØÐr>   rç   c                óp   — |                       ¦   «         D ] }|                     || j        ¦  «        r dS Œ!dS )z0Add arcs due to jumps from `exits` being breaks.N)rd  rí   ré   ©r-   rç   Úblocks      r/   rí   z"AstArcAnalyzer.process_break_exits‡  óM   € à×(Ò(Ñ*Ô*ð 	ð 	ˆEØ×(Ò(¨°´Ñ=Ô=ð Ø��ðð	ð 	r>   c                óp   — |                       ¦   «         D ] }|                     || j        ¦  «        r dS Œ!dS )z3Add arcs due to jumps from `exits` being continues.N)rd  rð   ré   r•  s      r/   rð   z%AstArcAnalyzer.process_continue_exits�  sM   € à×(Ò(Ñ*Ô*ð 	ð 	ˆEØ×+Ò+¨E°4´<Ñ@Ô@ð Ø��ðð	ð 	r>   c                óp   — |                       ¦   «         D ] }|                     || j        ¦  «        r dS Œ!dS )z0Add arcs due to jumps from `exits` being raises.N)rd  rò   ré   r•  s      r/   rò   z"AstArcAnalyzer.process_raise_exits“  r—  r>   c                óp   — |                       ¦   «         D ] }|                     || j        ¦  «        r dS Œ!dS )z1Add arcs due to jumps from `exits` being returns.N)rd  rô   ré   r•  s      r/   rô   z#AstArcAnalyzer.process_return_exits™  sM   € à×(Ò(Ñ*Ô*ð 	ð 	ˆEØ×)Ò)¨%°´Ñ>Ô>ð Ø��ðð	ð 	r>   ú	ast.Breakc                ó–   — |                       |¦  «        }t          |d¬¦  «        }|                      |h¦  «         t          ¦   «         S )Nz*the break on line {lineno} wasn't executed©rÝ   )rV  rÛ   rí   r"   )r-   r‡   ÚhereÚbreak_starts       r/   Ú_handle__BreakzAstArcAnalyzer._handle__Breakª  sG   € Ø×!Ò! $Ñ'Ô'ˆÝ˜tÐ+WÐXÑXÔXˆØ× Ò  + Ñ/Ô/Ð/Ý‰uŒuˆr>   c                óZ  — |j         }|j         }|j        }|r�d}|D ]7}|                      |¦  «        }|�||k    r|                      ||¦  «         |}Œ8|€J ‚|                      ||¦  «         |}|j        s"J d|j        ›d| j        › d|j         › �¦   «         ‚|€J ‚t          |¦  «        hS )zBAdd arcs for things that can be decorated (classes and functions).NzOops: node.body = z in ú@)rW   rv   rV  ré   ro   r   rÛ   )r-   r‡   Ú	main_lineÚlastÚdecsÚdec_nodeÚ	dec_starts          r/   Ú_handle_decoratedz AstArcAnalyzer._handle_decorated°  sê   € à!œ[ˆ	Ø#œ{ˆØÔ"ˆØð 	WØˆDØ ð !ð !�Ø ×.Ò.¨xÑ8Ô8�	ØÐ#¨	°TÒ(9Ð(9Ø—L’L  yÑ1Ô1Ð1Ø ��ØÐ#Ð#Ð#Ø�LŠL˜˜yÑ)Ô)Ð)ØˆDð
 ”9ÐVÐVÐV t¤yÐVÐV¸¼ÐVÐVÈÌÐVÐVÑVÔVÐVàÐÐÐÝ˜‘”ÐÐr>   úast.Continuec                ó–   — |                       |¦  «        }t          |d¬¦  «        }|                      |h¦  «         t          ¦   «         S )Nz-the continue on line {lineno} wasn't executedr�  )rV  rÛ   rð   r"   )r-   r‡   rž  Úcontinue_starts       r/   Ú_handle__Continuez AstArcAnalyzer._handle__ContinueÊ  sH   € Ø×!Ò! $Ñ'Ô'ˆÝ! $Ð.]Ð^Ñ^Ô^ˆØ×#Ò# ^Ð$4Ñ5Ô5Ð5Ý‰uŒuˆr>   úast.Forc                ó<  — |                       |j        ¦  «        }| j                             t	          |¬¦  «        ¦  «         t          |d¬¦  «        }|                      |j        |¬¦  «        }|D ]#}|                      |j	        ||j
        ¦  «         Œ$| j                             ¦   «         }t          |t          ¦  «        sJ ‚|j        }t          |d¬¦  «        }|j        r"|                      |j        |¬¦  «        }||z  }n|                     |¦  «         |S )N©rL   z'the loop on line {lineno} never startedr�  ©r�  z)the loop on line {lineno} didn't complete)rV  Úiterr:  rÈ   r÷   rÛ   rW  ro   ré   rW   rÝ   rN  rj   rù   Úorelserb   )r-   r‡   rL   r�  rç   rþ   Úmy_blockÚ
else_exitss           r/   Ú_handle__ForzAstArcAnalyzer._handle__ForÐ  s   € Ø×"Ò" 4¤9Ñ-Ô-ˆØÔ×Ò¥	°Ð 6Ñ 6Ô 6Ñ7Ô7Ð7Ý˜eÐ+TÐUÑUÔUˆ
Ø×!Ò! $¤)¸
Ð!ÑCÔCˆàð 	7ð 	7ˆCØ�LŠL˜œ U¨C¬IÑ6Ô6Ð6Ð6ØÔ#×'Ò'Ñ)Ô)ˆÝ˜(¥IÑ.Ô.Ð.Ð.Ð.ØÔ$ˆÝ˜eÐ+VÐWÑWÔWˆ
ØŒ;ð 	"Ø×*Ò*¨4¬;À:Ð*ÑNÔNˆJØ�ZÑˆEˆEð �IŠI�jÑ!Ô!Ð!Øˆr>   úast.Ifc                óT  — |                       |j        ¦  «        }t          |j        ¦  «        \  }}t          ¦   «         }|r|r0t	          |d¬¦  «        }||                      |j        |¬¦  «        z  }|r|s0t	          |d¬¦  «        }||                      |j        |¬¦  «        z  }|S )Nú-the condition on line {lineno} was never truer�  r°  ú.the condition on line {lineno} was always true)rV  Útestr  r"   rÛ   rW  ro   r²  )r-   r‡   rL   Úconstant_testr)  rç   r�  s          r/   Ú_handle__IfzAstArcAnalyzer._handle__Ifé  s¿   € Ø×"Ò" 4¤9Ñ-Ô-ˆÝ2°4´9Ñ=Ô=Ñˆ�sÝ‘”ˆØð 	I ð 	IÝ! %Ð/^Ð_Ñ_Ô_ˆJØ�T×&Ò& t¤y¸ZÐ&ÑHÔHÑHˆEØð 	K Cð 	KÝ! %Ð/_Ð`Ñ`Ô`ˆJØ�T×&Ò& t¤{¸zÐ&ÑJÔJÑJˆEØˆr>   ú	ast.Matchc                óð  — |                       |¦  «        }|}t          ¦   «         }|j        D ]e}|                       |j        ¦  «        }|                      ||d¦  «         t          |d¬¦  «        }||                      |j        |¬¦  «        z  }|}Œf|j        }t          |t          j
        ¦  «        r'|j        d         }t          |t          j
        ¦  «        °'t          |t          j        ¦  «        r/|j        �(|j        }t          |t          j        ¦  «        r|j        ­(t          |t          j        ¦  «        o|j        d u o|j        d u }	|	s$|                     t          |d¬¦  «        ¦  «         |S )Nz+the pattern on line {lineno} always matchedz*the pattern on line {lineno} never matchedr�  r°  éÿÿÿÿ)rV  r"   ÚcasesÚpatternré   rÛ   rW  ro   rj   rh   ÚMatchOrÚpatternsÚMatchAsÚguardrb   )
r-   r‡   rL   rI   rç   ÚcaseÚ
case_startr�  rÁ  Úhad_wildcards
             r/   Ú_handle__MatchzAstArcAnalyzer._handle__Matchõ  sˆ  € Ø×"Ò" 4Ñ(Ô(ˆØˆ
Ý‘”ˆØ”Jð 	$ð 	$ˆDØ×+Ò+¨D¬LÑ9Ô9ˆJØ�LŠL˜ ZÐ1^Ñ_Ô_Ð_Ý!ØØBðñ ô ˆJð �T×&Ò& t¤y¸ZÐ&ÑHÔHÑHˆEØ#ˆJˆJð ”,ˆÝ˜¥#¤+Ñ.Ô.ð 	+ØÔ& rÔ*ˆGõ ˜¥#¤+Ñ.Ô.ð 	+å˜¥#¤+Ñ.Ô.ð 	&°7´?Ð3NØ”oˆGõ ˜¥#¤+Ñ.Ô.ð 	&°7´?Ð3Nõ �w¥¤Ñ,Ô,Ð_°´ÀDÐ1HÐ_ÈTÌZÐ[_ÐM_ð 	ð ð 	Ø�IŠIÝ˜Ð+XÐYÑYÔYñô ð ð ˆr>   ú	ast.Raisec                ó–   — |                       |¦  «        }t          |d¬¦  «        }|                      |h¦  «         t          ¦   «         S )Nz*the raise on line {lineno} wasn't executedr�  )rV  rÛ   rò   r"   )r-   r‡   rž  Úraise_starts       r/   Ú_handle__RaisezAstArcAnalyzer._handle__Raise  sG   € Ø×!Ò! $Ñ'Ô'ˆÝ˜tÐ+WÐXÑXÔXˆØ× Ò  + Ñ/Ô/Ð/å‰uŒuˆr>   ú
ast.Returnc                ó–   — |                       |¦  «        }t          |d¬¦  «        }|                      |h¦  «         t          ¦   «         S )Nz+the return on line {lineno} wasn't executedr�  )rV  rÛ   rô   r"   )r-   r‡   rž  Úreturn_starts       r/   Ú_handle__ReturnzAstArcAnalyzer._handle__Return  sG   € Ø×!Ò! $Ñ'Ô'ˆÝ Ð,YÐZÑZÔZˆØ×!Ò! < .Ñ1Ô1Ð1å‰uŒuˆr>   úast.Tryc                óz  — |j         r!|                      |j         d         ¦  «        }nd }|j        r!|                      |j        d         ¦  «        }nd }|€|€J ‚t          ||¦  «        }| j                             |¦  «         |                      |¦  «        }|                      |j        t          |¦  «        ¬¦  «        }|j        rd |_	        n| j         
                    ¦   «          t          ¦   «         }|j         rQ|j         D ]I}|                      |¦  «        }d}	t          ||	¬¦  «        }
||                      |j        |
¬¦  «        z  }ŒJ|j        r|                      |j        |¬¦  «        }||z  }|j        r;| j         
                    ¦   «          |}|                      |j        |¬¦  «        }|r|}|S )Nr   r°  z3the exception caught by line {lineno} didn't happenr�  )r�  )ÚhandlersrV  Ú	finalbodyr	  r:  rÈ   rW  ro   rÛ   r
  rN  r"   r²  )r-   r‡   r
  r  Ú	try_blockrL   rç   Úhandler_exitsÚhandler_nodeÚ
from_causer�  Ú
final_fromÚfinal_exitss                r/   Ú_handle__TryzAstArcAnalyzer._handle__Try!  så  € ØŒ=ð 	!Ø ×.Ò.¨t¬}¸QÔ/?Ñ@Ô@ˆMˆMà ˆMàŒ>ð 	Ø×,Ò,¨T¬^¸AÔ->Ñ?Ô?ˆKˆKàˆKð Ð(¨KÐ,CÐ,CÐ,CÝ˜]¨KÑ8Ô8ˆ	ØÔ×Ò 	Ñ*Ô*Ð*à×"Ò" 4Ñ(Ô(ˆØ×!Ò! $¤)½À¹¼Ð!ÑHÔHˆð
 Œ>ð 	#Ø&*ˆIÔ#Ð#àÔ× Ò Ñ"Ô"Ð"å'*¡u¤uˆàŒ=ð 	]Ø $¤ð ]ð ]�Ø $× 2Ò 2°<Ñ @Ô @�ØR�
Ý% m¸:ÐFÑFÔF�
Ø ×!2Ò!2°<Ô3DÐQ[Ð!2Ñ!\Ô!\Ñ\��àŒ;ð 	FØ×%Ò% d¤k¸uÐ%ÑEÔEˆEà�ÑˆàŒ>ð 		$ØÔ× Ò Ñ"Ô"Ð"ØˆJà×+Ò+¨D¬NÈ
Ð+ÑSÔSˆKàð $ð $�àˆr>   ú	ast.Whilec                ó´  — |                       |j        ¦  «        x}}t          |j        ¦  «        \  }}| j                             t          |¬¦  «        ¦  «         t          |d¬¦  «        }|                      |j        |¬¦  «        }|D ]#}|  	                    |j
        ||j        ¦  «         Œ$t          ¦   «         }| j                             ¦   «         }	t          |	t
          ¦  «        sJ ‚|                     |	j        ¦  «         t          |d¬¦  «        }|j        r"|                      |j        |¬¦  «        }
||
z  }n|s|                     |¦  «         |S )Nr¯  r¸  r�  r°  r¹  )rV  rº  r  r:  rÈ   r÷   rÛ   rW  ro   ré   rW   rÝ   r"   rN  rj   rF   rù   r²  rb   )r-   r‡   rL   Úto_topr»  r�   r�  rç   rþ   r³  r´  s              r/   Ú_handle__WhilezAstArcAnalyzer._handle__WhileZ  sW  € Ø×+Ò+¨D¬IÑ6Ô6Ð6ˆ�Ý0°´Ñ;Ô;Ñˆ�qØÔ×Ò¥	°Ð 7Ñ 7Ô 7Ñ8Ô8Ð8Ý˜eÐ+ZÐ[Ñ[Ô[ˆ
Ø×!Ò! $¤)¸
Ð!ÑCÔCˆØð 	8ð 	8ˆCØ�LŠL˜œ V¨S¬YÑ7Ô7Ð7Ð7Ý‘”ˆØÔ#×'Ò'Ñ)Ô)ˆÝ˜(¥IÑ.Ô.Ð.Ð.Ð.Ø�Š�XÔ)Ñ*Ô*Ð*Ý˜eÐ+[Ð\Ñ\Ô\ˆ
ØŒ;ð 	&Ø×*Ò*¨4¬;À:Ð*ÑNÔNˆJØ�ZÑˆEˆEð !ð &Ø—	’	˜*Ñ%Ô%Ð%Øˆr>   úast.Withc                ó<  ‡ — t           j        j        rˆ fd„|j        D ¦   «         }n‰                      |¦  «        g}|D ]6}‰ j                             |¦  «         ‰ j                             |¦  «         Œ7‰                      |j	        t          |d         ¦  «        ¬¦  «        }|d         }‰ j                             |¦  «         t          |¦  «        h}|rC|D ]>}‰                      |j        |¦  «         ‰ j                             |j        |f¦  «         Œ?|}|S )Nc                óD   •— g | ]}‰                      |j        ¦  «        ‘ŒS r�   )rV  Úcontext_expr)r;   Úitemr-   s     €r/   r  z0AstArcAnalyzer._handle__With.<locals>.<listcomp>r  s*   ø€ ÐSÐSÐSÀ�d×(Ò(¨Ô):Ñ;Ô;ÐSÐSÐSr>   r¿  r°  )r   Ú
PYBEHAVIORÚexit_with_through_ctxmgrÚitemsrV  r;  rb   r<  rW  ro   rÛ   Úremoveré   rW   r>  )r-   r‡   r§   rL   rç   Ú	with_exitrþ   s   `      r/   Ú_handle__WithzAstArcAnalyzer._handle__Withp  s.  ø€ ÝŒ>Ô2ð 	0ØSÐSÐSÐSÈÌ
ÐSÑSÔSˆFˆFà×(Ò(¨Ñ.Ô.Ð/ˆFØð 	,ð 	,ˆEØÔ$×(Ò(¨Ñ/Ô/Ð/ØÔ ×$Ò$ UÑ+Ô+Ð+Ð+à×!Ò! $¤)½ÀÈÄÑ8LÔ8LÐ!ÑMÔMˆà�r”
ˆØÔ ×'Ò'¨Ñ.Ô.Ð.Ý˜e‘_”_Ð%ˆ	Øð 	Øð 9ð 9�Ø—’˜SœZ¨Ñ/Ô/Ð/Ø”×#Ò# S¤Z°Ð$7Ñ8Ô8Ð8Ð8ØˆEàˆr>   )
r   r2   r,  r  r#   r3   r-  r.  r   r   rÑ   )r   rG  )r‡   rT  r   r   )r‡   rZ  r   r   )r‡   r]  r   r   rÇ   rä   )r   ra  )r‡   r  r   r   )r‡   rZ  r   r   )r‡   rl  r   r   )r‡   rp  r   r   )r‡   ru  r   r   )r‡   rT  r   r   )r‡   r  r   rè   )ro   rŒ  r�  rŽ  r�  r�  r   rè   )rç   rè   r   r   )r‡   r›  r   rè   )r‡   rZ  r   rè   )r‡   r©  r   rè   )r‡   r­  r   rè   )r‡   r¶  r   rè   )r‡   r½  r   rè   )r‡   rÊ  r   rè   )r‡   rÎ  r   rè   )r‡   rÒ  r   rè   )r‡   rÝ  r   rè   )r‡   rá  r   rè   ).rÒ   rÓ   rÔ   rÕ   r0   r®   r¯   rY  r\  Ú_code_object__AsyncFunctionDefr_  ré   rd  rV  rk  ro  Ú_line__ClassDefrt  Ú_line__FunctionDefÚ_line__AsyncFunctionDefrx  rz  rˆ  r‹  rW  rí   rð   rò   rô   r   r¨  Ú_handle__ClassDefr¬  rµ  Ú_handle__AsyncForÚ_handle__FunctionDefÚ_handle__AsyncFunctionDefr¼  rÉ  rÍ  rÑ  rÜ  Ú_handle__TryStarrà  rë  Ú_handle__AsyncWithr�   r>   r/   r­   r­   [  s  € € € € € ðð ð($Fð $Fð $Fð $FðL*ð *ð *ð *ðð ð ð ð>(ð (ð (ð (ðð ð ð ð &?Ð"ðUð Uð Uð Uð )-Ø!%ð]ð ]ð ]ð ]ð ]ð$*ð *ð *ð *ð.ð .ð .ð .ð,ð ð ð ð.ð .ð .ð .ð &€Oð	ð 	ð 	ð 	ð )ÐØ-Ððð ð ð ðð ð ð ðð ð €Mð!ð !ð !ð !ðL '+Ø,0ð	%ð %ð %ð %ð %ð^ð ð ð ðð ð ð ðð ð ð ðð ð ð ð"ð ð ð ð ð  ð  ð  ð0 *Ððð ð ð ðð ð ð ð( %Ðà,ÐØ 1Ðð
ð 
ð 
ð 
ðð ð ð ð<ð ð ð ðð ð ð ð5ð 5ð 5ð 5ðn $Ððð ð ð ð,ð ð ð ð, 'ÐÐÐr>   r­   )r‡   r  r   r  )3rÕ   Ú
__future__r   rh   r¿   rÖ   r6  rA   r]   r[   Úcollections.abcr   r   r   Údataclassesr   Útypingr   r	   r
   Úcoverager   Úcoverage.bytecoder   Úcoverage.debugr   Úcoverage.exceptionsr   r   Úcoverage.miscr   r   Úcoverage.phystokensr   Úcoverage.typesr   r   r   rÛ   rà   Údictr9  Útupler2   ÚTArcFragmentsræ   r÷   r   r	  r  r­   r�   r>   r/   ú<module>r     s  ðð $Ð #à "Ð "Ð "Ð "Ð "Ð "à 
€
€
€
Ø Ð Ð Ð Ø Ð Ð Ð Ø 	€	€	€	Ø 	€	€	€	Ø €€€Ø €€€Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø !Ð !Ð !Ð !Ð !Ð !Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +à Ð Ð Ð Ð Ð Ø (Ð (Ð (Ð (Ð (Ð (Ø &Ð &Ð &Ð &Ð &Ð &Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø /Ð /Ð /Ð /Ð /Ð /Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (à€^�BÑÔ€ð~ð ~ð ~ð ~ð ~ñ ~ô ~ð ~ðL €�$˜dÐ#Ñ#Ô#ðð ð ð ð ñ ô ñ $Ô#ððDð ð ð ð �ñ ô ð ð. �T˜4  h¨s¤m°X¸c´]Ð&BÔ CÔDÐDÔE€ðð ð ð ð ñ ô ð ð8ð ð ð ð �ñ ô ð ð&ð ð ð ð �Eñ ô ð ð<ð ð ð ð ˆuñ ô ð ð&ð ð ð ð4k'ð k'ð k'ð k'ð k'ñ k'ô k'ð k'ð k'ð k'r>   