
    %je                    p   U d dl mZ d dlZd dlZd dlmZ d dlmZ d dl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mZ d d
lmZ d dlmZ erd dlmZmZmZ d dlmZ d dl m!Z!m"Z"m#Z#  G d de	          Z$dde$j%        dddZ&dddd"Z'dd'Z(dd+Z)d,d-d.d/d0Z*e G d1 d)                      Z+ edd2           G d3 d4e+                      Z, edd2           G d5 d6e+                      Z- edd2           G d7 d8e+                      Z. edd2           G d9 d:e+                      Z/ edd2           G d; d<e+                      Z0 edd2           G d= d>e+                      Z1 edd2           G d? d@e+                      Z2 edd2           G dA dBe+                      Z3 edd2           G dC dDe+                      Z4 edd2           G dE dFe+                      Z5 edd2           G dG dHe+                      Z6 edd2           G dI dJe+                      Z7 edd2           G dK dLe+                      Z8 edd2           G dM dNe+                      Z9 edd2           G dO dPe+                      Z: edd2           G dQ dRe+                      Z; edd2           G dS dTe+                      Z< edd2           G dU dVe+                      Z= edd2           G dW dXe+                      Z> edd2           G dY dZe+                      Z? edd2           G d[ d\e+                      Z@ edd2           G d] d^e+                      ZA edd2           G d_ d`e+                      ZB edd2           G da dbe+                      ZC edd2           G dc dde+                      ZD edd2           G de dfe+                      ZE edd2           G dg dhe+                      ZF edd2           G di dje+                      ZG edd2           G dk dle+                      ZH edd2           G dm dne+                      ZI edd2           G do dpe+                      ZJ edd2           G dq dre+                      ZK edd2           G ds dte+                      ZLejM        duejN        dvejO        dwejP        dxiZQejR        dwejS        dyejT        dzejU        d{ejV        d|ejW        d}ejX        d~ejY        dejZ        dej[        dej\        dej]        dej^        dxiZ_ej`        deja        diZbejc        dejd        deje        dejf        dejg        dejh        deji        dejj        dejk        dejl        di
Zmi eAd e2d e:d e6d e?d eId eDd e3d e@d eEd e4d e,d eGd e/d eJd e-d e.d e0d e8d eBd e>d e7d e<d e=d eKd eLd e1d e5d e;d eCd eFd iZnddZoddZpddZqddZrd dZsd!dZtd"dZudddddd#dƄZvd$dȄZwd%dʄZxdd˜d&d̈́Zyd'dτZzd(dфZ{ddҜd)dԄZ|d*d+d؄Z}d,dڄZ~d-d܄Zd.dބZd*d/dZd0dZd1dZd2dZd3dZd4dZddddd5dZdddd6dZd7dZd8dZd9dZ G d de          Zi ej        epej        eqej        erej        esej        etej        euej        evej        ewej        exej        eyej        ezej        e{ej        e|ej        e}ej        e~ej        eej        eej        eej        eej        eej        eej        eej        eej        eej        eej        eej        eej        eiZded<   ej        dk    r/d:dZd;dZe                    ej        eej        ei           d<dZdddd=d	Zddej        d
dd>dZdZ eed          Z eededz            Z eed          Z eededz            Z eed          Z eededz            Z eed          Z eededz            ZdS (?      )annotationsN)	dataclass)fields)IntEnumauto)partial)TYPE_CHECKINGAnyProtocol)get_parameters)LogLevelParameterKind)NameResolutionError)logger)IterableIteratorSequence)Path)ClassFunctionModulec                     e Zd Z e            Z e            Z e            Z e            Z e            Z e            Z	 e            Z
 e            Z e            Z e            Z e            Z e            Z e            Z e            Z e            Z e            Z e            Z e            Z e            Z e            Z e            ZdS )_OperatorPrecedenceN)__name__
__module____qualname__r   NONEYIELDASSIGNSTARREDLAMBDAIF_ELSEORANDNOTCOMP_MEMB_IDBIT_ORBIT_XORBIT_ANDLEFT_RIGHT_SHIFTADD_SUBMUL_DIV_REMAINPOS_NEG_BIT_NOTEXPONENTAWAITCALL_ATTRIBUTEATOMIC     d/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/griffe/_internal/expressions.pyr   r      s         466DDFFETVVFdffGTVVFdffG	B
$&&C
$&&C466LTVVFdffGdffGtvvdffGTVVNdffOtvvHDFFETVVNTVVFFFr3   r   TF)flatis_leftouter_precedenceelement#str | Expr | tuple[str | Expr, ...]r5   boolr6   r7   returnIterator[str | Expr]c             #  H  K   t          | t                    rt          |           }d}||k     rd}nb||k    r\t          | t                    pt          | t                    o
| j        dk    }|r|rd}n t          | t          t          f          r|sd}|r-dV  |r|                     d          E d {V  n| V  dV  d S |r|                     d          E d {V  d S | V  d S t          | t                    r | D ]}t          ||||          E d {V  d S | V  d S )NFT**(r5   )r5   r7   r6   )

isinstanceExpr_get_precedence	ExprIfExp	ExprBinOpoperator
ExprBoolOpiteratetuple_yield)r8   r5   r6   r7   element_precedenceneeds_parensis_right_assocelems           r4   rL   rL   B   s      '4   !,W55 000LL#333';; 7I..K73Ct3K   $ (#'LGi%<== $g $# 
	III "???5555555555IIIII 	D11111111111MMMMM	GU	#	#  	c 	cDd@PZabbbbbbbbbbb	c 	c r3   r@   elements-Iterable[str | Expr | tuple[str | Expr, ...]]joint
str | Exprc             #  >  K   t          |           }	 t          t          |          |t          j                  E d{V  n# t
          $ r Y dS w xY w|D ]F}t          ||t          j                  E d{V  t          ||t          j                  E d{V  GdS )zApply a separator between elements.

    The caller is assumed to provide their own grouping
    (e.g. lists, tuples, slice) and will prevent parentheses from being added.
    r5   r7   N)iterrL   nextr   r   StopIteration)rQ   rS   r5   itr8   s        r4   _joinr[   m   s       
hB $r((@S@XYYYYYYYYYYY    Y Y%d=P=UVVVVVVVVVV'?R?WXXXXXXXXXXXY Ys   /A 
AA+str | bool | Expr | list[str | Expr] | Nonekwargsr
   str | bool | None | list | dictc                    t          | t                    rt          | fi S t          | t                    rfd| D             S | S )Nc                *    g | ]}t          |fi S r2   )_field_as_dict).0rP   r]   s     r4   
<listcomp>z"_field_as_dict.<locals>.<listcomp>   s)    CCC4t..v..CCCr3   )rC   rD   _expr_as_dictlist)r8   r]   s    `r4   ra   ra      s_     '4   0W/////'4   DCCCC7CCCCNr3   
expressionrD   dict[str, Any]c                v      fdt          t                     d           D             } j        |d<   |S )Nc           	     r    i | ]3}|j         d k    |j         t          t          |j                   fi 4S parent)namera   getattr)rb   fieldrf   r]   s     r4   
<dictcomp>z!_expr_as_dict.<locals>.<dictcomp>   sP       :!! 	
N7:uz#B#BMMfMM!!!r3   c                    | j         S N)rl   )fs    r4   <lambda>z_expr_as_dict.<locals>.<lambda>   s     r3   )keycls)sorted	getfields	classname)rf   r]   r   s   `` r4   rd   rd      s]        Ij117G7GHHH  F
 (F5MMr3   rK   dictre   set)ztyping.Tupleztyping.Dictztyping.Listz
typing.Setc                     e Zd ZdZddZd dZddd!dZd"dZd#dZe	dd            Z
e	dd            Ze	dd            Ze	dd            Ze	d$d            Ze	d$d            Ze	d$d            Ze	d$d            Zed%d            ZdS )&rD   zBase class for expressions.r;   strc                h    d                     d |                     d          D                       S )N c              3  R   K   | ]"}t          |t                    r|n|j        V  #d S rq   )rC   r|   rl   )rb   rP   s     r4   	<genexpr>zExpr.__str__.<locals>.<genexpr>   s7      hhz$44Ctt$)hhhhhhr3   Tr@   )joinrJ   selfs    r4   __str__zExpr.__str__   s6    wwhhPTP\P\bfP\PgPghhhhhhr3   r<   c              #  B   K   |                      d          E d{V  dS )z.Iterate on the expression syntax and elements.Fr@   N)rJ   r   s    r4   __iter__zExpr.__iter__   s2      <<U<+++++++++++r3   Tr@   r5   r:   c             #     K   dE d{V  dS )a  Iterate on the expression elements.

        Parameters:
            flat: Expressions are trees.

                When flat is false, this method iterates only on the first layer of the tree.
                To iterate on all the subparts of the expression, you have to do so recursively.
                It allows to handle each subpart specifically (for example subscripts, attribute, etc.),
                without them getting rendered as strings.

                On the contrary, when flat is true, the whole tree is flattened as a sequence
                of strings and instances of [Names][griffe.ExprName].

        Yields:
            Strings and names when flat, strings and expressions otherwise.
        r2   Nr2   r   r5   s     r4   rJ   zExpr.iterate   s      " r3   c                    | S )zModernize the expression.

        For example, use PEP 604 type unions `|` instead of `typing.Union`.

        Returns:
            A modernized expression.
        r2   r   s    r4   	modernizezExpr.modernize   s	     r3   r]   r
   rg   c                    t          | fi |S )zReturn the expression as a dictionary.

        Parameters:
            **kwargs: Configuration options (none available yet).


        Returns:
            A dictionary.
        )rd   )r   r]   s     r4   as_dictzExpr.as_dict   s     T,,V,,,r3   c                    | j         j        S )zThe expression class name.)	__class__r   r   s    r4   rx   zExpr.classname   s     ~&&r3   c                     t          |           S z%Path of the expressed name/attribute.r|   r   s    r4   pathz	Expr.path        4yyr3   c                     t          |           S r   r   r   s    r4   canonical_pathzExpr.canonical_path   r   r3   c                    | j                             dd          d                             dd          d                             d          S )z/Name of the expressed name/attribute/parameter..   r?   rA   )r   rsplitsplitremovesuffixr   s    r4   canonical_namezExpr.canonical_name   sF     "))#q11"5;;CCCBGTTUXYYYr3   c                B    t          | t                    o
| j        dk    S )z4Whether this attribute is annotated with `ClassVar`.ClassVarrC   ExprSubscriptr   r   s    r4   is_classvarzExpr.is_classvar   !     $..T43F*3TTr3   c                f    t          | t                    o| j                                        dk    S )z#Whether this expression is a tuple.rK   )rC   r   r   lowerr   s    r4   is_tuplezExpr.is_tuple   s.     $..Y43F3L3L3N3NRY3YYr3   c                B    t          | t                    o
| j        dk    S )z'Whether this expression is an iterator.r   r   r   s    r4   is_iteratorzExpr.is_iterator   r   r3   c                B    t          | t                    o
| j        dk    S )z'Whether this expression is a generator.	Generatorr   r   s    r4   is_generatorzExpr.is_generator   s!     $..U43F+3UUr3   rQ   Sequence[Expr]oprG   c                   t          |           dk    ri| \  }}t          |t                    r|                                }t          |t                    r|                                }t	          |||          S t
                              | d d         |          }| d         }t          |t                    r|                                }t	          |||          S )N   leftrH   rightr   r   )lenrC   rD   r   rG   r   	_to_binop)rQ   r   r   r   s       r4   r   zExpr._to_binop   s    x==A"KD%$%% (~~''%&& *))$5AAAA&&x}&<<eT"" 	&OO%%EdRu====r3   Nr;   r|   )r;   r<   r5   r:   r;   r<   )r;   rD   )r]   r
   r;   rg   r;   r:   )rQ   r   r   r|   r;   rG   )r   r   r   __doc__r   r   rJ   r   r   propertyrx   r   r   r   r   r   r   r   staticmethodr   r2   r3   r4   rD   rD      s       %%i i i i, , , , '+      &   
- 
- 
- 
- ' ' ' X'    X    X Z Z Z XZ
 U U U XU Z Z Z XZ U U U XU V V V XV > > > \> > >r3   )eqslotsc                      e Zd ZU dZded<   	 dddd
ZddZddZedd            Z	edd            Z
edd            Zedd            ZdS )ExprAttributezAttributes like `a.b`.zlist[str | Expr]valuesTr@   r5   r:   r;   r<   c             #     K   t          |           }t          | j        d         ||d          E d {V  | j        dd          D ]}dV  t          |||          E d {V  d S )Nr   TrB   r   r   rV   )rE   rL   r   )r   r5   
precedencevalues       r4   rJ   zExprAttribute.iterate  s      $T**
$+a.tjZ^__________[_ 	M 	MEIIIe$LLLLLLLLLLL	M 	Mr3   ExprName | ExprAttributec                ~    t                               | j                  x}rt          || j        j                  S | S Nrj   )_modern_typesgetr   ExprNamelastrk   r   moderns     r4   r   zExprAttribute.modernize  s=    "&&t':;;;6 	=F49+;<<<<r3   r   r   Nonec                `    |j         | j        |_         | j                            |           dS )zpAppend a name to this attribute.

        Parameters:
            value: The expression name to append.
        N)rk   r   r   append)r   r   s     r4   r   zExprAttribute.append"  s1     <9EL5!!!!!r3   c                    | j         d         S )z/The last part of this attribute (on the right).r   r   r   s    r4   r   zExprAttribute.last,  s    
 {2r3   rT   c                    | j         d         S )z/The first part of this attribute (on the left).r   r   r   s    r4   firstzExprAttribute.first3  s     {1~r3   r|   c                    | j         j        S )zThe path of this attribute.)r   r   r   s    r4   r   zExprAttribute.path8  s     y~r3   c                    | j         j        S )z%The canonical path of this attribute.)r   r   r   s    r4   r   zExprAttribute.canonical_path=  s     y''r3   Nr   )r;   r   )r   r   r;   r   r;   r   )r;   rT   r   )r   r   r   r   __annotations__rJ   r   r   r   r   r   r   r   r2   r3   r4   r   r     s           2&* M M M M M M   
" " " "    X    X    X ( ( ( X( ( (r3   r   c                  F    e Zd ZU dZded<   	 ded<   	 ded<   	 ddddZdS )rG   zBinary operations like `a + b`.rT   r   r|   rH   r   Tr@   r5   r:   r;   r<   c             #  ,  K   t          |           }|}| j        dk    r,t          | j        t                    rt          |dz
            }t          | j        ||d          E d {V  d| j         dV  t          | j        ||d          E d {V  d S )Nr>   r   TrB    F)rE   rH   rC   r   ExprUnaryOpr   rL   r   )r   r5   r   right_precedences       r4   rJ   zExprBinOp.iterateN  s      $T**
%=D  Z
K%H%H 2:>BB$)$UYZZZZZZZZZZ"$-""""""$*4BR\abbbbbbbbbbbbr3   Nr   r   r   r   r   r   rJ   r2   r3   r4   rG   rG   C  so         ))MMM&* c c c c c c c cr3   rG   c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )rI   z!Boolean operations like `a or b`.r|   rH   Sequence[str | Expr]r   Tr@   r5   r:   r;   r<   c             #     K   t          |           }t          | j                  }t          t	          |          ||d          E d {V  |D ](}d| j         dV  t          |||d          E d {V  )d S )NTrB   r   F)rE   rW   r   rL   rX   rH   )r   r5   r   rZ   r   s        r4   rJ   zExprBoolOp.iterateb  s      $T**
$+$r((
TXYYYYYYYYYY 	\ 	\E&dm&&&&&&e$UZ[[[[[[[[[[[	\ 	\r3   Nr   r   r2   r3   r4   rI   rI   Y  s`         ++MMM    &* \ \ \ \ \ \ \ \r3   rI   c                  R    e Zd ZU dZded<   	 ded<   	 edd            Zd	d
ddZdS )ExprCallzCalls like `f()`.rD   functionr   	argumentsr;   r|   c                    | j         j        S z1The canonical path of this subscript's left part.)r   r   r   s    r4   r   zExprCall.canonical_patht  s     }++r3   Tr@   r5   r:   r<   c             #     K   t          | j        |t          |                     E d {V  dV  t          | j        d|          E d {V  dV  d S )NrV   r?   , r@   rA   )rL   r   rE   r[   r   r   s     r4   rJ   zExprCall.iteratey  sw      $-d_UYEZEZ[[[[[[[[[[			D9999999999					r3   Nr   r   )r   r   r   r   r   r   r   rJ   r2   r3   r4   r   r   k  sx         NNN####, , , X, '+        r3   r   c                  F    e Zd ZU dZded<   	 ded<   	 ded<   	 dd	ddZdS )ExprComparezComparisons like `a > b`.rT   r   zSequence[str]	operatorsr   comparatorsTr@   r5   r:   r;   r<   c             #     K   t          |           }t          | j        ||d          E d {V  t          | j        | j        d          D ]%\  }}d| dV  t          |||          E d {V  &d S )NTrB   Fstrictr   rV   )rE   rL   r   zipr   r   )r   r5   r   r   comps        r4   rJ   zExprCompare.iterate  s      $T**
$)$UYZZZZZZZZZZDND,<UKKK 	L 	LHBb)))OOOd
KKKKKKKKKKK	L 	Lr3   Nr   r   r2   r3   r4   r   r     sr         ##%%%%&* L L L L L L L Lr3   r   c                  V    e Zd ZU dZded<   	 ded<   	 ded<   	 dZded	<   	 d
dddZdS )ExprComprehensionz(Comprehensions like `a for b in c if d`.rT   targetiterabler   
conditionsFr:   is_asyncTr@   r5   r;   r<   c             #     K   | j         rdV  dV  t          | j        |          E d {V  dV  t          | j        |          E d {V  | j        r#dV  t          | j        d|          E d {V  d S d S )Nzasync zfor r@   z in  if )r   rL   r   r   r   r[   r   s     r4   rJ   zExprComprehension.iterate  s      = 	NNN$+D1111111111$-d3333333333? 	ALLLT_f4@@@@@@@@@@@@	A 	Ar3   Nr   )r   r   r   r   r   r   rJ   r2   r3   r4   r   r     s         22;$$$$9H%&* 	A 	A 	A 	A 	A 	A 	A 	Ar3   r   c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprConstantzConstants like `"a"` or `1`.r|   r   Tr@   r5   r:   r;   r<   c             #     K   | j         V  d S rq   )r   r   s     r4   rJ   zExprConstant.iterate  s      jr3   Nr   r   r2   r3   r4   r   r     sI         &&JJJ&*        r3   r   c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )ExprDictzDictionaries like `{"a": 0}`.zSequence[str | Expr | None]keysr   r   Tr@   r5   r:   r;   r<   c             #     K   dV  t          d t          | j        | j        d          D             d|          E d {V  dV  d S )N{c              3  .   K   | ]\  }}|dn|d|fV  d S )Nr   : r2   )rb   rt   r   s      r4   r   z#ExprDict.iterate.<locals>.<genexpr>  s5      wwzsEffdE:wwwwwwr3   Fr   r   r@   })r[   r   r   r   r   s     r4   rJ   zExprDict.iterate  s      			wwSQUQZ\`\gpuMvMvMvwww
 
 
 	
 	
 	
 	
 	
 	
 	

 					r3   Nr   r   r2   r3   r4   r   r     s[         ''%%%%    &*        r3   r   c                  F    e Zd ZU dZded<   	 ded<   	 ded<   	 ddddZdS )ExprDictCompz0Dict comprehensions like `{k: v for k, v in a}`.rT   rt   r   r   
generatorsTr@   r5   r:   r;   r<   c             #     K   dV  t          | j        |          E d {V  dV  t          | j        |          E d {V  dV  t          | j        d|          E d {V  dV  d S )Nr  r@   r  r   r  )rL   rt   r   r[   r  r   s     r4   rJ   zExprDictComp.iterate  s      			$(..........


$*40000000000			#D9999999999					r3   Nr   r   r2   r3   r4   r  r    sg         ::OOO!&*        r3   r  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprExtSlicez Extended slice like `a[x:y, z]`.r   dimsTr@   r5   r:   r;   r<   c             #  D   K   t          | j        d|          E d {V  d S )Nr   r@   )r[   r  r   s     r4   rJ   zExprExtSlice.iterate  s5      Dt444444444444r3   Nr   r   r2   r3   r4   r
  r
    sL         **&* 5 5 5 5 5 5 5 5r3   r
  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprFormattedz Formatted string like `{1 + 1}`.rT   r   Tr@   r5   r:   r;   r<   c             #  h   K   dV  t          | j        |t          j                  E d {V  dV  d S Nr  rV   r  rL   r   r   r   r   s     r4   rJ   zExprFormatted.iterate  I      			$*4BUBZ[[[[[[[[[[					r3   Nr   r   r2   r3   r4   r  r    sL         **&*        r3   r  c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )ExprGeneratorExpz5Generator expressions like `a for b in c for d in e`.rT   r8   r   r  Tr@   r5   r:   r;   r<   c             #     K   t          | j        |          E d {V  dV  t          | j        d|          E d {V  d S )Nr@   r   rL   r8   r[   r  r   s     r4   rJ   zExprGeneratorExp.iterate  se      $,T2222222222			#D999999999999r3   Nr   r   r2   r3   r4   r  r    s[         ??!&* : : : : : : : :r3   r  c                  F    e Zd ZU dZded<   	 ded<   	 ded<   	 ddddZdS )rF   z Conditions like `a if b else c`.rT   bodytestorelseTr@   r5   r:   r;   r<   c             #    K   t          |           }t          | j        ||d          E d {V  dV  t          |dz             }t          | j        ||          E d {V  dV  t          | j        t                    r#| j                            |          E d {V  d S t          | j        ||d          E d {V  d S )	NTrB   r   r   rV   z else r@   F)	rE   rL   r  r   r  rC   r  rF   rJ   )r   r5   r   test_outer_precedences       r4   rJ   zExprIfExp.iterate  s	     $T**
$)$UYZZZZZZZZZZ !4JN C C$)$AVWWWWWWWWWW dk9-- 	b{***55555555555dkz[`aaaaaaaaaaaar3   Nr   r   r2   r3   r4   rF   rF     sr         **&* b b b b b b b br3   rF   c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprInterpolationz,Template string interpolation like `{name}`.rT   r   Tr@   r5   r:   r;   r<   c             #  h   K   dV  t          | j        |t          j                  E d {V  dV  d S r  r  r   s     r4   rJ   zExprInterpolation.iterate/  r  r3   Nr   r   r2   r3   r4   r  r  (  sL         66&*        r3   r  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprJoinedStrz!Joined strings like `f"a {b} c"`.r   r   Tr@   r5   r:   r;   r<   c             #  T   K   dV  t          | j        d|          E d {V  dV  d S )Nzf'r~   r@   'r[   r   r   s     r4   rJ   zExprJoinedStr.iterate=  E      


bt4444444444					r3   Nr   r   r2   r3   r4   r!  r!  6  sL         ++    &*        r3   r!  c                  l     e Zd ZU dZded<   	 ded<   	 dZded<   	 ed fd
            ZddddZ xZ	S )ExprKeywordzKeyword arguments like `a=b`.r|   rl   rT   r   NExpr | Noner   r;   c                t    | j         r| j         j         d| j         dS t          t          |           j        S )zPath of the expressed keyword.r?   rA   )r   r   rl   superr'  )r   r   s    r4   r   zExprKeyword.canonical_path^  sA     = 	Bm2AATYAAAA[$''66r3   Tr@   r5   r:   r<   c             #  \   K   | j         V  dV  t          | j        |          E d {V  d S )N=r@   )rl   rL   r   r   s     r4   rJ   zExprKeyword.iteratee  sG      i			$*4000000000000r3   r   r   )
r   r   r   r   r   r   r   r   rJ   __classcell__)r   s   @r4   r'  r'  C  s         ''III" !H    I7 7 7 7 7 X7 '+ 1 1 1 1 1 1 1 1 1 1r3   r'  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprVarPositionalz,Variadic positional parameters like `*args`.rD   r   Tr@   r5   r:   r;   r<   c             #  J   K   dV  t          | j        |          E d {V  d S )N*r@   rL   r   r   s     r4   rJ   zExprVarPositional.iterater  s<      			$*4000000000000r3   Nr   r   r2   r3   r4   r/  r/  k  sI         66KKK&* 1 1 1 1 1 1 1 1r3   r/  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprVarKeywordz,Variadic keyword parameters like `**kwargs`.rD   r   Tr@   r5   r:   r;   r<   c             #  J   K   dV  t          | j        |          E d {V  d S )Nr>   r@   r2  r   s     r4   rJ   zExprVarKeyword.iterate~  s<      


$*4000000000000r3   Nr   r   r2   r3   r4   r4  r4  w  sI         66KKK&* 1 1 1 1 1 1 1 1r3   r4  c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )
ExprLambdaz(Lambda expressions like `lambda a: a.b`.zSequence[ExprParameter]
parametersrT   r  Tr@   r5   r:   r;   r<   c             #    K   d}d}d}t          | j                  }dV  |rdV  t          | j        d          D ]\  }}|j        t          j        u rd}nc|j        t          j        u rdV  nK|j        t          j        u rdV  n3|j        t          j        u r|sd}n|j        t          j	        u r|sd}dV  |j        t          j        ur|rd}d	V  |j
        V  |j        r?|j        t          j        t          j        fvr d
V  t          |j        |          E d {V  ||k     rdV  dV  t          | j        |t          j                  E d {V  d S )NFlambdar   r   Tr1  r>   z*, z/, r,  r@   r   r  rV   )r   r8  	enumeratekindr   positional_onlyvar_positionalvar_keywordpositional_or_keywordkeyword_onlyrl   defaultrL   r  r   r   )r   r5   pos_only	pos_or_kwkw_onlylengthindex	parameters           r4   rJ   zExprLambda.iterate  s     	T_%% 	III )$/1 = = 	 	E9~!>>>=#???				=#<<<



=#FFFyF 		=#===g=~]%BBBxB .     @Y^M<XZgZs;t%t%t			!)"3$??????????v~~





$)$ATAYZZZZZZZZZZZZr3   Nr   r   r2   r3   r4   r7  r7    sc         22''''&* [ [ [ [ [ [ [ [r3   r7  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprListzLists like `[0, 1, 2]`.r   rQ   Tr@   r5   r:   r;   r<   c             #  T   K   dV  t          | j        d|          E d {V  dV  d S )N[r   r@   ]r[   rQ   r   s     r4   rJ   zExprList.iterate  E      			48888888888					r3   Nr   r   r2   r3   r4   rJ  rJ    sL         !!&*        r3   rJ  c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )ExprListCompz*List comprehensions like `[a for b in c]`.rT   r8   r   r  Tr@   r5   r:   r;   r<   c             #     K   dV  t          | j        |          E d {V  dV  t          | j        d|          E d {V  dV  d S )NrL  r@   r   rM  r  r   s     r4   rJ   zExprListComp.iterate  u      			$,T2222222222			#D9999999999					r3   Nr   r   r2   r3   r4   rQ  rQ    s[         44!&*        r3   rQ  c                     e Zd ZU dZded<   	 dZded<   	 dZded<   	 ddZddddZddZ	e
dd            Ze
dd            Ze
d d            Ze
d!d            Ze
d!d            Ze
d!d            Ze
d!d            ZdS )"r   zLThis class represents a Python object identified by a name in a given scope.r|   rl   Nz1str | ExprName | Module | Class | Function | Nonerk   
str | Nonememberotherobjectr;   r:   c                Z    t          |t                    r| j        |j        k    S t          S )zXTwo name expressions are equal if they have the same `name` value (`parent` is ignored).)rC   r   rl   NotImplemented)r   rW  s     r4   __eq__zExprName.__eq__  s)    eX&& 	+9
**r3   Tr@   r5   Iterator[ExprName]c             #     K   | V  d S rq   r2   r   s     r4   rJ   zExprName.iterate  s      




r3   c                t    t                               | j                  x}rt          || j                  S | S r   )r   r   r   r   rk   r   s     r4   r   zExprName.modernize  s:    "&&t':;;;6 	8F4;7777r3   c                p    t          | j        t                    r| j        j         d| j         S | j        S )zThe full, resolved name.

        If it was given when creating the name, return that.
        If a callable was given, call it and return its result.
        It the name cannot be resolved, return the source.
        r   )rC   rk   r   r   rl   r   s    r4   r   zExprName.path  s;     dk8,, 	5k&44444yr3   c                   | j         | j        S t          | j         t                    r| j         j         d| j         S t          | j         t
                    r| j          d| j         S | j         j                            | j        | j                   }	 |	                    | j                  S # t          $ r
 | j        cY S w xY w)z2The canonical name (resolved one, not alias name).Nr   )rk   rl   rC   r   r   r|   membersr   rV  resolver   )r   rk   s     r4   r   zExprName.canonical_path  s     ;9dk8,, 	?k0>>49>>>dk3'' 	0k//DI///$((dkBB	>>$),,," 	 	 	9	s   B/ /CCModule | Class | Nonec                    	 | j         j        | j                             | j                           S # t          $ r | j         j        | j                 cY S w xY w)z(The resolved object this name refers to.)rk   modules_collectionrb  rl   	Exceptionresolvedr   s    r4   rg  zExprName.resolved   s\    	3;1$+2E2Edi2P2PQQ 	3 	3 	3;'	2222	3s   .1 !AAc                r    	 | j         j        }n# t          $ r Y dS w xY wt          d |D                       S )z3Whether this name resolves to an enumeration class.Fc              3  V   K   | ]$}t          |t                    o
|j        d k    V  %dS )z	enum.EnumN)rC   rD   r   )rb   bases     r4   r   z)ExprName.is_enum_class.<locals>.<genexpr>  s:      ccUY:dD))Pd.A[.Pccccccr3   )rg  basesrf  any)r   rk  s     r4   is_enum_classzExprName.is_enum_class  sU    	M'EE 	 	 	55	
 cc]bccccccs    
c                >    	 | j         j        S # t          $ r Y dS w xY w)z6Whether this name resolves to an enumeration instance.F)rk   rm  rf  r   s    r4   is_enum_instancezExprName.is_enum_instance  s4    	;,, 	 	 	55	s    
c                T    	 | j         dk    o| j        j        S # t          $ r Y dS w xY w)z3Whether this name resolves to an enumeration value.r   F)rl   rk   ro  rf  r   s    r4   is_enum_valuezExprName.is_enum_value  s@    	9'HDK,HH 	 	 	55	s    
''c                    d| j         v S )z/Whether this name resolves to a type parameter.rL  )r   r   s    r4   is_type_parameterzExprName.is_type_parameter$  s     d)))r3   )rW  rX  r;   r:   )r5   r:   r;   r\  r   r   )r;   rc  r   )r   r   r   r   r   rk   rV  r[  rJ   r   r   r   r   rg  rm  ro  rq  rs  r2   r3   r4   r   r     s        VVIII@DFDDDD/F4    '+         
 	 	 	 X	    X 3 3 3 X3 	d 	d 	d X	d    X    X * * * X* * *r3   r   c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )ExprNamedExprz+Named/assignment expressions like `a := b`.rD   r   rT   r   Tr@   r5   r:   r;   r<   c             #     K   t          | j        |          E d {V  dV  t          | j        |          E d {V  d S )Nr@   z := )rL   r   r   r   s     r4   rJ   zExprNamedExpr.iterate3  sc      $+D1111111111$*4000000000000r3   Nr   r   r2   r3   r4   ru  ru  *  sX         55LLL&* 1 1 1 1 1 1 1 1r3   ru  c                  X    e Zd ZU dZded<   	 ej        Zded<   	 dZded<   	 dZ	d	ed
<   dS )ExprParameterz4Parameters in function signatures like `a: int = 0`.r|   rl   r   r<  Nr(  
annotationstr | Expr | NonerB  )
r   r   r   r   r   r   r@  r<  ry  rB  r2   r3   r4   rx  rx  9  s`         >>III'=D===="J""""!%G%%%%r3   rx  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprSetzSets like `{0, 1, 2}`.r   rQ   Tr@   r5   r:   r;   r<   c             #  T   K   dV  t          | j        d|          E d {V  dV  d S )Nr  r   r@   r  rN  r   s     r4   rJ   zExprSet.iterateN  rO  r3   Nr   r   r2   r3   r4   r|  r|  G  sL           """"&*        r3   r|  c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )ExprSetCompz)Set comprehensions like `{a for b in c}`.rT   r8   r   r  Tr@   r5   r:   r;   r<   c             #     K   dV  t          | j        |          E d {V  dV  t          | j        d|          E d {V  dV  d S )Nr  r@   r   r  r  r   s     r4   rJ   zExprSetComp.iterate]  rS  r3   Nr   r   r2   r3   r4   r  r  T  s[         33!&*        r3   r  c                  R    e Zd ZU dZdZded<   	 dZded<   	 dZded<   	 ddddZdS )	ExprSlicezSlices like `[a:b:c]`.Nrz  r   upperstepTr@   r5   r:   r;   r<   c             #     K   | j         t          | j         |          E d {V  dV  | j        t          | j        |          E d {V  | j        "dV  t          | j        |          E d {V  d S d S )Nr@   :)r   rL   r  r  r   s     r4   rJ   zExprSlice.iteratep  s      :!djt4444444444			:!djt44444444449 IIIdid333333333333 ! r3   r   )	r   r   r   r   r   r   r  r  rJ   r2   r3   r4   r  r  e  sy           #E#####E####"D""""&* 4 4 4 4 4 4 4 4r3   r  c                  r    e Zd ZU dZded<   	 ded<   	 ddddZddZedd            Zedd            Z	dS )r   zSubscripts like `a[b]`.rT   r   sliceTr@   r5   r:   r;   r<   c             #     K   t          | j        |t          |                     E d {V  dV  t          | j        |t          j                  E d {V  dV  d S )NrV   rL  rM  )rL   r   rE   r  r   r   r   s     r4   rJ   zExprSubscript.iterate  s{      $)$QUAVAVWWWWWWWWWW			$*4BUBZ[[[[[[[[[[					r3   ExprBinOp | ExprSubscriptc                
   | j         dk    r!|                     | j        j        d          S | j         dk    rLt	          | j        t
                    r| j        n| j                                        }t          |dd          S t          t	          | j	        t
                    r| j	        n| j	                                        t	          | j        t
                    r| j        n| j                                                  S )Nztyping.Union|r   ztyping.Optionalr   r   )r   r  )
r   r   r  rQ   rC   r|   r   rG   r   r   )r   r   s     r4   r   zExprSubscript.modernize  s    .00>>$*"5#>>>>"333!+DJ!<!<X4::$*BVBVBXBXD$FCCCC(C88Sdi>Q>Q>S>S *4:s ; ;W$**AUAUAWAW
 
 
 	
r3   r|   c                \    t          | j        t                    r| j        S | j        j        S )z'The path of this subscript's left part.)rC   r   r|   r   r   s    r4   r   zExprSubscript.path  s*     di%% 	9y~r3   c                \    t          | j        t                    r| j        S | j        j        S r   )rC   r   r|   r   r   s    r4   r   zExprSubscript.canonical_path  s+     di%% 	9y''r3   Nr   )r;   r  r   )
r   r   r   r   r   rJ   r   r   r   r   r2   r3   r4   r   r   {  s         !!&*      	
 	
 	
 	
    X ( ( ( X( ( (r3   r   c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprTemplateStrz$Template strings like `t"a {name}"`.r   r   Tr@   r5   r:   r;   r<   c             #  T   K   dV  t          | j        d|          E d {V  dV  d S )Nzt'r~   r@   r#  r$  r   s     r4   rJ   zExprTemplateStr.iterate  r%  r3   Nr   r   r2   r3   r4   r  r    sL         ..    &*        r3   r  c                  F    e Zd ZU dZded<   	 dZded<   	 ddddZddZdS )	ExprTuplezTuples like `(0, 1, 2)`.r   rQ   Fr:   implicitTr@   r5   r;   r<   c             #     K   | j         sdV  t          | j        d|          E d {V  t          | j                  dk    rdV  | j         sdV  d S d S )Nr?   r   r@   r   ,rA   )r  r[   rQ   r   r   s     r4   rJ   zExprTuple.iterate  s      } 	III48888888888t}""III} 	IIIII	 	r3   c                L    t          d | j        D             | j                  S )Nc                d    g | ]-}t          |t                    r|n|                                .S r2   )rC   r|   r   )rb   els     r4   rc   z'ExprTuple.modernize.<locals>.<listcomp>  s3    \\\Jr3//CbbR\\^^\\\r3   )rQ   r  )r  rQ   r  r   s    r4   r   zExprTuple.modernize  s1    \\dm\\\]
 
 
 	
r3   Nr   )r;   r  )r   r   r   r   r   r  rJ   r   r2   r3   r4   r  r    st         """"""HZ&*      
 
 
 
 
 
r3   r  c                  :    e Zd ZU dZded<   	 ded<   	 ddddZdS )r   zUnary operations like `-1`.r|   rH   rT   r   Tr@   r5   r:   r;   r<   c             #     K   | j         V  | j         dk    rdV  t          | j        |t          |                     E d {V  d S )Nnotr   rV   )rH   rL   r   rE   r   s     r4   rJ   zExprUnaryOp.iterate  sb      m=E!!III$*4/RVBWBWXXXXXXXXXXXXr3   Nr   r   r2   r3   r4   r   r     s`         %%MMM&* Y Y Y Y Y Y Y Yr3   r   c                  2    e Zd ZU dZdZded<   	 ddddZdS )	ExprYieldz Yield statements like `yield a`.Nrz  r   Tr@   r5   r:   r;   r<   c             #  d   K   dV  | j         "dV  t          | j         |          E d {V  d S d S )Nyieldr   r@   )r   rL   r   s     r4   rJ   zExprYield.iterate  sU      :!IIIdjt444444444444 "!r3   r   )r   r   r   r   r   r   rJ   r2   r3   r4   r  r    sQ         **#E####&* 5 5 5 5 5 5 5 5r3   r  c                  .    e Zd ZU dZded<   	 dddd
ZdS )ExprYieldFromz%Yield statements like `yield from a`.rT   r   Tr@   r5   r:   r;   r<   c             #  J   K   dV  t          | j        |          E d {V  d S )Nzyield from r@   r2  r   s     r4   rJ   zExprYieldFrom.iterate  s?      $*4000000000000r3   Nr   r   r2   r3   r4   r  r    sL         //&* 1 1 1 1 1 1 1 1r3   r  ~r  +-&r  ^///<<@%r1  r>   >>andorz==z!=<z<=>z>=iszis notinznot inc                    t           j        S rq   r   r1   _s    r4   rs   rs   !  
    +2 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   "  
    /6 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   #  
    07 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   $  r  r3   c                    t           j        S rq   r  r  s    r4   rs   rs   &  r  r3   c                    t           j        S rq   r  r  s    r4   rs   rs   '  s
    ,3 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   (  s
    *1 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   )  r  r3   c                    t           j        S rq   r  r  s    r4   rs   rs   +  r  r3   c                    t           j        S rq   r  r  s    r4   rs   rs   ,  s
    .5 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   -  r  r3   c                    t           j        S rq   r   r0   r  s    r4   rs   rs   .  
    0? r3   c                    t           j        S rq   r  r  s    r4   rs   rs   /  r  r3   c                    t           j        S rq   r  r  s    r4   rs   rs   0  s
    +: r3   c                d    dt           j        i                    | j        t           j                  S )Nr  )r   r%   r   rH   r-   es    r4   rs   rs   1  s%    E#6#:;??
L_Lopp r3   c                <   t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        d| j                 S )N)r>   r1  r  r  r  r  r  r  r  r  r  r  r  )	r   r.   r,   r+   r*   r)   r(   r'   rH   r  s    r4   rs   rs   2  sh    !* / / /!0 / ( (!2!2 ( ( '  j r3   c                J    t           j        t           j        d| j                 S )N)r  r  )r   r$   r#   rH   r  s    r4   rs   rs   A  s    "5"9ATAWXXYZYcd r3   c                    t           j        S rq   )r   r&   r  s    r4   rs   rs   B  s
    .; r3   c                    t           j        S rq   )r   r"   r  s    r4   rs   rs   C  s
    ,4 r3   c                    t           j        S rq   )r   r   r  s    r4   rs   rs   D  r  r3   c                    t           j        S rq   r   r!   r  s    r4   rs   rs   E  s
    -4 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   G  s
     3 : r3   c                    t           j        S rq   r   r    r  s    r4   rs   rs   H  s
    !4!< r3   c                    t           j        S rq   r  r  s    r4   rs   rs   I  s
    19 r3   c                    t           j        S rq   r   r   r  s    r4   rs   rs   J  s
    ,2 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   K  s
    06 r3   c                    t           j        S rq   r   r   r  s    r4   rs   rs   N  s
    !4!9 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   O  s
    /4 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   P  s
    .3 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   Q  s
    05 r3   c                    t           j        S rq   r  r  s    r4   rs   rs   R  s
    ,1 r3   exprc                d    t                              t          |           d           |           S )Nc                    t           j        S rq   r  r  s    r4   rs   z!_get_precedence.<locals>.<lambda>W  s
    5H5M r3   )_precedence_mapr   type)r  s    r4   rE   rE   V  s*    tDzz+M+MNNtTTTr3   nodeast.Attributerk   Module | Classc                   t          | j        |fi |}t          |t                    r)|                    t          | j                             |S t          |t
                    r$t          |t          | j        |          g          S t          |t                    r$t          |t          | j        d          g          S t          |t          | j                  g          S )Nr|   )_buildr   rC   r   r   r   attrr|   )r  rk   r]   r   s       r4   _build_attributer  Z  s    $*f////D$&& HTY''((($!! @dHTY$=$=>???$ AdHTY$>$>?@@@$ 3 34555r3   	ast.BinOpc           	         t          t          | j        |fi |t          t	          | j                           t          | j        |fi |          S rq   )rG   r  r   _binary_op_mapr  r   r   r  rk   r]   s      r4   _build_binopr  f  sR    ty&++F++tDG}}%tz6,,V,,  r3   
ast.BoolOpc                    t          t          t          | j                           fd| j        D                       S )Nc                ,    g | ]}t          |fi S r2   r  rb   r   r]   rk   s     r4   rc   z!_build_boolop.<locals>.<listcomp>q  +    BBBUv	(	(	(	(BBBr3   )rI   _bool_op_mapr  r   r   r  s    ``r4   _build_boolopr  n  sB    T$']]#BBBBBdkBBB  r3   ast.Callc                    t          | j        fi fd| j        D             }fd| j        D             }t	          g ||          S )Nc                ,    g | ]}t          |fi S r2   r  )rb   argr]   rk   s     r4   rc   z_build_call.<locals>.<listcomp>w  s+    JJJvc644V44JJJr3   c                0    g | ]}t          |fd iS r   r  )rb   kwargr   r]   rk   s     r4   rc   z_build_call.<locals>.<listcomp>x  s0    bbb5F5&FF8FvFFbbbr3   )r  funcargskeywordsr   )r  rk   r]   positional_argskeyword_argsr   s    ``  @r4   _build_callr  u  sz    di22622HJJJJJ	JJJObbbbbbTXTabbbLH??,?@@@r3   ast.Comparec                    t          t          | j        fi d | j        D             fd| j        D                       S )Nc                B    g | ]}t           t          |                   S r2   )_compare_op_mapr  )rb   r   s     r4   rc   z"_build_compare.<locals>.<listcomp>  s#    666rb	"666r3   c                ,    g | ]}t          |fi S r2   r  )rb   r   r]   rk   s     r4   rc   z"_build_compare.<locals>.<listcomp>  s+    EEEDf	'	'	'	'EEEr3   )r   r  r   opsr   r  s    ``r4   _build_comparer  |  s]    ty&++F++66TX666EEEEED4DEEE  r3   ast.comprehensionc                    t          t          | j        fddit          | j        fi fd| j        D             t          | j                            S )Ncompr_targetTc                ,    g | ]}t          |fi S r2   r  )rb   	conditionr]   rk   s     r4   rc   z(_build_comprehension.<locals>.<listcomp>  s+    GGG	6	,	,V	,	,GGGr3   )r   )r   r  r   rW   ifsr:   r   r  s    ``r4   _build_comprehensionr    sw    t{F@@@@@ty&++F++GGGGGdhGGGdm$$	   r3   )in_formatted_strin_joined_strparse_stringsliteral_stringsast.Constantr  r  r  r  c                  t          | j        t                    rp|r	|s| j        S |rc|sa	 t          | j        ddt          j        d          }t          |j        |fi |S # t          $ r t          j
        d| j                   Y nw xY w t          d          d i                    t          | j                  t                    | j                  S )Nevalz<string-annotation>r   )modefilenameflagsoptimizezTried and failed to parse %r as Python code, falling back to using it as a string literal (postponed annotations might help: https://peps.python.org/pep-0563/).c                    dS )Nz...r2   r  s    r4   rs   z!_build_constant.<locals>.<lambda>  s     r3   )rC   r   r|   compileastPyCF_ONLY_ASTr  r  SyntaxErrorr   debugr  r   repr)r  rk   r  r  r  r  r]   parseds           r4   _build_constantr)    s    $*c"" = 	!1 	: 	= 	=
= J2+   fk6<<V<<<    \ J	     DDII'++D,<,<dCCDJOOOs   #A! !$BBast.Dictc                n    t          fd| j        D             fd| j        D                       S )Nc                4    g | ]}|d nt          |fi S rq   r  )rb   rt   r]   rk   s     r4   rc   z_build_dict.<locals>.<listcomp>  s3    UUUC&f"?"?"?"?UUUr3   c                ,    g | ]}t          |fi S r2   r  r  s     r4   rc   z_build_dict.<locals>.<listcomp>  r  r3   )r   r   r   r  s    ``r4   _build_dictr.    sN    UUUUU49UUUBBBBBdkBBB  r3   ast.DictCompc                    t          t          | j        fi t          | j        fi fd| j        D                       S )Nc                ,    g | ]}t          |fi S r2   r  rb   genr]   rk   s     r4   rc   z#_build_dictcomp.<locals>.<listcomp>  +    BBB3V	&	&v	&	&BBBr3   )r  r  rt   r   r  r  s    ``r4   _build_dictcompr5    s`    tx**6**tz6,,V,,BBBBB$/BBB  r3   )r  ast.FormattedValuec               F    t          t          | j        |fddi|          S )Nr  T)r  r  r   )r  rk   r  r]   s       r4   _build_formattedr8    s+     
FTTTTVTTUUUr3   ast.GeneratorExpc                l    t          t          | j        fi fd| j        D                       S )Nc                ,    g | ]}t          |fi S r2   r  r2  s     r4   rc   z'_build_generatorexp.<locals>.<listcomp>  r4  r3   )r  r  eltr  r  s    ``r4   _build_generatorexpr=    sI    tx**6**BBBBB$/BBB  r3   	ast.IfExpc           	         t          t          | j        |fi |t          | j        |fi |t          | j        |fi |          S rq   )rF   r  r  r  r  r  s      r4   _build_ifexpr@    sY    ty&++F++ty&++F++t{F--f--  r3   )r  ast.JoinedStrc               H    t          fd| j        D                       S )Nc                0    g | ]}t          |fd diS r  Tr  r  s     r4   rc   z$_build_joinedstr.<locals>.<listcomp>  s1    gggRW&MMdMfMMgggr3   )r!  r   )r  rk   r  r]   s    ` `r4   _build_joinedstrrE    s0     ggggg[_[fggghhhr3   ast.keywordr   r(  c                    | j          t          t          | j        |fi |          S t	          | j         t          | j        |fi ||          S )Nr   )r  r4  r  r   r'  )r  rk   r   r]   s       r4   _build_keywordrH    sX    xfTZBB6BBCCCtx
F!E!Ef!E!EPXYYYYr3   
ast.Lambdac                    t          fdt          | j                  D             t          | j        fi |          S )Nc                    g | ]A\  }}}}t          ||d t          |t                    r|nt          |d                    BS )NF)rk   r  )rl   r<  ry  rB  )rx  rC   r|   safe_get_expression)rb   rl   r  r<  rB  rk   s        r4   rc   z!_build_lambda.<locals>.<listcomp>  st     

 

 

 'aw gs++V(uUUU  

 

 

r3   )r8  r  )r7  r   r  r  r  r  s    ` r4   _build_lambdarM    se    

 

 

 

 +9*C*C

 

 

 DIv0000   r3   ast.Listc                H    t          fd| j        D                       S )Nc                ,    g | ]}t          |fi S r2   r  rb   r  r]   rk   s     r4   rc   z_build_list.<locals>.<listcomp>  s+    FFFbVB11&11FFFr3   )rJ  eltsr  s    ``r4   _build_listrS    s,    FFFFFDIFFFGGGr3   ast.ListCompc                l    t          t          | j        fi fd| j        D                       S )Nc                ,    g | ]}t          |fi S r2   r  r2  s     r4   rc   z#_build_listcomp.<locals>.<listcomp>  s-    <v<v<v_bVC=Z=ZSY=Z=Z<v<v<vr3   )rQ  r  r<  r  r  s    ``r4   _build_listcomprW    sD    tx::6::<v<v<v<v<vfjfu<v<v<vwwwr3   ast.NamerV  rU  c                .    t          | j        ||          S rq   )r   id)r  rk   rV  r]   s       r4   _build_namer[    s    DGVV,,,r3   ast.NamedExprc                f    t          t          | j        |fi |t          | j        |fi |          S rq   )ru  r  r   r   r  s      r4   _build_named_exprr^  	  s<    V>>v>>tzSY@d@d]c@d@deeer3   ast.Setc                H    t          fd| j        D                       S )Nc                ,    g | ]}t          |fi S r2   r  rQ  s     r4   rc   z_build_set.<locals>.<listcomp>  s+    EEERF2v0000EEEr3   )r|  rR  r  s    ``r4   
_build_setrb    s,    EEEEE49EEEFFFr3   ast.SetCompc                l    t          t          | j        fi fd| j        D                       S )Nc                ,    g | ]}t          |fi S r2   r  r2  s     r4   rc   z"_build_setcomp.<locals>.<listcomp>  s-    ;u;u;u^aF3<Y<YRX<Y<Y;u;u;ur3   )r  r  r<  r  r  s    ``r4   _build_setcomprf    sD    vdh99&99;u;u;u;u;ueiet;u;u;uvvvr3   	ast.Slicec           	         t          | j        d nt          | j        |fi || j        d nt          | j        |fi || j        d nt          | j        |fi |          S rq   )r  r   r  r  r  r  s      r4   _build_sliceri    sz    
"tz6(L(LV(L(L
"tz6(L(LV(L(L	!vdi'J'J6'J'J  r3   ast.Starredc                B    t          t          | j        |fi |          S rq   )r/  r  r   r  s      r4   _build_starredrl    s$    VDJAA&AABBBr3   r  r  subscript_sliceast.Subscriptrn  c                   t          | j        |fi |}|r?t          |t          t          f          r|j        dv rd}t          | j        |fd|dd|}nt          | j        |fddi|}t          ||          S )N>   typing.Literaltyping_extensions.LiteralTrm  rn  )r  r   rC   r   r   r   r  r   )r  rk   r  r  rn  r]   r   
slice_exprs           r4   _build_subscriptrt  !  s     $*f////D Pd]H566 	#4;N S
 <
 <
 #OJ
 + 
 
 
 


 DJOOOOO
z***r3   )rn  r  	ast.Tupler  c               P    t          fd| j        D             |p|          S )Nc                ,    g | ]}t          |fi S r2   r  rQ  s     r4   rc   z _build_tuple.<locals>.<listcomp>F  s+    GGGrfR22622GGGr3   )r  )r  rR  )r  rk   rn  r  r]   s    `  `r4   _build_tuplerx  >  s:     GGGGGTYGGGRaRqeqrrrrr3   ast.UnaryOpc                ~    t          t          t          | j                           t	          | j        |fi |          S rq   )r   _unary_op_mapr  r   r  operandr  s      r4   _build_unaryopr}  I  s4    }T$']]3VDL&5[5[TZ5[5[\\\r3   	ast.Yieldc                T    t          | j        d nt          | j        |fi |          S rq   )r  r   r  r  s      r4   _build_yieldr  M  s0    TZ/TTVDJ5Y5YRX5Y5YZZZr3   ast.YieldFromc                B    t          t          | j        |fi |          S rq   )r  r  r   r  s      r4   _build_yield_fromr  Q  s$    
F==f==>>>r3   c                      e Zd Zd
dZd	S )_BuildCallabler  r
   rk   r  r]   r;   rD   c                    d S rq   r2   )r   r  rk   r]   s       r4   __call__z_BuildCallable.__call__V  s      r3   N)r  r
   rk   r  r]   r
   r;   rD   )r   r   r   r  r2   r3   r4   r  r  U  s        UUUUUUr3   r  zdict[type, _BuildCallable]	_node_map)      ast.Interpolationc                B    t          t          | j        |fi |          S rq   )r  r  r   r  s      r4   _build_interpolationr  z  s$     
F!E!Ef!E!EFFFr3   ast.TemplateStrc                H    t          fd| j        D                       S )Nc                0    g | ]}t          |fd diS rD  r  r  s     r4   rc   z&_build_templatestr.<locals>.<listcomp>  s1    mmmX]uf S SD SF S Smmmr3   )r  r   r  s    ``r4   _build_templatestrr  }  s0    
 mmmmmaealmmmnnnr3   ast.ASTc               D    t          t          |                    | |fi |S rq   )r  r  r  s      r4   r  r    s%    T$ZZ v88888r3   rV  r  ast.AST | Nonebool | Nonec               z    | dS |#	 |j         }|j         }n# t          $ r d}Y nw xY wt          | |||          S )aZ  Build an expression from an AST.

    Parameters:
        node: The annotation node.
        parent: The parent used to resolve the name.
        member: The member name (for resolution in its scope).
        parse_strings: Whether to try and parse strings as type annotations.

    Returns:
        A string or resovable name or expression.
    NFr  )moduleimports_future_annotations
ValueErrorr  )r  rk   rV  r  r  s        r4   get_expressionr    so    $ |t	B]F !' AAMM  	" 	" 	"!MMM	" $v]KKKKs    ''zD{path}:{lineno}: Failed to get expression from {node_class}: {error})rV  r  	log_level
msg_formatr  LogLevel | Noner  r|   c               b   	 t          | |||          S # t          $ r}|Y d}~dS | j        j        }	 |j        }n# t
          $ r d}Y nw xY w| j        }	|j        j         d| }
|                    ||	||
          } t          t          |j
                  |           Y d}~nd}~ww xY wdS )a5  Safely (no exception) build a resolvable annotation.

    Parameters:
        node: The annotation node.
        parent: The parent used to resolve the name.
        member: The member name (for resolution in its scope).
        parse_strings: Whether to try and parse strings as type annotations.
        log_level: Log level to use to log a message. None to disable logging.
        msg_format: A format string for the log message. Available placeholders:
            path, lineno, node, error.

    Returns:
        A string or resovable name or expression.
    r  Nz<in-memory>r  )r   lineno
node_classerror)r  rf  r   r   relative_filepathr  r  formatrm   r   r   )r  rk   rV  r  r  r  r  r  r   r  	error_strmessages               r4   rL  rL    s    .2dF6WWWW 2 2 244444^,
	!%7DD 	! 	! 	! DDD	!/::5::	##f[d#ee(	((111111112 4s:    
B,B'B'<B'AB'
AAB''B,zG{path}:{lineno}: Failed to get %s expression from {node_class}: {error})r  ry  )r  r  z
base classzclass keywordr  )
r8   r9   r5   r:   r6   r:   r7   r   r;   r<   )rQ   rR   rS   rT   r5   r:   r;   r<   )r8   r\   r]   r
   r;   r^   )rf   rD   r]   r
   r;   rg   )r  rD   r;   r   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r  r:   r  r:   r  r:   r  r:   r]   r
   r;   rT   )r  r*  rk   r  r]   r
   r;   rD   )r  r/  rk   r  r]   r
   r;   rD   )
r  r6  rk   r  r  r:   r]   r
   r;   rD   )r  r9  rk   r  r]   r
   r;   rD   )r  r>  rk   r  r]   r
   r;   rD   )
r  rA  rk   r  r  r:   r]   r
   r;   rD   rq   )
r  rF  rk   r  r   r(  r]   r
   r;   rD   )r  rI  rk   r  r]   r
   r;   rD   )r  rN  rk   r  r]   r
   r;   rD   )r  rT  rk   r  r]   r
   r;   rD   )
r  rX  rk   r  rV  rU  r]   r
   r;   rD   )r  r\  rk   r  r]   r
   r;   rD   )r  r_  rk   r  r]   r
   r;   rD   )r  rc  rk   r  r]   r
   r;   rD   )r  rg  rk   r  r]   r
   r;   rD   )r  rj  rk   r  r]   r
   r;   rD   )r  ro  rk   r  r  r:   r  r:   rn  r:   r]   r
   r;   rD   )r  ru  rk   r  rn  r:   r  r:   r]   r
   r;   rD   )r  ry  rk   r  r]   r
   r;   rD   )r  r~  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )r  r  rk   r  r]   r
   r;   rD   )
r  r  rk   r  rV  rU  r  r  r;   r(  )r  r  rk   r  rV  rU  r  r  r  r  r  r|   r;   r(  )
__future__r   r#  sysdataclassesr   r   rw   enumr   r   	functoolsr   typingr	   r
   r   (griffe._internal.agents.nodes.parametersr   griffe._internal.enumerationsr   r   griffe._internal.exceptionsr   griffe._internal.loggerr   collections.abcr   r   r   pathlibr   griffe._internal.modelsr   r   r   r   r1   rL   r[   ra   rd   r   rD   r   rG   rI   r   r   r   r   r   r  r
  r  r  rF   r  r!  r'  r/  r4  r7  rJ  rQ  r   ru  rx  r|  r  r  r   r  r  r   r  r  InvertNotUAddUSubr{  AddBitAndBitOrBitXorDivFloorDivLShiftMatMultModMultPowRShiftSubr  AndOrr  EqNotEqLtLtEGtGtEIsIsNotInNotInr  r  rE   r  r  r  r  r  r  r)  r.  r5  r8  r=  r@  rE  rH  rM  rS  rW  r[  r^  rb  rf  ri  rl  rt  rx  r}  r  r  r  	AttributeBinOpBoolOpCallComparecomprehensionConstantDictDictCompFormattedValueGeneratorExpIfExp	JoinedStrkeywordLambdaListListCompName	NamedExprSetSetCompSliceStarred	SubscriptTupleUnaryOpYield	YieldFromr  r   version_infor  r  updateInterpolationTemplateStrr  r  r  rL  _msg_formatget_annotationsafe_get_annotationget_base_classsafe_get_base_classget_class_keywordsafe_get_class_keywordget_conditionsafe_get_conditionr2   r3   r4   <module>r     s   # " " " " " " 



 



 ! ! ! ! ! ! + + + + + +               / / / / / / / / / / C C C C C C A A A A A A A A ; ; ; ; ; ; * * * * * * @<<<<<<<<<<??????????" " " " "' " " "P ,?,F( ( ( ( ( (^ 	Y Y Y Y Y Y.       	  j> j> j> j> j> j> j> j>Z d$0( 0( 0( 0( 0(D 0( 0(  0(f d$c c c c c c c  c* d$\ \ \ \ \ \ \  \" d$    t    ( d$L L L L L$ L L  L$ d$A A A A A A A  A8 d$    4     d$    t    $ d$    4    ( d$5 5 5 5 54 5 5  5 d$
 
 
 
 
D 
 
  
 d$: : : : :t : :  : d$b b b b b b b  b8 d$
 
 
 
 
 
 
  
 d$	 	 	 	 	D 	 	  	 d$$1 $1 $1 $1 $1$ $1 $1  $1N d$1 1 1 1 1 1 1  1 d$1 1 1 1 1T 1 1  1 d$'[ '[ '[ '[ '[ '[ '[  '[T d$	 	 	 	 	t 	 	  	 d$    4      e4   Z* Z* Z* Z* Z*t Z* Z* ! Z*z d$1 1 1 1 1D 1 1  1 d$
 
 
 
 
D 
 
  
 d$	 	 	 	 	d 	 	  	 d$    $      d$4 4 4 4 4 4 4  4* d$&( &( &( &( &(D &( &(  &(R d$	 	 	 	 	d 	 	  	 d$
 
 
 
 
 
 
  
0 d$Y Y Y Y Y$ Y Y  Y d$
5 
5 
5 
5 
5 
5 
5  
5 d$1 1 1 1 1D 1 1  1 JGUHcHc	 GSJIsJGSL$JKGSHcGTJGS" GUFD FDItFCGTFCGTFDIxFDIx4224 664 77	4
 774 224 334 114 224 664 554 664 ??4  ??!4" ::#4$ pp%4&   '4D ddE4F ;;447744::<<992266 9944335511g4 4nU U U U	6 	6 	6 	6      A A A A       #!$P $P $P $P $P $PN       #	V V V V V V        	i i i i i iZ Z Z Z Z   "H H H Hx x x x- - - - -f f f fG G G Gw w w w   C C C C  !!+ + + + + +B "s s s s s s] ] ] ][ [ [ [? ? ? ?V V V V VX V V V)M#)I|) J) Hk	)
 K) +) L/) Hk) L/) () )) I|) M#) K) J)  Hk!)" L/#)$ HkM$GZKI|KM#I|KI|M$9) )	    > wG G G Go o o o 3O/	
  9 9 9 9 !%L L L L L LD !%!)\% % % % % %P Xt<<<g\)   
 u===g\)   
 GN%@@@  _,   
 e<<<W[(     r3   