
    Mha                       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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+  S,S jr,S,S jr-S,S jr.S r/S r0\0" \.\-\,\&5      4   S-S jjr1S r2\2" \35      r4\2" \55      r6\7" S S \8" \5       5        5       5      r9\94S jr:\7" S \9 5       5      r;\:" \Rx                  5      r=\:" \R|                  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      rR\:" \R                  5      rT\7" / SQ5      rU\7" / SQ5      rV\?\=-  \O-  \Q-  \R-  \T-  \C-  \V-  \U-
  rW\;\W-
  \U-  rX\W\X-  rYS\Y 3rZ\Y(       a   \Z5       eS.S jr[\" S5      r\S/S jr]S r^\\#S.r_S r`\]" \W5      \`" \_5       " S  S!\R                  5      5       5       rb\7" / S"Q5      rc\7" \\-   5      rd\]" \W\c-  \E\7" / S#Q5      -  -
  5       " S$ S%\b5      5       re\]" \W\c-  \7" S&/5      -  5       " S' S(\b5      5       rf " S) S*5      rg\f\eS+.rhg)0z
:func:`~pandas.eval` parsers.
    )annotationsN)partialreduce	iskeyword)CallableClassVarTypeVar)UndefinedVariableError)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)printingc                "    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      N/var/www/html/env/lib/python3.13/site-packages/pandas/core/computation/expr.py_rewrite_assignr'   1   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_booleansr1   D   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.
@)r.   r/   r   r"   s      r&   _replace_localsr4   ]   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>   w   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&   _composerC   ~   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r7   r!   ).0xr:   s     r&   	<genexpr>_preparse.<locals>.<genexpr>   s     E-Dqtt-Ds   )callabler.   
untokenizer   sourcer:   s    `r&   	_preparserN      s5    < A;;,,,;E_V-DEEEr(   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      $ r7   )
isinstancevalue)rG   ts    r&   r<   _is_type.<locals>.<lambda>   s    Z+r(   r!   )rS   s   `r&   _is_typerU      s     ,+r(   c              #     #    U  H?  n[        U[        5      (       d  M  [        U[        R                  5      (       d  M;  Uv   MA     g 7fr7   )rQ   type
issubclassastAST)rF   nodes     r&   rH   rH      s6      9$ 	",T377"; 	D9s   A	A	 	A	c              #  B   #    U  H  n[        [        U5      v   M     g 7fr7   )getattrrY   )rF   names     r&   rH   rH      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r7   )rX   __name__)rF   r[   
superclasss     r&   rH    _filter_nodes.<locals>.<genexpr>   s      VIDD*9U-$--Is   //)	frozenset)rb   	all_nodes
node_namess   `  r&   _filter_nodesrg      s     WIVJZ  r(   c              #  8   #    U  H  oR                   v   M     g 7fr7   )ra   rF   rG   s     r&   rH   rH      s     ;
1JJ
   )AssignModuleExpr)YieldGeneratorExpIfExpDictCompSetCompReprLambdaSetrZ   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)selfr8   r9   	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[   r8   r9   op_class	op_symbols       r&   r:   _op_maker.<locals>.f.  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>.fC  sv    &0&6&6&8"L#t45Cc^=#ABG!+&'5GC6'!3W=	  '9 
r(   r!   )r   r:   s   ` r&   add_opsr   >  s    
	 Hr(   c                  ,   \ rS rSr% Sr\rS\S'   \r	S\S'   \
\-   \-   rSr\" \" \\5      5      r\rSr\" \" \\5      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)-BaseExprVisitoriQ  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Mod)UAddUSubInvertNotztuple[str, ...]r   c                B    Xl         X l        X0l        X@l        S U l        g r7   )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r7   r   ri   s     r&   rH   (BaseExprVisitor.visit.<locals>.<genexpr>  s     ;]y||]rj   z4Python keyword not valid identifier in numexpr queryr   )rQ   strr   rY   fix_missing_locationsparseSyntaxErroranysplitmsgrW   ra   r]   )r|   r[   r9   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$ )Nr@   z#only a single expression is allowedr   )rA   bodyr   r   )r|   r[   r9   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$ r7   r   rR   r|   r[   r9   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$ r7   )r   rW   r   rewrite_mapmap_is_list_is_strr   add_tmprR   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$ )NrR   )
npdtypefloat32	is_scalarhasattrreturn_typer   r   rR   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      $ r7   )evaluater   r   r   r   )r|   binopeval_in_pythons      r&   _maybe_evalBaseExprVisitor._maybe_eval  s0     ~~HHdkk4;;
 	
r(   c           	     B   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  a>  [        USS 5      [        :X  d  [        USS 5      [        :X  a  U R                  XuU-   5      $ U$ )	Nz unsupported operand type(s) for z: 'z' and 'rz   pytablesis_datetimeFr   )
has_invalid_return_type	TypeErrorr   rW   r   r   r]   r  
binary_opsobject)r|   r   r   lhsrhsr  maybe_eval_in_pythonress           r&   _maybe_evaluate_binop%BaseExprVisitor._maybe_evaluate_binop  s    l&&2366( ;HH:WSXXJa1 
 ;;*$FFl"]E22sM511 ##C9966^###C88[[J&]D1V;3t4> ''>R-RSS
r(   c                t    U R                  U5      u  p4pVU R                  XV5      u  pVU R                  X4XV5      $ r7   )r   r   r  )r|   r[   r9   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      $ r7   )r   r   operand)r|   r[   r9   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$ r7   )r   idr   r   s      r&   
visit_NameBaseExprVisitor.visit_Name  s     ~~dggtxx:6::r(   c                N    U R                  UR                  U R                  5      $ r7   r   rR   r   r   s      r&   visit_NameConstant"BaseExprVisitor.visit_NameConstant       tzz48844r(   c                N    U R                  UR                  U R                  5      $ r7   r  r   s      r&   	visit_NumBaseExprVisitor.visit_Num$  r!  r(   c                N    U R                  UR                  U R                  5      $ r7   r  r   s      r&   visit_ConstantBaseExprVisitor.visit_Constant'  r!  r(   c                    U R                   R                  UR                  5      nU R                  X0R                   5      $ r7   )r   r   sr   )r|   r[   r9   r^   s       r&   	visit_StrBaseExprVisitor.visit_Str+  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 r7   )r   r   eltsr   r   )r|   r[   r9   r   r^   s        r&   
visit_ListBaseExprVisitor.visit_List/  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_Index5  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   )pandasr4  r   rR   slicer   r   r   AttributeErrorr   r   )
r|   r[   r9   pd_evalrR   slobjresultvr  r^   s
             r&   visit_SubscriptBaseExprVisitor.visit_Subscript9  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   rR   upperstepr7  )r|   r[   r9   r@  rA  rB  s         r&   visit_SliceBaseExprVisitor.visit_SliceM  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

r@   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)rA   targetsr   rQ   rY   Namer   target
ValueErrorr   r   r  r]   r   rR   )r|   r[   r9   r   s       r&   visit_AssignBaseExprVisitor.visit_Assign[  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                   UR                   nUR                  nUR                  n[        U[        R
                  5      (       a]  U R                  U5      R                  n [        Xc5      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)NzInvalid Attribute context )attrrR   ctxrQ   rY   Loadr   r]   r   r   r   r8  rG  r  rI  rW   ra   )	r|   r[   r9   rM  rR   rN  resolvedr<  r^   s	            r&   visit_AttributeBaseExprVisitor.visit_Attributey  s    yy

hhc388$$zz%(..H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 rR   z
Function "z$" does not support keyword argumentsz keyword error in function call 'rz   )r^   r   )rQ   funcrY   	AttributerM  rQ  rG  r	  r   r   r   r  rI  r   rR   r8   keywordsr^   r   keywordargr   r   )	r|   r[   r   r9   r  rY  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$ IILL>, 
 777&*jj&;DHH&EF77O % 88##C$<V$<=D>>t>::S * "499<<0C! 	" > Hs*   I3 J3.*J83
J0>J  J,,J0c                    U$ r7   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[        X45       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      $ )Nr@   r   )r   r   r   )comparatorsr   r   )r   values)r   rb  rA   r_  rY   r   r   r   zipCompareappendBoolOpr   )r|   r[   r9   r   compsr   r  r   rc  compnew_nodes              r&   visit_CompareBaseExprVisitor.visit_Compare  s    hh   u:?""3q6*BII))58DE::e$$ yyCHBzzT@Q@QRT@U?VWH DMM(# ( zz#**	&ABBr(   c                ^    [        U[        [        45      (       a  U$ U R                  U5      $ r7   )rQ   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      $ r7   )ro  r   r  r   )rG   yr  r  r   r   r[   r|   s         r&   r   -BaseExprVisitor.visit_BoolOp.<locals>.visitor  sS    ''*C''*C%)%@%@s%P"B#--b$''3DDr(   )rc  r   )r|   r[   r9   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   r7  r7   ):ra   
__module____qualname____firstlineno____doc__r   r   __annotations__r   r   r   r   r   r
  binary_op_nodesdictrd  binary_op_nodes_mapr   	unary_opsunary_op_nodesunary_op_nodes_maprY   r   r   r   r   r   rN   r   r   r   r   r   r   r   r  r  r  r  r  r  r#  r&  r*  r.  visit_Tupler1  r=  rC  rJ  rQ  r\  r_  rk  ro  rv  __static_attributes__r!   r(   r&   r   r   Q  sH   
 (0J$/&*I#*->JO* s:?@I4Nc)^<= 			399		399	K '&6? '*0,6).	
" (?%NE

;555.. K&2()0<L(1;fC*
	)r(   r   )Dictrg  r   r   )rg  rV  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 r7   superr   r|   r   r   r   r   	__class__s        r&   r   PandasExprVisitor.__init__  s     	f8r(   r!   rx  )ra   r}  r~  r  r   rN   rC   r4   r1   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 $ r7   r!   rL   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!   r7   rx  )ra   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)rm   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 )Nr@   )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.assigner'  s    t}}j$77r(   c                8    U R                  U R                  5      $ r7   )r  r   r  s    r&   rT  Expr.__call__+  s    zz$((##r(   c                B    [         R                  " U R                  5      $ r7   )r   pprint_thingr  r  s    r&   __repr__Expr.__repr__.  s    $$TZZ00r(   c                ,    [        U R                  5      $ r7   )rA   r   r  s    r&   __len__Expr.__len__1  s    499~r(   c                L    U R                   R                  U R                  5      $ )z
Parse an expression.
)r  r   r   r  s    r&   r   
Expr.parse4  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r7   )r^   )rF   terms     r&   rH   Expr.names.<locals>.<genexpr>A  s     G/Ft/Frj   )r   r  rd   r^   comflattenr  s    r&   names
Expr.names:  sG    
 4::djjoo.//Gs{{4::/FGGGr(   )r  r   r   r   r   r  )numexprr6  Nr   )
r   r   r   r   r   zScope | Noner  intr   ry  )r   r   )r   r  )ra   r}  r~  r  r  r  r   propertyr   rT  r  r  r   r  r  r!   r(   r&   rm   rm     s    
 
JKK
   " " 	"
 " " 
" 8 8$1. H Hr(   rm   )pythonr6  )r#   tuple[int, str]r   r  )rM   r   r   r   )r}   r   r   zCallable[..., None])r   zset[str]r   zCallable[[type[_T]], type[_T]])ir  
__future__r   rY   	functoolsr   r   rX  r   r.   typingr   r	   r
   numpyr   pandas.errorsr   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   r'   r1   r4   r>   rC   rN   rU   listr   r   r   rd   dir
_all_nodesrg   _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  rm   r  r!   r(   r&   <module>r     so   # 
     0         0 &5&249$ *O=WFF
 	FD, 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& 

S)coo S)  S)l ""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(   