ó
    ðtikE  ã                   óP  • S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJrJrJ	r	J
r
JrJrJrJr  SSKJr  SSKJrJrJrJrJrJrJrJrJr  \(       a  SSKJrJr   " S S	\ R:                  S
9r " S S\5      r " S S\5      r Sr!\RD                  SS S:X  a
  \!S-  r!\!S-  r!SS jr#g)é    N)ÚModule)ÚIterableÚIteratorÚListÚOptionalÚTupleÚAnyÚcastÚTYPE_CHECKINGé   )ÚLineNumbers)	ÚTokenÚmatch_tokenÚis_non_coding_tokenÚpatched_generate_tokensÚ	last_stmtÚannotate_fstring_nodesÚgenerate_tokensÚ	is_moduleÚis_stmt)ÚAstNodeÚ	TokenInfoc                   ób   • \ rS rSrS\S\SS4S jr\R                  S 5       rSS jr	SS	 jr
S
rg)ÚASTTextBaseé!   Úsource_textÚfilenameÚreturnNc                 óR   • X l         [        U5      nXl        [        U5      U l        g ©N)Ú	_filenameÚstrÚ_textr   Ú_line_numbers)Úselfr   r   s      ÚP/home/mande/repo/quber/.venv/lib/python3.13/site-packages/asttokens/asttokens.pyÚ__init__ÚASTTextBase.__init__"   s%   € Ø„Nô
 �kÓ"€Kà„JÜ$ [Ó1€DÕó    c                 ó   • [         e)á²  
Returns two ``(lineno, col_offset)`` tuples for the start and end of the given node.
If the positions can't be determined, or the nodes don't correspond to any particular text,
returns ``(1, 0)`` for both.

``padded`` corresponds to the ``padded`` argument to ``ast.get_source_segment()``.
This means that if ``padded`` is True, the start position will be adjusted to include
leading whitespace if ``node`` is a multiline statement.
)ÚNotImplementedError©r%   ÚnodeÚpaddeds      r&   Úget_text_positionsÚASTTextBase.get_text_positions-   s
   € ô Ðr)   c                 óŒ   • U R                  X5      u  p4U R                  R                  " U6 U R                  R                  " U6 4$ )zõ
Returns the (startpos, endpos) positions in source text corresponding to the given node.
Returns (0, 0) for nodes (like `Load`) that don't correspond to any particular text.

See ``get_text_positions()`` for details on the ``padded`` argument.
)r0   r$   Úline_to_offset©r%   r.   r/   ÚstartÚends        r&   Úget_text_rangeÚASTTextBase.get_text_range;   sH   € ð ×(Ñ(¨Ó6�J€Eà
×Ñ×'Ò'¨Ð/Ø
×Ñ×'Ò'¨Ð-ðð r)   c                 óD   • U R                  X5      u  p4U R                  X4 $ )zÊ
Returns the text corresponding to the given node.
Returns '' for nodes (like `Load`) that don't correspond to any particular text.

See ``get_text_positions()`` for details on the ``padded`` argument.
)r7   r#   r4   s        r&   Úget_textÚASTTextBase.get_textI   s%   € ð ×$Ñ$ TÓ2�J€EØ�:‰:�eÐ!Ð!r)   )r!   r$   r#   )T)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r"   r'   ÚabcÚabstractmethodr0   r7   r:   Ú__static_attributes__© r)   r&   r   r   !   s@   † ð	2 #ð 	2°ð 	2¸ô 	2ð ×Ññó ðô÷	"r)   r   )Ú	metaclassc                   óÈ   ^ • \ rS rSrSrSU 4S jjrS rS r\S 5       r	\S 5       r
\S 5       r\S	 5       rS
 rS rS rSS jrSS jrSS jr SS jrSS jrS rSrU =r$ )Ú	ASTTokenséU   a€  
ASTTokens maintains the text of Python code in several forms: as a string, as line numbers, and
as tokens, and is used to mark and access token and position information.

``source_text`` must be a unicode or UTF8-encoded string. If you pass in UTF8 bytes, remember
that all offsets you'll get are to the unicode text, which is available as the ``.text``
property.

If ``parse`` is set, the ``source_text`` will be parsed with ``ast.parse()``, and the resulting
tree marked with token info and made available as the ``.tree`` property.

If ``tree`` is given, it will be marked and made available as the ``.tree`` property. In
addition to the trees produced by the ``ast`` module, ASTTokens will also mark trees produced
using ``astroid`` library <https://www.astroid.org>.

If only ``source_text`` is given, you may use ``.mark_tokens(tree)`` to mark the nodes of an AST
tree created separately.
c                 óœ  >• [         [        U ]  X5        U(       a  [        R                  " X5      OUU l        Uc  [        U R                  5      n[        U R                  U5      5      U l
        U R                   Vs/ s H  ofR                  PM     snU l        U R
                  (       a  U R                  U R
                  5        g g s  snf r    )ÚsuperrF   r'   ÚastÚparseÚ_treer   r#   ÚlistÚ_translate_tokensÚ_tokensÚstartposÚ_token_offsetsÚmark_tokens)r%   r   rK   Útreer   ÚtokensÚtokÚ	__class__s          €r&   r'   ÚASTTokens.__init__i   s•   ø€ ä	Œ)�TÑ# KÔ:æ5:”—’˜;Ô1À€D„Jð �~Ü˜tŸz™zÓ*€fÜ˜×.Ñ.¨vÓ6Ó7€D„Lð 48·<²<Ó@²<¨CŸ<œ<±<Ñ@€DÔà‡z‡zØ
×Ñ�t—z‘zÕ"ð ùò As   Á>C	c                 ó>   • SSK Jn  U" U 5      R                  U5        g)a]  
Given the root of the AST or Astroid tree produced from source_text, visits all nodes marking
them with token and position information by adding ``.first_token`` and
``.last_token`` attributes. This is done automatically in the constructor when ``parse`` or
``tree`` arguments are set, but may be used manually with a separate AST or Astroid tree.
r   )Ú
MarkTokensN)rR   rY   Ú
visit_tree)r%   Ú	root_noderY   s      r&   rR   ÚASTTokens.mark_tokensz   s   € õ (ÙˆtÓ×Ñ 	Õ*r)   c              #   óô   #   • [        [        U5      5       H\  u  p#Uu  pEpgn[        XEXgX‚U R                  R	                  US   US   5      U R                  R	                  US   US   5      5      v •  M^     g7f)zK
Translates the given standard library tokens into our own representation.
r   r   N)Ú	enumerater   r   r$   r3   )	r%   Úoriginal_tokensÚindexrU   Útok_typeÚtok_strr5   r6   Úlines	            r&   rN   ÚASTTokens._translate_tokens†   s|   é € ô
  Ô 7¸Ó HÖI‰
ˆØ,/Ñ)€h˜ TÜ�( U°Ø×$Ñ$×3Ñ3°E¸!±H¸eÀA¹hÓGØ×$Ñ$×3Ñ3°C¸±F¸CÀ¹FÓCóEô Eò Jùs   ‚A6A8c                 ó   • U R                   $ )z,The source code passed into the constructor.)r#   ©r%   s    r&   ÚtextÚASTTokens.text‘   ó   € ð �:‰:Ðr)   c                 ó   • U R                   $ )zIThe list of tokens corresponding to the source code from the constructor.)rO   rf   s    r&   rT   ÚASTTokens.tokens—   s   € ð �<‰<Ðr)   c                 ó   • U R                   $ )zTThe root of the AST tree passed into the constructor or parsed from the source code.)rL   rf   s    r&   rS   ÚASTTokens.tree�   ri   r)   c                 ó   • U R                   $ )zThe filename that was parsed)r!   rf   s    r&   r   ÚASTTokens.filename£   s   € ð �>‰>Ðr)   c                 ód   • U R                   [        R                  " U R                  U5      S-
     $ )z—
Returns the token containing the given character offset (0-based position in source text),
or the preceeding token if the position is between tokens.
r   )rO   ÚbisectrQ   )r%   Úoffsets     r&   Úget_token_from_offsetÚASTTokens.get_token_from_offset©   s)   € ð �<‰<œŸš d×&9Ñ&9¸6ÓBÀQÑFÑGÐGr)   c                 óV   • U R                  U R                  R                  X5      5      $ )z‚
Returns the token containing the given (lineno, col_offset) position, or the preceeding token
if the position is between tokens.
)rs   r$   r3   ©r%   ÚlinenoÚ
col_offsets      r&   Ú	get_tokenÚASTTokens.get_token±   s&   € ð ×%Ñ% d×&8Ñ&8×&GÑ&GÈÓ&[Ó\Ð\r)   c                 óV   • U R                  XR                  R                  X5      5      $ )z\
Same as get_token(), but interprets col_offset as a UTF8 offset, which is what `ast` uses.
)ry   r$   Úfrom_utf8_colrv   s      r&   Úget_token_from_utf8ÚASTTokens.get_token_from_utf8¼   s$   € ð
 �>‰>˜&×"4Ñ"4×"BÑ"BÀ6Ó"VÓWÐWr)   c                 óö   • UR                   S-   nU(       dU  [        U R                  U   R                  5      (       a.  US-  n[        U R                  U   R                  5      (       a  M.  U R                  U   $ )z”
Returns the next token after the given one. If include_extra is True, includes non-coding
tokens from the tokenize module, such as NL and COMMENT.
r   ©r`   r   rO   Útype©r%   rU   Úinclude_extraÚis       r&   Ú
next_tokenÚASTTokens.next_tokenÃ   ó_   € ð 	�	‰	�A‰€AÞÜ §¡¨Q¡× 4Ñ 4×5Ñ5Ø	ˆQ‰ˆô   §¡¨Q¡× 4Ñ 4×5Ó5à�<‰<˜‰?Ðr)   c                 óö   • UR                   S-
  nU(       dU  [        U R                  U   R                  5      (       a.  US-  n[        U R                  U   R                  5      (       a  M.  U R                  U   $ )z™
Returns the previous token before the given one. If include_extra is True, includes non-coding
tokens from the tokenize module, such as NL and COMMENT.
r   r€   r‚   s       r&   Ú
prev_tokenÚASTTokens.prev_tokenÏ   r‡   r)   c                 ó2  • UnU(       a  U R                   OU R                  n[        XRU5      (       dd  [        R                  " UR
                  5      (       d?  U" USS9n[        XRU5      (       d'  [        R                  " UR
                  5      (       d  M?  U$ )zç
Looks for the first token, starting at start_token, that matches tok_type and, if given, the
token string. Searches backwards if reverse is True. Returns ENDMARKER token if not found (you
can check it with `token.ISEOF(t.type)`).
T©rƒ   )r‰   r…   r   ÚtokenÚISEOFr�   )r%   Ústart_tokenra   rb   ÚreverseÚtÚadvances          r&   Ú
find_tokenÚASTTokens.find_tokenÛ   sk   € ð 	€AÞ!(ˆd�oŠo¨d¯o©o€GÜ˜! w×/Ñ/¼¿ºÀAÇFÁF×8KÑ8KÙ
�! 4Ñ
(€aô ˜! w×/Ñ/¼¿ºÀAÇFÁF×8KÓ8Kà€Hr)   c              #   óâ   #   • [        UR                  UR                  S-   5       HD  nU(       d)  [        U R                  U   R                  5      (       a  M3  U R                  U   v •  MF     g7f)z¦
Yields all tokens in order from first_token through and including last_token. If
include_extra is True, includes non-coding tokens such as tokenize.NL and .COMMENT.
r   N)Úranger`   r   rO   r�   )r%   Úfirst_tokenÚ
last_tokenrƒ   r„   s        r&   Útoken_rangeÚASTTokens.token_rangeè   sS   é € ô �;×$Ñ$ j×&6Ñ&6¸Ñ&:Ö;ˆÞ	Ô1°$·,±,¸q±/×2FÑ2F×GÓGØ�l‰l˜1‰oÔò <ùs   ‚AA/ÁA/c                 óL   • U R                  UR                  UR                  US9$ )z„
Yields all tokens making up the given node. If include_extra is True, includes non-coding
tokens such as tokenize.NL and .COMMENT.
rŒ   )r™   r—   r˜   )r%   r.   rƒ   s      r&   Ú
get_tokensÚASTTokens.get_tokensö   s&   € ð ×Ñ˜D×,Ñ,¨d¯o©oÈ]ÐÐ[Ð[r)   c                 óì   • [        US5      (       d  gUR                  R                  nUR                  R                  nU(       a-  [        S U R                  U5       5       5      (       a  US   S4nX44$ )r+   r—   ©©r   r   r    c              3   óV   #   • U  H  n[        U[        R                  5      v •  M!     g 7fr    )r   r�   ÚNEWLINE)Ú.0r‘   s     r&   Ú	<genexpr>Ú/ASTTokens.get_text_positions.<locals>.<genexpr>  s    é € ÐSÒ=R¸”k !¤U§]¡]×3Ð3Ò=Rùs   ‚')r   )Úhasattrr—   r5   r˜   r6   Úanyrœ   r4   s        r&   r0   ÚASTTokens.get_text_positionsþ   se   € ô �4˜×'Ñ'Øà×Ñ×"Ñ"€EØ
�/‰/×
Ñ
€CÞ”#ÑS¸T¿_¹_ÈTÔ=RÓS×SÑSà�Q‰x˜ˆm€eàˆ:Ðr)   )rQ   rO   rL   )FNú	<unknown>N)F)NF)r<   r=   r>   r?   Ú__doc__r'   rR   rN   Úpropertyrg   rT   rS   r   rs   ry   r}   r…   r‰   r“   r™   rœ   r0   rB   Ú__classcell__©rV   s   @r&   rF   rF   U   s£   ø† ñ÷&#ò"
+ò	Eð ñó ðð
 ñó ðð
 ñó ðð
 ñó ðò
Hò	]òXô
ô
ôð  !&ôô\÷ð r)   rF   c                   ó\   ^ • \ rS rSrSrS	U 4S jjr\S 5       r\S 5       rS r	S r
SrU =r$ )
ÚASTTexti  a4  
Supports the same ``get_text*`` methods as ``ASTTokens``,
but uses the AST to determine the text positions instead of tokens.
This is faster than ``ASTTokens`` as it requires less setup work.

It also (sometimes) supports nodes inside f-strings, which ``ASTTokens`` doesn't.

Some node types and/or Python versions are not supported.
In these cases the ``get_text*`` methods will fall back to using ``ASTTokens``
which incurs the usual setup cost the first time.
If you want to avoid this, check ``supports_tokenless(node)`` before calling ``get_text*`` methods.
c                 óŠ   >• [         [        U ]  X5        X l        U R                  b  [	        U R                  5        S U l        g r    )rI   r¯   r'   rL   r   Ú
_asttokens)r%   r   rS   r   rV   s       €r&   r'   ÚASTText.__init__"  s4   ø€ ä	Œ'�4Ñ! +Ô8à„JØ‡z�zÑÜ˜TŸZ™ZÔ(à€D…Or)   c                 ó¾   • U R                   cE  [        R                  " U R                  U R                  5      U l         [        U R                   5        U R                   $ r    )rL   rJ   rK   r#   r!   r   rf   s    r&   rS   ÚASTText.tree,  s>   € ð ‡z�zÑÜ—9’9˜TŸZ™Z¨¯©Ó8€d„jÜ˜TŸZ™ZÔ(Ø�:‰:Ðr)   c                 ó�   • U R                   c.  [        U R                  U R                  U R                  S9U l         U R                   $ )N)rS   r   )r±   rF   r#   rS   r!   rf   s    r&   Ú	asttokensÚASTText.asttokens4  s;   € ð ‡�ÑÜ!Ø
�*‰*Ø�y‰yØ—>‘>ñ€d„oð
 �?‰?Ðr)   c                 óè  • [        U5      (       a0  SU R                  R                  [        U R                  5      5      4$ [        USS5      c  gU(       d   e[        US/ 5      nU(       d  [        USS5      n[        US/ 5      nU(       a  US   nOUnUR                  n[        U5      nU(       aC  XgR                  :w  d1  XaR                  :w  a%  [        US	S5      (       a  [        U5      (       a  SnO%U R                  R                  XeR                  5      nXh4n	[        [        UR                  5      n
[        [        UR                  5      nU R                  R                  X«5      nX«4nXœ4$ )
z>
Version of ``get_text_positions()`` that doesn't use tokens.
r    rw   NrŸ   Údecorator_listÚ
decoratorsÚnodesr   Údoc_node)r   r$   Úoffset_to_lineÚlenr#   Úgetattrrw   r   Ú
end_linenor   r|   rx   r
   ÚintÚend_col_offset)r%   r.   r/   rº   Údecorators_nodeÚ
start_nodeÚstart_linenoÚend_nodeÚstart_col_offsetr5   rÀ   rÂ   r6   s                r&   Ú_get_text_positions_tokenlessÚ%ASTText._get_text_positions_tokenless?  sM  € ô
 �‡�ð
 �T×'Ñ'×6Ñ6´s¸4¿:¹:³ÓGÐGÐGäˆt�X˜tÓ$Ñ,Øæ€Kˆ4ä˜Ð/°Ó4€JÞä  l°DÓ9€oÜ˜?¨G°RÓ8€jÞð ˜a‘=�jà€jà×$Ñ$€LÜ˜‹€Hö ØŸ™Ó'ð ŸO™OÓ+Ü˜˜j¨$×/Ñ/Ü˜—‘ð Ñà×+Ñ+×9Ñ9¸,×H]ÑH]Ó^ÐàÐ,€Eô
 ”c˜8×.Ñ.Ó/€JÜœ#˜x×6Ñ6Ó7€NØ×'Ñ'×5Ñ5°jÓQ€NØÐ
&€Càˆ:Ðr)   c                 ó    • [        USS5      (       a  g[        U5      (       a  U R                  X5      $ U R                  R	                  X5      $ )r+   Ú_broken_positionsNrŸ   )r¿   Úsupports_tokenlessrÈ   r¶   r0   r-   s      r&   r0   ÚASTText.get_text_positions�  sH   € ô ˆtÐ(¨$×/Ñ/àä˜$×ÑØ×/Ñ/°Ó=Ð=à�>‰>×,Ñ,¨TÓ:Ð:r)   )r±   rL   )Nr©   )r<   r=   r>   r?   rª   r'   r«   rS   r¶   rÈ   r0   rB   r¬   r­   s   @r&   r¯   r¯     sF   ø† ñ÷ð ñó ðð ñó ðò@÷D;ð ;r)   r¯   )Ú	argumentsÚ	ArgumentsÚwithitemé   )é   é   )ÚargÚStarred)ÚSliceÚExtSliceÚIndexÚkeywordc                 ó†  • [        U 5      R                  [        ;  =(       aŸ    [        U [        R
                  5      (       + =(       aL    U SL=(       aA    [        U 5      R                  S:H  =(       a"    [        U R                  5      R                  S;   (       + =(       a!    S[        R                  R                  5       ;  $ )aT  
Returns True if the Python version and the node (if given) are supported by
the ``get_text*`` methods of ``ASTText`` without falling back to ``ASTTokens``.
See ``ASTText`` for why this matters.

The following cases are not supported:

  - PyPy
  - ``ast.arguments`` / ``astroid.Arguments``
  - ``ast.withitem``
  - ``astroid.Comprehension``
  - ``astroid.AssignName`` inside ``astroid.Arguments`` or ``astroid.ExceptHandler``
  - The following nodes in Python 3.8 only:
    - ``ast.arg``
    - ``ast.Starred``
    - ``ast.Slice``
    - ``ast.ExtSlice``
    - ``ast.Index``
    - ``ast.keyword``
NÚ
AssignName)rÏ   ÚExceptHandlerÚpypy)
r�   r<   Ú_unsupported_tokenless_typesÚ
isinstancerJ   ÚASTÚparentÚsysÚversionÚlower)r.   s    r&   rÌ   rÌ      s–   € ô. ˆ4ƒj×ÑÔ!=Ñ=÷ 
,ô �tœSŸW™WÓ%Ô%÷ 	
¨$°dÐ*:÷ 	
ä�‹J×Ñ <Ñ/÷ MÜ�T—[‘[Ó!×*Ñ*Ð.LÑLô÷
,ð œŸ™×)Ñ)Ó+Ñ
+ðr)   r    )$r@   rJ   rq   râ   r�   r   Útypingr   r   r   r   r   r	   r
   r   Úline_numbersr   Úutilr   r   r   r   r   r   r   r   r   r   r   ÚABCMetar   rF   r¯   rÞ   Úversion_inforÌ   rC   r)   r&   Ú<module>rê      s¦   ðó Û 
Û Û 
Û Ý ß V× VÓ Vå %÷÷ õ ö
 ß&ô1"˜CŸK™Kò 1"ôh}�ô }ô@~;ˆkô ~;ðF  FÐ Ø×Ñ�B�QÐ˜6Ó!àÐ"4Ñ4ÐàÐ"KÑKÐõ"r)   