
    I jd                       S r SSKJr  SSKrSSKJrJr  SSKJr  SSK	r	SSK
JrJrJr  SSKrSSKJr  SSKJr  SSKJs  Jr  SS	KJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&  SS
K'J(r(J)r)  SSK*J+r+  SSK,J-r-  \(       a  SSK.J/r/  S.S jr0S.S jr1S.S jr2S r3S r4\4" \2\1\0\(5      4   S/S jjr5S r6\6" \75      r8\6" \95      r:\;" S S \<" \5       5        5       5      r=\=4S jr>\;" S \= 5       5      r?\>" \R                  5      rA\>" \R                  5      rC\>" \R                  5      rE\>" \R                  5      rG\>" \R                  5      rI\>" \R                  5      rK\>" \R                  5      rM\>" \R                  5      rO\>" \R                  5      rQ\>" \R                  5      rS\>" \R                  5      rU\>" \R                  5      rV\>" \R                  5      rX\;" / SQ5      rY\;" / SQ5      rZ\C\A-  \S-  \U-  \V-  \X-  \G-  \Z-  \Y-
  r[\?\[-
  \Y-  r\\[\\-  r]S\] 3r^\](       a   \^5       eS0S jr_\" S5      r`S1S jraS rb\ \%S .rcS! rd\a" \[5      \d" \c5       " S" S#\R                  5      5       5       rf\;" / S$Q5      rg\;" \\-   5      rh\a" \[\g-  \I\;" / S%Q5      -  -
  5       " S& S'\f5      5       ri\a" \[\g-  \;" S(/5      -  5       " S) S*\f5      5       rj " S+ S,5      rk\j\iS-.rlg)2z
:func:`~pandas.eval` parsers.
    )annotationsN)partialreduce	iskeyword)TYPE_CHECKINGClassVarTypeVar)UndefinedVariableError)is_string_dtype)ARITH_OPS_SYMSBOOL_OPS_SYMSCMP_OPS_SYMS	LOCAL_TAGMATHOPS
REDUCTIONSUNARY_OPS_SYMSBinOpConstantFuncNodeOpTermUnaryOpis_term)clean_backtick_quoted_tokstokenize_string)Scope)printing)Callablec                "    U u  pXS:X  a  S4$ U4$ )a4  
Rewrite the assignment operator for PyTables expressions that use ``=``
as a substitute for ``==``.

Parameters
----------
tok : tuple of int, str
    ints correspond to the all caps constants in the tokenize module

Returns
-------
tuple of int, str
    Either the input or token or the replacement values
=== toktoknumtokvals      m/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/pandas/core/computation/expr.py_rewrite_assignr)   7   s"     NFS=444f44    c                    U u  pU[         R                  :X  a3  US:X  a  [         R                  S4$ US:X  a  [         R                  S4$ X4$ X4$ )a>  
Replace ``&`` with ``and`` and ``|`` with ``or`` so that bitwise
precedence is changed to boolean precedence.

Parameters
----------
tok : tuple of int, str
    ints correspond to the all caps constants in the tokenize module

Returns
-------
tuple of int, str
    Either the input or token or the replacement values
&and|or)tokenizeOPNAMEr$   s      r(   _replace_booleansr3   J   sS     NFS===%''s]==$&&~>r*   c                p    U u  pU[         R                  :X  a  US:X  a  [         R                  [        4$ X4$ )a  
Replace local variables with a syntactically valid name.

Parameters
----------
tok : tuple of int, str
    ints correspond to the all caps constants in the tokenize module

Returns
-------
tuple of int, str
    Either the input or token or the replacement values

Notes
-----
This is somewhat of a hack in that we rewrite a string such as ``'@a'`` as
``'__pd_eval_local_a'`` by telling the tokenizer that ``__pd_eval_local_``
is a ``tokenize.OP`` and to replace the ``'@'`` symbol with it.
@)r0   r1   r   r$   s      r(   _replace_localsr6   c   s4    ( NF3{{I%%>r*   c                   ^ ^ U U4S j$ )z
Compose 2 callables.
c                     > T" T" U 0 UD65      $ Nr#   )argskwargsfgs     r(   <lambda>_compose2.<locals>.<lambda>   s    1Q%7%7#8r*   r#   )r<   r=   s   ``r(   	_compose2r@   }   s     98r*   c                 N    [        U 5      S:  d   S5       e[        [        U 5      $ )z
Compose 2 or more callables.
   z.At least 2 callables must be passed to compose)lenr   r@   )funcss    r(   _composerE      s'     u:>KKK>)U##r*   c                   ^ [        T5      (       d   S5       e[        R                  " U4S j[        U 5       5       5      $ )a  
Compose a collection of tokenization functions.

Parameters
----------
source : str
    A Python source code string
f : callable
    This takes a tuple of (toknum, tokval) as its argument and returns a
    tuple with the same structure but possibly different elements. Defaults
    to the composition of ``_rewrite_assign``, ``_replace_booleans``, and
    ``_replace_locals``.

Returns
-------
str
    Valid Python source code

Notes
-----
The `f` parameter can be any callable that takes *and* returns input of the
form ``(toknum, tokval)``, where ``toknum`` is one of the constants from
the ``tokenize`` module and ``tokval`` is a string.
zf must be callablec              3  4   >#    U  H  nT" U5      v   M     g 7fr9   r#   ).0xr<   s     r(   	<genexpr>_preparse.<locals>.<genexpr>   s      (A 	
!(s   )callabler0   
untokenizer   sourcer<   s    `r(   	_preparserP      s>    < A;;,,,;  (  r*   c                   ^  U 4S j$ )zG
Factory for a type checking function of type ``t`` or tuple of types.
c                0   > [        U R                  T5      $ r9   )
isinstancevalue)rI   ts    r(   r>   _is_type.<locals>.<lambda>   s    Z+r*   r#   )rU   s   `r(   _is_typerW      s     ,+r*   c              #     #    U  H?  n[        U[        5      (       d  M  [        U[        R                  5      (       d  M;  Uv   MA     g 7fr9   )rS   type
issubclassastAST)rH   nodes     r(   rJ   rJ      s6      9$ 	",T377"; 	D9s   A	A	 	A	c              #  B   #    U  H  n[        [        U5      v   M     g 7fr9   )getattrr[   )rH   names     r(   rJ   rJ      s     9d##s   c                2   ^  U 4S jU 5       n[        U5      $ )z=
Filter out AST nodes that are subclasses of ``superclass``.
c              3  b   >#    U  H$  n[        UT5      (       d  M  UR                  v   M&     g 7fr9   )rZ   __name__)rH   r]   
superclasss     r(   rJ    _filter_nodes.<locals>.<genexpr>   s      VIDD*9U-$--Is   //)	frozenset)rd   	all_nodes
node_namess   `  r(   _filter_nodesri      s     WIVJZ  r*   c              #  8   #    U  H  oR                   v   M     g 7fr9   )rc   rH   rI   s     r(   rJ   rJ      s     ;
1JJ
   )AssignModuleExpr)YieldGeneratorExpIfExpDictCompSetCompReprLambdaSetr\   IsIsNotz$cannot both support and not support c                   ^  U 4S jnU$ )zN
Return a function that raises a NotImplementedError with a passed node name.
c                "   > [        ST S35      e)N'z' nodes are not implemented)NotImplementedError)selfr:   r;   	node_names      r(   r<    _node_not_implemented.<locals>.f
  s    !Ai[0K"LMMr*   r#   )r   r<   s   ` r(   _node_not_implementedr     s    
N Hr*   _Tc                   ^  SU 4S jjnU$ )zs
Decorator to disallow certain nodes from parsing. Raises a
NotImplementedError instead.

Returns
-------
callable
c                   > SU l         T H5  n[        U5      nSU 3nU =R                   U4-  sl         [        XU5        M7     U $ )Nr#   visit_)unsupported_nodesr   setattr)clsr]   
new_methodr`   nodess       r(   
disalloweddisallow.<locals>.disallowed   sN     "D.t4JD6?D!!dW,!Cz*  
r*   )r   type[_T]returnr   r#   )r   r   s   ` r(   disallowr     s    	 r*   c                   ^ ^ U U4S jnU$ )zc
Return a function to create an op class with its symbol already passed.

Returns
-------
callable
c                $   > [        TT/UQ70 UD6$ )zj
Return a partial function with an Op subclass with an operator already passed.

Returns
-------
callable
)r   )r~   r]   r:   r;   op_class	op_symbols       r(   r<   _op_maker.<locals>.f7  s     x<T<V<<r*   r#   )r   r   r<   s   `` r(   	_op_makerr   .  s    = Hr*   )binaryunaryc                   ^  U 4S jnU$ )z1
Decorator to add default implementation of ops.
c                   > TR                  5        HN  u  p[        X S35      n[        X S35      nU H'  nXE   nUc  M  [        X%5      n[        U SU 3U5        M)     MP     U $ )N_ops_op_nodes_mapr   )itemsr_   r   r   )	r   op_attr_namer   opsops_mapopop_nodemade_op
op_classess	           r(   r<   add_ops.<locals>.fL  sv    &0&6&6&8"L#t45Cc^=#ABG!+&'5GC6'!3W=	  '9 
r*   r#   )r   r<   s   ` r(   add_opsr   G  s    
	 Hr*   c                  (   \ rS rSr% Sr\rS\S'   \r	S\S'   \
\-   \-   rSr\" \" \\SS95      r\rS	r\" \" \\SS95      r\R.                  \R0                  \R2                  \R4                  \R0                  \R0                  \R4                  \R4                  0rS
\S'   \4S)S jjrS rS rS r S r!S*S jr"S r#S r$  S+S j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,S jr-\-r.S r/S,S jr0S-S  jr1S! r2S" r3S.S# jr4S$ r5S% r6S& r7S' r8S(r9g)/BaseExprVisitoriZ  z
Custom ast walker. Parsers of other engines should subclass this class
if necessary.

Parameters
----------
env : Scope
engine : str
parser : str
preparser : callable
zClassVar[type[Term]]
const_type	term_type)GtLtGtELtEEqNotEqInNotInBitAndBitOrAndOrAddSubMultDivPowFloorDivModTstrict)UAddUSubInvertNotztuple[str, ...]r   c                B    Xl         X l        X0l        X@l        S U l        g r9   )envengineparser	preparserassigner)r~   r   r   r   r   s        r(   __init__BaseExprVisitor.__init__  s    "r*   c                |   [        U[        5      (       a<  U R                  U5      n [        R                  " [        R
                  " U5      5      nS[        U5      R                   3n[        X5      nU" U40 UD6$ ! [         a3  n[        S UR                  5        5       5      (       a  SUl	        UeS nAff = f)Nc              3  8   #    U  H  n[        U5      v   M     g 7fr9   r   rk   s     r(   rJ   (BaseExprVisitor.visit.<locals>.<genexpr>  s     ;]y||]rl   z4Python keyword not valid identifier in numexpr queryr   )rS   strr   r[   fix_missing_locationsparseSyntaxErroranysplitmsgrY   rc   r_   )r~   r]   r;   cleanemethodvisitors          r(   visitBaseExprVisitor.visit  s    dC  NN4(E0051AB $t*--./$'t&v&&  ;U[[];;;RAEs   *A> >
B;.B66B;c                    [        UR                  5      S:w  a  [        S5      eUR                  S   nU R                  " U40 UD6$ )NrB   z#only a single expression is allowedr   )rC   bodyr   r   )r~   r]   r;   exprs       r(   visit_ModuleBaseExprVisitor.visit_Module  s?    tyy>QCDDyy|zz$)&))r*   c                <    U R                   " UR                  40 UD6$ r9   r   rT   r~   r]   r;   s      r(   
visit_ExprBaseExprVisitor.visit_Expr  s    zz$**///r*   c                   UR                   n[        U5      n[        U5      (       Ga  [        U5      (       a  XPR                  ;   a  [	        [
        X#45      u  pg[	        [        X#45      u  pU(       d  U(       d  U(       d  U	(       a  U R                  U   " 5       nU	(       aA  U R                  R                  UR                  /5      n
U R                  XR                  5      nU(       aA  U R                  R                  UR                  /5      n
U R                  XR                  5      nU R                  U5      nXX#4$ r9   )r   rY   r   rewrite_mapmap_is_list_is_strr   add_tmprT   r   r   )r~   r]   leftrightop_instanceop_type	left_list
right_listleft_str	right_strr`   r   s               r(   _rewrite_membership_op&BaseExprVisitor._rewrite_membership_op  s    gg{# 4==WU^^;K;K0K$'4-$@!I"%g}"=H J(i"..w79 xx''6tXX6xx''5~~dHH5ZZ$++r*   Nc                    Uc  U R                  UR                  SS9nUc  U R                  UR                  SS9nU R                  XU5      u  pEp#XEX#4$ )Nr   )sider   )r   r   r   r   )r~   r]   r   r   r   r   s         r(   _maybe_transform_eq_ne&BaseExprVisitor._maybe_transform_eq_ne  sZ    <::diif:5D=JJtzzJ8E$($?$?E$R!dT((r*   c                   [         R                  " [         R                  5      nUR                  (       a  [	        US5      (       au  UR                  (       dd  UR
                  U:X  aT  U R                  R                  [         R                  " UR                  5      5      nU R                  X@R                  5      nUR                  (       a  [	        US5      (       au  UR                  (       dd  UR
                  U:X  aT  U R                  R                  [         R                  " UR                  5      5      nU R                  X@R                  5      nX4$ )NrT   )
npdtypefloat32	is_scalarhasattrreturn_typer   r   rT   r   )r~   r   r   f32r`   s        r(   _maybe_downcast_constants)BaseExprVisitor._maybe_downcast_constants  s    hhrzz"NNg&&OO!!S( 88##BJJtzz$:;D>>$1DOOw''NN  C' 88##BJJu{{$;<DNN42E{r*   c                |    UR                  U R                  U R                  U R                  U R                  U5      $ r9   )evaluater   r   r   r   )r~   binopeval_in_pythons      r(   _maybe_evalBaseExprVisitor._maybe_eval  s0     ~~HHdkk4;;
 	
r*   c           	        U" X45      nUR                   (       a3  [        SUR                   SUR                   SUR                   S35      eU R                  S:w  aS  UR                  [
        ;   a  [        USS5      (       d  [        USS5      (       a  U R                  XpR                  5      $ UR                  U;   a  U R                  Xu5      $ U R                  S:w  at  [        USS 5      [        :X  dK  [        [        USS 5      5      (       d0  [        USS 5      [        :X  d  [        [        USS 5      5      (       a  U R                  XuU-   5      $ U$ )	Nz unsupported operand type(s) for z: 'z' and 'r|   pytablesis_datetimeFr   )has_invalid_return_type	TypeErrorr   rY   r   r   r_   r  
binary_opsobjectr   )r~   r   r   lhsrhsr  maybe_eval_in_pythonress           r(   _maybe_evaluate_binop%BaseExprVisitor._maybe_evaluate_binop  s,    l&&2366( ;HH:WSXXJa1 
 ;;*$VV|#]E(J(JsM511 ##C9966^###C88[[J&]D1V;"73t#DEE3t4>"73t#DEE ''>R-RSS
r*   c                t    U R                  U5      u  p4pVU R                  XV5      u  pVU R                  X4XV5      $ r9   )r   r  r  )r~   r]   r;   r   r   r   r   s          r(   visit_BinOpBaseExprVisitor.visit_BinOp  s<    $($?$?$E!d44TA))"DDr*   c                ~    U R                  UR                  5      nU R                  UR                  5      nU" U5      $ r9   )r   r   operand)r~   r]   r;   r   r  s        r(   visit_UnaryOpBaseExprVisitor.visit_UnaryOp!  s0    ZZ **T\\*'{r*   c                R    U R                   " UR                  U R                  40 UD6$ r9   )r   idr   r   s      r(   
visit_NameBaseExprVisitor.visit_Name&  s     ~~dggtxx:6::r*   c                N    U R                  UR                  U R                  5      $ r9   r   rT   r   r   s      r(   visit_NameConstant"BaseExprVisitor.visit_NameConstant*      tzz48844r*   c                N    U R                  UR                  U R                  5      $ r9   r"  r   s      r(   	visit_NumBaseExprVisitor.visit_Num.  r%  r*   c                N    U R                  UR                  U R                  5      $ r9   r"  r   s      r(   visit_ConstantBaseExprVisitor.visit_Constant1  r%  r*   c                    U R                   R                  UR                  5      nU R                  X0R                   5      $ r9   )r   r   sr   )r~   r]   r;   r`   s       r(   	visit_StrBaseExprVisitor.visit_Str5  s-    xx'~~dHH--r*   c                    U R                   R                  UR                   Vs/ s H#  o0R                  U5      " U R                   5      PM%     sn5      nU R	                  X@R                   5      $ s  snf r9   )r   r   eltsr   r   )r~   r]   r;   r   r`   s        r(   
visit_ListBaseExprVisitor.visit_List9  sQ    xx$)) L)QAtxx!8) LM~~dHH-- !Ms   *A0c                8    U R                  UR                  5      $ )zdf.index[4]r   r   s      r(   visit_IndexBaseExprVisitor.visit_Index?  s    zz$**%%r*   c                   SSK Jn  U R                  UR                  5      nU R                  UR                  5      nU" XPR
                  U R                  U R                  S9n UR                  U   nU R
                  R                  U5      n	U R                  XR
                  S9$ ! [         a-    U" X@R
                  U R                  U R                  S9nX   n Njf = f)Nr   )eval)
local_dictr   r   )r   )pandasr8  r   rT   slicer   r   r   AttributeErrorr   r   )
r~   r]   r;   pd_evalrT   slobjresultvr  r`   s
             r(   visit_SubscriptBaseExprVisitor.visit_SubscriptC  s    *

4::&

4::&hht{{4;;
	F#A xx"~~d~11  	((4;;t{{C A	s   $B' '4CCc                   UR                   nUb  U R                  U5      R                  nUR                  nUb  U R                  U5      R                  nUR                  nUb  U R                  U5      R                  n[        X4U5      $ )zdf.index[slice(4,6)])lowerr   rT   upperstepr;  )r~   r]   r;   rD  rE  rF  s         r(   visit_SliceBaseExprVisitor.visit_SliceW  sx    

JJu%++E

JJu%++Eyy::d#))DU4((r*   c                   [        UR                  5      S:w  a  [        S5      e[        UR                  S   [        R
                  5      (       d  [        S5      eU R                  R                  c  [        S5      e U R                  " UR                  S   40 UD6n[        USU5      U l        U R                  c  [        S5      eU R                  " UR                  40 UD6$ ! [         a    UR                  S   R                  n Nlf = f)z
support a single assignment node, like

c = a + b

set the assigner at the top level, must be a Name node which
might or might not exist in the resolvers

rB   z#can only assign a single expressionr   z5left hand side of an assignment must be a single namez%cannot assign without a target objectr`   z@left hand side of an assignment must be a single resolvable name)rC   targetsr   rS   r[   Namer   target
ValueErrorr   r   r  r_   r   rT   )r~   r]   r;   r   s       r(   visit_AssignBaseExprVisitor.visit_Assigne  s     t||!CDD$,,q/38844UVV88??"DEE	*zz$,,q/<V<H  &(;== R  zz$**/// & 	*||A))H	*s   ? C& &#DDc                T   UR                   nUR                  nUR                  n[        U[        R
                  5      (       a  U R                  U5      n[        US5      (       a  UR                  nOU" U R                  5      n [        Xs5      nU R                  R                  U5      n	U R                  XR                  5      $ [        S[!        U5      R"                   35      e! [         a5    [        U[        R                  5      (       a  UR                  U:X  a  Us $ e f = f)NrT   zInvalid Attribute context )attrrT   ctxrS   r[   Loadr   r   r   r_   r   r   r<  rK  r  rM  rY   rc   )
r~   r]   r;   rQ  rT   rR  visited_valueresolvedr@  r`   s
             r(   visit_AttributeBaseExprVisitor.visit_Attribute  s    yy

hhc388$$ JJu-M}g..(..(2H+xx''*~~dHH55 5d3i6H6H5IJKK " eSXX..588t3C#O	s   A C( (;D'%D'c                z   [        UR                  [        R                  5      (       a6  UR                  R                  S:w  a  U R                  UR                  5      nOP[        UR                  [        R                  5      (       d  [        S5      e U R                  UR                  5      nUc"  [        SUR                  R                   35      e[        US5      (       a  UR                  n[        U[        5      (       aY  UR                   Vs/ s H  oPR                  U5      PM     nnUR                   (       a  [        SUR"                   S35      eU" U6 $ UR                   Vs/ s H#  oPR                  U5      " U R$                  5      PM%     nnUR                    H  n[        U[        R&                  5      (       d#  [        SUR                  R                   S35      eUR(                  (       d  MX  U R                  UR                  5      " U R$                  5      X7R(                  '   M     U R$                  R+                  U" U0 UD65      nU R-                  XR$                  S	9$ ! [         a3     [        UR                  R                  5      n GN! [         a    e f = ff = fs  snf s  snf )
N__call__z"Only named functions are supportedzInvalid function call rT   z
Function "z$" does not support keyword argumentsz keyword error in function call 'r|   )r`   r   )rS   funcr[   	AttributerQ  rV  rK  r  r   r   r   r  rM  r   rT   r:   keywordsr`   r   keywordargr   r   )	r~   r]   r   r;   r  r^  new_argskeyr`   s	            r(   
visit_CallBaseExprVisitor.visit_Call  s   dii//DIINNj4P&&tyy1CDIIsxx00@AAjj+ ;(7  3  ))Cc8$$3799=9C

39H=}} 
*NO  >! >BYYGYc

31YHG}}!#s{{33 %:499<<.J  777&*jj&;DHH&EF77O % 88##C$<V$<=D>>t>::S * "499<<0C! 	" > Hs*   I3 J3.*J83
J0>J  J,,J0c                    U$ r9   r#   )r~   r   s     r(   translate_InBaseExprVisitor.translate_In  s    	r*   c           
        UR                   nUR                  n[        U5      S:X  aG  U R                  US   5      n[        R
                  " XQR                  US   S9nU R                  U5      $ UR                  n/ n[        X4SS9 HM  u  pYU R                  [        R                  " U	/XpR                  U5      /S95      n
U	nUR                  U
5        MO     U R                  [        R                  " [        R                  " 5       US95      $ )NrB   r   )r   r   r   Tr   )comparatorsr   r   )r   values)r   rg  rC   rd  r[   r   r   r   zipCompareappendBoolOpr   )r~   r]   r;   r   compsr   r  r   rh  compnew_nodes              r(   visit_CompareBaseExprVisitor.visit_Compare  s    hh   u:?""3q6*BII))58DE::e$$ yyCt4HBzzT@Q@QRT@U?VWH DMM(# 5 zz#**	&ABBr*   c                ^    [        U[        [        45      (       a  U$ U R                  U5      $ r9   )rS   r   r   r   )r~   bops     r(   _try_visit_binop BaseExprVisitor._try_visit_binop  s&    cB:&&Jzz#r*   c                B   ^ ^ UU 4S jnTR                   n[        X45      $ )Nc                   > TR                  U 5      nTR                  U5      nTR                  TX#5      u  pEp#TR                  UTR                  X#5      $ r9   )rt  r   r  r   )rI   yr  r  r   r   r]   r~   s         r(   r   -BaseExprVisitor.visit_BoolOp.<locals>.visitor  sS    ''*C''*C%)%@%@s%P"B#--b$''3DDr*   )rh  r   )r~   r]   r;   r   operandss   ``   r(   visit_BoolOpBaseExprVisitor.visit_BoolOp  s    	E ;;g((r*   )r   r   r   r   r   r   None)NN))inznot in)r"   z!=<>z<=z>=)r   r   )r   r;  r9   ):rc   
__module____qualname____firstlineno____doc__r   r   __annotations__r   r   r   r   r   r  binary_op_nodesdictri  binary_op_nodes_mapr   	unary_opsunary_op_nodesunary_op_nodes_mapr[   r   r   r   r   r   rP   r   r   r   r   r   r   r  r  r  r  r  r  r#  r'  r*  r.  r2  visit_Tupler5  rA  rG  rN  rV  ra  rd  rp  rt  r{  __static_attributes__r#   r*   r(   r   r   Z  sL   
 (0J$/&*I#*->JO* s:tLMI4Nc)^DIJ 			399		399	K '&6? '*0,6).	
" (?&PE

;555.. K&2()0<L01;fC*
	)r*   r   )Dictrl  r   r   )rl  r[  r   r   Tuplec                  N   ^  \ rS rSr\" \\" \\\	5      S94 SU 4S jjjr
SrU =r$ )PandasExprVisitori  )r<   c                &   > [         TU ]  XX45        g r9   superr   r~   r   r   r   r   	__class__s        r(   r   PandasExprVisitor.__init__   s     	f8r*   r#   r}  )rc   r  r  r  r   rP   rE   r6   r3   r   r   r  __classcell__r  s   @r(   r  r    s2     (9;UV

9 

9 
9r*   r  r   c                  :   ^  \ rS rSrSS j4 SU 4S jjjrSrU =r$ )PythonExprVisitori  c                    U $ r9   r#   rN   s     r(   r>   PythonExprVisitor.<lambda>  s    Fr*   c                "   > [         TU ]  XX4S9  g )N)r   r  r  s        r(   r   PythonExprVisitor.__init__  s     	fBr*   r#   r9   r}  )rc   r  r  r  r   r  r  r  s   @r(   r  r    s     .KC	C Cr*   r  c                      \ rS rSr% SrS\S'   S\S'   S\S'       S         SS	 jjr\S
 5       rS r	SS jr
SS jrS r\S 5       rSrg)ro   i  z
Object encapsulating an expression.

Parameters
----------
expr : str
engine : str, optional, default 'numexpr'
parser : str, optional, default 'pandas'
env : Scope, optional, default None
level : int, optional, default 2
r   r   r   r   r   Nc                    Xl         U=(       d    [        US-   S9U l        X l        X0l        [
        U   " U R                  U R                  U R                  5      U l        U R                  5       U l        g )NrB   )level)	r   r   r   r   r   PARSERS_visitorr   terms)r~   r   r   r   r   r  s         r(   r   Expr.__init__&  sU     	0%eai0$++t{{KZZ\
r*   c                0    [        U R                  SS 5      $ )Nr   )r_   r  r~   s    r(   r   Expr.assigner5  s    t}}j$77r*   c                8    U R                  U R                  5      $ r9   )r  r   r  s    r(   rY  Expr.__call__9  s    zz$((##r*   c                B    [         R                  " U R                  5      $ r9   )r   pprint_thingr  r  s    r(   __repr__Expr.__repr__<  s    $$TZZ00r*   c                ,    [        U R                  5      $ r9   )rC   r   r  s    r(   __len__Expr.__len__?  s    499~r*   c                L    U R                   R                  U R                  5      $ )z
Parse an expression.
)r  r   r   r  s    r(   r   
Expr.parseB  s     }}""499--r*   c                    [        U R                  5      (       a   [        U R                  R                  /5      $ [        S [        R
                  " U R                  5       5       5      $ )z!
Get the names in an expression.
c              3  8   #    U  H  oR                   v   M     g 7fr9   )r`   )rH   terms     r(   rJ   Expr.names.<locals>.<genexpr>O  s     G/Ft/Frl   )r   r  rf   r`   comflattenr  s    r(   names
Expr.namesH  sG    
 4::djjoo.//Gs{{4::/FGGGr*   )r  r   r   r   r   r  )numexprr:  Nr   )
r   r   r   r   r   zScope | Noner  intr   r~  )r   r   )r   r  )rc   r  r  r  r  r  r   propertyr   rY  r  r  r   r  r  r#   r*   r(   ro   ro     s    
 
JKK
   " " 	"
 " " 
" 8 8$1. H Hr*   ro   )pythonr:  )r%   tuple[int, str]r   r  )rO   r   r   r   )r   r   r   zCallable[..., None])r   zset[str]r   zCallable[[type[_T]], type[_T]])mr  
__future__r   r[   	functoolsr   r   r]  r   r0   typingr   r	   r
   numpyr   pandas.errorsr   pandas.core.dtypes.commonr   pandas.core.commoncorecommonr  pandas.core.computation.opsr   r   r   r   r   r   r   r   r   r   r   r   r   r   pandas.core.computation.parsingr   r   pandas.core.computation.scoper   pandas.io.formatsr   collections.abcr   r)   r3   r6   r@   rE   rP   rW   listr   r   r   rf   dir
_all_nodesri   _all_node_namesmod
_mod_nodesstmt_stmt_nodesr   _expr_nodesexpr_context_expr_context_nodesboolop_boolop_nodesoperator_operator_nodesunaryop_unary_op_nodescmpop_cmp_op_nodescomprehension_comprehension_nodesexcepthandler_handler_nodes	arguments_arguments_nodes_keyword_nodesalias_alias_nodes_hacked_nodes_unsupported_expr_nodes_unsupported_nodes_base_supported_nodesintersection_msgr   r   r   r   _op_classesr   NodeVisitorr   _python_not_supported_numexpr_supported_callsr  r  ro   r  r#   r*   r(   <module>r     su   # 
     0 5         0 &(5&249$ *O=W""
 	"J, D>
3-  9C9 
 )3 ! ;
;;377#
CHH%CHH%#C$4$45 cjj)-,cii($S%6%67 s001 / s{{+SYY' 67 $ $   	
    	  )+==N !$99	-l^<   T]0, 1& 

X)coo X)  X)v ""CD $Z'%9:  
//y!PQQS9 9	9 

4
4y%7I
IJC C KC:H :Hz '2C
Dr*   