+
    VBiq{                    h   ^ RI t ] P                  ! RG/ R]bR]bR]bR]bR]bR]bR]bR	]bR
]bR]bR]bR]bR]bR]bR]bR]bR]bR]b  ^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
Ht ^RIHt ^RIHtHt ]]3t^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHtHt ^R IHtHtH t  ^R!I!H"t"H#t# ^R"I$H%t% ^R#IH&t& R$ t']PP                  ]PR                  33R% lt*R& t+R' t,R( t-R) R* lt. ! R+ R,]P^                  4      t0R- t1R. t2 ! R/ R0]Pf                  4      t4 ! R1 R2]Pf                  4      t5 ! R3 R4]Pl                  ]%4      t7 ! R5 R6]Pl                  4      t8 ! R7 R8]Pf                  4      t9 ! R9 R:]Pt                  ]Pf                  4      t; ! R; R<]Pt                  ]Px                  4      t=R= t>]P~                  ! R>R?4      t@]P~                  ! R@R?4      tA ! RA RB]Pl                  ]%4      tB ! RC RD]Pf                  ]Pt                  4      tC ! RE RF]P                  4      tER# )H    NUtilityCodeEncodedStringbytes_literalencoded_stringNodes	ExprNodes
PyrexTypesBuiltin	UtilNodesOptionsUtilsrecopycodecs	itertools
attrgetterpartialreduce)r   r   )r   )	TypeSlots)UnicodeNodenot_a_constant)r   )r   )r	   )Visitor)r
   )r   )r   )r   TempitaUtilityCode)r   r   r   )errorwarning)SkipDeclarations)r   c                 0    \         P                  ! V R 4      # )
Optimize.c)r   load_cached)names   &=/usr/lib/python3.14/site-packages/Cython/Compiler/Optimize.pyload_c_utilityr"   %   s    ""466    c                 @    \        W4      '       d   V P                  # V # N)
isinstancearg)nodecoercion_nodess   &&r!   unwrap_coerced_noder*   )   s    $''xxKr#   c                 b    \        V \        P                  4      '       d   V P                  p K.  V # r%   )r&   r   ResultRefNode
expressionr(   s   &r!   unwrap_noder/   /   s#    
T922
3
3Kr#   c                    \        V 4      p \        V4      p\        V \        P                  4      '       d:   \        V\        P                  4      '       d   V P                  VP                  8H  # \        V \        P
                  4      '       d{   \        V\        P
                  4      '       d[   V P                  '       * ;'       dB    \        V P                  VP                  4      ;'       d    V P                  VP                  8H  # R # F)
r/   r&   r   NameNoder    AttributeNode
is_py_attris_common_valueobj	attribute)abs   &&r!   r5   r5   5   s    AAAA!Y''((Z9;M;M-N-Nvv!Y,,--*Q	@W@W2X2X<<``OAEE155$A``akkUVU`U`F``r#   c                 .    V e   V P                   f   R # V # r%   )constant_resultr.   s   &r!   filter_none_noder<   ?   s    D008Kr#   c                $    V ^8  d   QhR\         /# )   union_type_nodes)list)formats   "r!   __annotate__rB   E   s     #$ #$t #$r#   c                   aa \         P                  oVV3R  lo. pRpV RRR1,          pV'       Ed   VP                  4       p\        VS4      '       d   \	        S! V4      4      p\        V4      ^8X  d   VP                  4       \        P                  J d   VP                  P                  '       d   Vf   VP                  pMVP                  VP                  4       VP                  P                  '       d   Vf   VP                  pMVP                  VP                  4       EK  VP                  V4       EK  W3# )c              3      <"   \        V S4      '       d7   S! V P                  4       R j  xL
  S! V P                  4       R j  xL
  R # V P                  '       g   V P                  x  R # R #  LD L,5ir%   )r&   operand1operand2is_nonetype)	tree_nodeBitwiseOrNodecollect_tree_typess   &r!   rK   4_unpack_union_type_nodes.<locals>.collect_tree_typesI   s^     i//))*<*<===))*<*<==="""..  # >=s'   (A4A0A4A2A4A42A4N)r   rJ   popr&   setlenr
   	type_typerF   rG   appendrE   )r?   typesallowed_none_node
type_stacktptype_setrJ   rK   s   &     @@r!   _unpack_union_type_nodesrX   E   s    ++M! E!$B$'J
*^^b-(( -b12H8}!hlln8I8I&I;;&&&(0,.KK)%%bkk2;;&&&(0,.KK)%%bkk2R##r#   c                   t   a  ] tR t^kt o RtR t]P                  P                  t	R t
R tR tR tR tRtV tR	# )
_YieldNodeCollectorz1
YieldExprNode finder for generator expressions.
c                `    \         P                  P                  V 4       / V n        . V n        R # r%   )r   TreeVisitor__init__yield_stat_nodesyield_nodes)selfs   &r!   r]   _YieldNodeCollector.__init__o   s&    $$T* "r#   c                ^    V P                   P                  V4       V P                  V4       R # r%   )r_   rR   visitchildrenr`   r(   s   &&r!   visit_YieldExprNode'_YieldNodeCollector.visit_YieldExprNodev   s$    %4 r#   c                    V P                  V4       VP                  V P                  9   d   WP                  VP                  &   R # R # r%   )rc   exprr_   r^   rd   s   &&r!   visit_ExprStatNode&_YieldNodeCollector.visit_ExprStatNodez   s9    4 99(((/3!!$)), )r#   c                    R # r%    rd   s   &&r!   visit_GeneratorExpressionNode1_YieldNodeCollector.visit_GeneratorExpressionNode       r#   c                    R # r%   rl   rd   s   &&r!   visit_LambdaNode$_YieldNodeCollector.visit_LambdaNode   ro   r#   c                    R # r%   rl   rd   s   &&r!   visit_FuncDefNode%_YieldNodeCollector.visit_FuncDefNode   ro   r#   )r_   r^   N)__name__
__module____qualname____firstlineno____doc__r]   r   r\   rc   
visit_Nodere   ri   rm   rq   rt   __static_attributes____classdictcell____classdict__s   @r!   rZ   rZ   k   s@     
 $$22J!4 r#   rZ   c                 N    \        V 4      p\        V4      ^8w  d   R# V^ ,          # )   )NN)_find_yield_statementsrP   )r(   yield_statementss   & r!   _find_single_yield_expressionr      s,    -d3
!Ar#   c                     \        4       pVP                  V 4        VP                   Uu. uF"  pVP                  VP                  V,          3NK$  	  ppV# u upi   \
         d    . p T# i ; ir%   )rZ   rc   r_   r'   r^   KeyError)r(   	collector
yield_noder   s   &   r!   r   r      s    #%ID! (33
3
 ^^Y77
CD3 	 
 
  s"   A (AA A A-,A-c                     a  ] tR t^t o RtR tR tR!R ltR tR!R lt	]
P                  ! ]
P                  ]
P                  ! R]P                  R4      .R	R
7      t]
P                  ! ]
P"                  ]
P                  ! R]P                  R4      .R"R
7      tR!R lt]
P                  ! ]
P(                  ]
P                  ! R]
P*                  R4      ]
P                  ! R]
P,                  R4      ]
P                  ! R]
P"                  R4      .4      t]
P                  ! ]
P*                  ]
P                  ! R]
P0                  R4      ]
P                  ! R]
P2                  R4      ]
P                  ! R]
P4                  R4      ]
P                  ! R]
P6                  R4      .R"R
7      tR!R ltR!R ltR tR t R!R lt!R t"R t#]
P                  ! ]
P0                  ]
P                  ! R]
P0                  R4      ]
P                  ! R]
P*                  R4      ]
P                  ! R]
P0                  R4      ]
P                  ! R]
P2                  R4      ]
P                  ! R]
P6                  R4      .4      t$]
P                  ! ]
P0                  ]
P                  ! R]
P0                  R4      ]
P                  ! R]
P*                  R4      ]
P                  ! R]
P2                  R4      ]
P                  ! R]
P6                  R4      .4      t%R t&R t'V t(R# )#IterationTransformzTransform some common for-in loop patterns into efficient C loops:

- for-in-dict loop becomes a while loop calling PyDict_Next()
- for-in-enumerate is replaced by an external counter variable
- for-in-range loop becomes a plain C for loop
c                   VP                  4       '       Edb   VP                  p\        P                  ! V4      pVP                  P
                  '       d,   VP                  P                  P                  P                  pM VP                  P                  P                  p\        P                  ! V4      pVP                  V4      p\        P                  ! VR VP                  VR7      p\        P                  ! V\        P                   ! W#\        P"                  ! VRR7      R7      \        P$                  ! V4      .R7      p\        P&                  ! V\        P(                  ! W'VR7      .RR7      p	\        P*                  ! VV.\        P,                  ! VV\        P.                  ! VP                  P                  VP                  R	7      V	\        P                   ! W#\        P"                  ! VR
R7      R7      R7      R7      p
V
P1                  V P3                  4       4      p
V P5                  V
4      p
\        P6                  ! W:4      pVP8                  R8X  d   \        P:                  ! W+R7      pV# V P=                  V4       V# )==operatorrE   rF   Tvaluelhsrhsstats	conditionbodyN
if_clauseselse_clause)sequenceF)targetiteratorr   r   tempsr   not_inoperand)is_ptr_containsposr   r,   rF   is_subscriptbaserH   	base_type
TempHandlerefr   PrimaryCmpNoderE   r   StatListNodeSingleAssignmentNodeBoolNodeBreakStatNode
IfStatNodeIfClauseNodeTempsBlockNodeForInStatNodeIteratorNodeanalyse_expressionscurrent_envvisitTempResultFromStatNoder   NotNoderc   )r`   r(   r   
result_refr   target_handler   cmp_nodeif_bodyif_nodefor_loopnew_nodes   &&          r!   visit_PrimaryCmpNode'IterationTransform.visit_PrimaryCmpNode   s   !! ((C"006J}}))) MM..33==	 MM..88	%00;M"&&s+F //dT]]VMH((33CYM_M_`ckoMpq,,S134G &&!..sWUV "G !//&**!&33DMM4E4EPTP]P]^  % : :1C1CCu1U!WX	YH  33D4D4D4FGHzz(+H 77
MH}}($,,SCO t$Kr#   c                n    V P                  V4       V P                  WP                  P                  4      # r%   )rc   _optimise_for_loopr   r   rd   s   &&r!   visit_ForInStatNode&IterationTransform.visit_ForInStatNode   s+    4 &&t]]-C-CDDr#   c           	        VP                   pR pVP                  '       g   VP                  '       dm   VP                  '       d[   VP                  P                  '       d?   VP                  P                  P
                  pVP                  '       d   VP                  p\        P                  WE39   d    V'       d   V# V P                  WR RRR7      # \        P                  WE39   g   \        P                  WE39   d   V'       d   V# V P                  W4      # V P                  4       pVP                  '       g   VP                   '       d   V P#                  WVR7      # VP$                  '       Ed   VP&                  '       Eg   \(        P*                  ! WrVR7      pV'       d   VP,                  '       g   \.        ;QJ d&    R VP0                   4       F  '       g   K   RM	  RM! R VP0                   4       4      '       g   \(        P2                  ! VP4                  VP0                  R7      P7                  V4      P9                  \:        P<                  ! V\?        VP0                  4      4      V4      pV P#                  WVR7      # VP@                  '       Ed2   VP&                  '       Eg   V\        PB                  J d,   \:        PD                  p\G        \H        VPJ                  4      p	M\:        PL                  pVPJ                  p	\O        \(        PP                  PR                  VP4                  VR7      p
\(        P2                  ! VP4                  V	 Uu. uF
  q! V4      NK  	  upR7      pVP7                  V4      P9                  \:        P<                  ! V\?        VP0                  4      4      V4      pV P#                  WVR7      # V\        PT                  J d:   VP&                  '       d   V PW                  WRVR	7      # V PY                  WVR7      # V\        PB                  J d   V P[                  WVR7      # V\        P\                  J d   V PW                  WRVR	7      # \_        V\(        P`                  4      '       dE   VPb                  P                   Pd                  '       d   V PW                  WPb                  RVR	7      # \_        V\(        Pf                  4      '       g   V# VP0                  f?   VPh                  ;'       d(    \?        VPh                  P0                  4      ;'       g    ^ pM4\?        VP0                  4      pV'       d   VPj                  e
   V^,          pVPl                  pVP                  '       Edh   V'       Eg_   V'       EgV   VPj                  ;'       g    VPn                  pVPp                  pV Ps                  4       Pt                  Pv                  ^8  pV'       g   VR9   d   \_        V\(        Px                  4      '       d`   VPl                  pVP                  '       dB   VPz                  R8X  d1   VP                  '       d   VP                  P|                  '       d   RpR;ppVR8X  g   V'       d   VR
8X  d   RpM3VR8X  g   V'       d   VR8X  d   RpMVR8X  g   V'       d   VR8X  d   R;ppV'       g	   V'       d   V P                  WVVV4      # VPj                  f   VP                  '       d   VP                  '       du   VP                  P|                  '       dY   VPz                  R8X  d   V'       d   V# V P                  W4      # VPz                  R8X  d   V'       d   V# V P                  W4      # \        P                  '       Ed   ^Tu;8:  d	   ^8:  Ed   M V# VPj                  Efz   VP                  '       Edg   VPz                  R9   EdU   VP                  '       EdB   VP                  P|                  '       Ed%   VP                  P                   P                  '       g'   VP                  P                   P                  '       d   V P                  WVR7      # VP                  P                   P,                  '       d   VP0                  f   VPh                  P0                  MVP0                   FX  p\_        V\(        PP                  4      '       d5   VP                  4       '       d   RVP                  u;8:  d   R8  d   M MKW   V# 	  V P                  WVR7      # V# u upi )NTF)dict_objmethodkeysvaluesreversed)seq_typec              3   8   "   T F  qP                   x  K  	  R # 5ir%   )
is_starred).0items   & r!   	<genexpr>8IterationTransform._optimise_for_loop.<locals>.<genexpr>   s     Bm_lW[??_l   argsrH   )
is_mutabler   r   r   itemsdictiterkeys
itervalues	iteritems	enumerater   )r   r   r   )rangexrange   @   )IrH   is_nameis_attributeentry
annotationrh   r   r   r
   	dict_type_transform_dict_iterationset_typefrozenset_type_transform_set_iterationr   is_ptris_array_transform_carray_iterationis_sequence_constructoris_generator_scoper   infer_sequence_item_typeis_pyobjectanyr   ListNoder   analyse_types	coerce_tor	   c_array_typerP   is_string_literalunicode_typec_py_ucs4_typemapordr   c_uchar_typer   IntNodefor_int
bytes_type_transform_indexable_iteration_transform_bytes_iteration_transform_unicode_iterationbytearray_typer&   CoerceToPyTypeNoder'   is_memoryviewsliceSimpleCallNode	arg_tupler`   functionr6   r7   global_scopecontextlanguage_levelCallNoder    
is_builtin_transform_enumerate_iteration_transform_reversed_iterationr   convert_ranger   is_intis_enum_transform_range_iterationhas_constant_resultr;   )r`   r(   iterabler   	iter_typeannotation_typer   env	item_typer   as_int_nodech	arg_countr
  base_objr   is_safe_iterinner_functionr   r   r'   s   &&&&                 r!   r   %IterationTransform._optimise_for_loop   s%   MM	 5 5 58>>>hnnNgNgNg!2277J&&&'__
 <<114 2 O O  <<&&9*FF00@@  y11133DX3VV+++C4J4J4J "::	3I!6!6!6ssBm_g_l_lBmsssBm_g_l_lBm?m?m$--hllO]]^abll++Is8==7IJCQ77QY7ZZ%%%c.D.D.D G000&55	C0&33	 !)"3"3";";X\\PYZK ))(,,W\=]W\QSk"oW\=]^H--c2<<Z=T=TU^`cdldqdq`r=suxyH33DX3VV***%%%::4V[fn:oo66tPX6YY,,,44Th4WW ...66tRVai6jjh	 < <==(,,BSBSBfBfBf66t\\V[fn6oo (I$<$<==K==  **KKs83E3E3J3J/KPPqIHMM*IX]]6Q	$$   ))}}44H''F,,.66EEJLF.I$Ih	(:(:;;%-%6%6N&...>3F3F&3P . 4 4 4 . 4 4 ? ? ?'+!!D6#69I<'LVx=O;&<Fg<M $$vv55FD&: : == X%5%5%5~~~(..";";";}}+K::4JJ*,K99$II    Q)%8q%8   %   X]]6I%I8>>#<#<#<{{&&&$++*:*:*B*B*B66tPX6YY{{+++7?}}7LH..33RZR_R__C!#y'8'89922443CVCV9^Y^9^$  `  ::4T\:]]s >^s   e
c                   VP                   P                  p\        V4      ^ 8X  d   \        VP                  R4       V# \        V4      ^8  d   \        VP                  R4       V# V^ ,          pVP
                  \        P                  \        P                  39   d4   VP                  R4      VP                  n        RVP                  n        V# V P                  WRR7      # )r   z(reversed() requires an iterable argumentz#reversed() takes exactly 1 argument!'NoneType' object is not iterableTr   )r	  r   rP   r   r   rH   r
   
tuple_type	list_typeas_none_safe_noder   r   r   r   )r`   r(   reversed_functionr   r'   s   &&&  r!   r  0IterationTransform._transform_reversed_iterationh  s     **//t9>#''<>KY]#''79K1g 88**G,=,=>>%(%:%:;^%_DMM"%)DMM"K&&t4&@@r#   c                
   . p\         P                  ! VP                  R4      RRR7      pVP                  V4       \        P
                  ! VP                  \        P                  ! VP                  R\        P                  P                  R4      R7      V.R7      pV'       d   TpM7\         P                  ! V\        P                  R7      pVP                  V4       \         P                  ! \        P                  ! VP                  RR	7      4      p	VP                  V	4       V'       d1   Tp
\        P                  P                  VP                  ^ 4      pR
RrM-\        P                  P                  VP                  R4      p
RRr\         P                   ! V
4      p\         P                  ! V
\        P                  R7      pVP                  V4       \        P"                  ! VP                  VVVR7      pV'       dO   V'       dG   \        P$                  ! VP                  RV\        P"                  ! VP                  VVVR7      R7      p\&        P(                  ! VP                  \&        P*                  ! VP                  V	\        P                  ! VP                  RR	7      R7      \&        P,                  ! VP                  4      .R7      p\        P.                  ! VP                  WnR7      p\&        P*                  ! VP0                  P                  VP0                  VR7      pV P3                  4       p\4        P6                  ! VP8                  RRR7      p\&        P:                  ! VP                  VVR7      p\&        P<                  ! VP                  \&        P>                  ! VP                  VVR7      .VR7      pV'       dc   VP@                  PB                  '       g   Q VP@                  4       h\&        PD                  ! VP                  V.VR7      pVPG                  V4       \&        P(                  ! VP                  \&        P*                  ! VP                  T\        PH                  ! VP                  V'       d   RMRRV\        P                  P                  VP                  ^4      R7      R7      V.R7      p\&        PJ                  ! VP                  V	VVPL                  R7      pTpVRRR1,           F  p\         PN                  ! VV4      pK  	  VPQ                  V4      pVPR                  P                  VPT                  4       V# )zUIteration over iterables that Cython has a len() for and knows how to index.
        'NoneType' is not iterableFT)may_hold_noneis_temprP   )r    r   r
  r   r   r   >>=<=<r   andr   r   )r   indexr   r   r   )boundscheck
wraparound)
directivesr   r   r   )r   r   -+)r   inplacerE   rF   r   r   r   NrM   )+r   
LetRefNoder'  rR   r   r  r   r2   r
   builtin_scopelookupr	   c_py_ssize_t_typer   r   for_sizer   r   BoolBinopNoder   r   r   ContinueStatNode	IndexNoder   r   r   copy_inherited_directivesr8  CompilerDirectivesNoder   r   rH   r   CriticalSectionStatNodeanalyse_declarations
binop_nodeWhileStatNoder   LetNoder   r   r   )r`   r(   
slice_noder   r   
temp_nodesunpack_temp_nodelength_call_nodeend_nodekeep_going_ref
start_node	relation1	relation2start_check_nodecounter_ref	test_nodefailed_test_bodytarget_valuetarget_assignr  new_directiveslength_check_and_target_assignr   	loop_noderetlet_ref_nodes   &&&&&                     r!   r  1IterationTransform._transform_indexable_iteration|  sH   & 
$//(()EF

 	*+$33HH''u++2259 ##
 'H ++,<:C_C_`Hh'"--i.@.@QU.VW.)!J ((11$((A>H#&y"**33DHHbAJ#'y99Z0**:J<X<XY+&,,HH 	
	 (!//""11HH&-(		
I !--HH **HH&!**4885A
 &&txx0
 !**:>>@Pd22++//++
   ::3>>W\ino44%
 */)9)9HH""HH'& )
*
& ??...?
?. .3-J-J&'3.*
 +??D!!HH**HH#!,,(0c $!,!*!2!2!;!;DHHa!H
 /$ ''HH&**	
	 &tt,,L##L#6C - %%c*

$))$
r#   sNNULLexception_valuec                8   VP                   P                  pVP                  '       g   V\        P                  Jd   V# \
        P                  ! VP                  R 4      4      p\        P                  ! VP                  RV P                  V.^R7      p\        P                  ! VP                  RV P                  V.^R7      p\
        P                  ! VV P                  V\        P                  ! VP                  VRRVVP                  ^R7      VR7      4      # )r+  __Pyx_PyBytes_AsWritableStringr   r-  __Pyx_PyBytes_GET_SIZEN)r   startstepstoprH   r-  r   )r   rH   r  r
   r  r   r=  r'  r   PythonCapiCallNoder   PyBytes_AS_STRING_func_typePyBytes_GET_SIZE_func_typerK  r   SliceIndexNode)r`   r(   rL  r   target_typerN  slice_base_nodelen_nodes   &&&&    r!   r  -IterationTransform._transform_bytes_iteration*  s   kk&&!!!k9K9K&K K$//(()EFH $66NN<,,$%	 //NN4++$%	   ,,((NN* #*// $ - %& 	&r#   kinddatar4  lengthc                
   V P                  4       pVP                  '       d   VP                  '       g    \        VP                  P                  R 4      R4      p\        P                  ! VP                  \        P                  ! VP                  VV\        P                  R7      P                  \        P                  V4      R\        P                  P                  VP                  \!        V4      4      \"        P$                  R7      pV P'                  WV4      # \*        P,                  ! VP/                  R4      4      p\        P                  P                  VP                  ^ 4      p\*        P0                  ! \        P2                  4      p	V	P5                  VP                  4      p
V'       d   RRrYrMRR	r\*        P0                  ! \        P6                  4      p\*        P0                  ! \        P8                  4      p\*        P0                  ! \        P2                  4      p\        P:                  ! VP                  R
V P<                  VP5                  VP                  4      VP5                  VP                  4      VP5                  VP>                  P                  4      .RR7      pVP@                  VP>                  P@                  8w  d'   VP                  VP>                  P@                  V4      p\B        PD                  ! VP>                  P                  VP>                  VR7      p\B        PF                  ! VP                  VVPH                  .R7      p\B        PJ                  ! VP                  WVP5                  VP>                  P                  4      WRVVPL                  RR7
      p\B        PN                  ! VP                  \        P:                  ! VP                  RV PP                  V\        PR                  ! VP                  V	P5                  VP                  4      \        PT                  R7      \        PR                  ! VP                  VP5                  VP                  4      \        PV                  R7      \        PR                  ! VP                  VP5                  VP                  4      \        PX                  R7      .RR\Z        P\                  ! RR4      R7      R7      p\*        P^                  ! V\*        P`                  ! VP                  WW.\B        PF                  ! VP                  VV.R7      R7      4      #   \(         d     ELCi ; i)latin1z	iso8859-1r   r;   rH   N)r   ri  rk  rH   r+  r/  r0  r1  r2  __Pyx_PyUnicode_READFrg  r5  r   T	bound1rS  r   rT  bound2rj  r   r   
from_range__Pyx_init_unicode_iterationr   rH   unicode_iterr   )r   r-  result_is_usedutility_code)rh   r   )1r   
is_literalr   r   r   encoder   ro  r   	BytesNoder	   c_const_char_ptr_typer   c_const_uchar_ptr_typer   rA  rP   r
   r   r   UnicodeEncodeErrorr   r=  r'  r   r@  r   
c_int_typec_void_ptr_typerl  PyUnicode_READ_func_typer   rH   r   r   r   r   ForFromStatNoder   ExprStatNode init_unicode_iteration_func_typeAmpersandNodec_py_ssize_t_ptr_typec_void_ptr_ptr_typec_int_ptr_typer   r   rK  r   )r`   r(   rL  r   r  bytes_valuebytes_slicerN  rR  length_temprP  rS  rT  	kind_temp	data_tempcounter_temprY  rZ  r   r]  
setup_nodes   &&&&                 r!   r  /IterationTransform._transform_unicode_iterationa  s       )?)?)?U+J,<,<,C,CH,M{[ (66NN",,"k(3'==? @Iy&==s@D"**33JNNCDTU --
 778TT$//(()EFH &&//!<
**:+G+GH??488,#&y#+#'y(()>)>?	(()C)CD	 ++J,H,HI 33NN2))MM*..1MM*..1 $$T[[__57   0 00'11$++2B2BCHL22++//++  !!HH"DII.0 ))HH##DKKOO4D((	 ''HH// >55(!//
XbXfXfHg5?5U5UW!//
	V`VdVdHe5?5S5SU!//
	V`VdVdHe5?5N5NP !&(44^\R
"   $$I Q''Y8OPRS 	SY & s   %U U#"U#c                Z   R p\        V\        P                  4      '       dw   VP                  p\	        VP
                  4      p\	        VP                  4      pRpV'       g5   VP                  P                  '       g   \        VP                  R4       V# EMIVP                  '       Eds   \        VP                  \        P                  4      '       g   Q hVP                  pVP                  p	\	        V	P
                  4      p\	        V	P                  4      p\	        V	P                  4      pV'       d   \        VP                  \         4      '       dD   VP                  ^ 8X  g3   VP                  ^ 8  d	   V'       d   VP                  ^ 8  d=   V'       g5   VP                  P                  '       g   \        VP                  R4       V# VP                  p
V'       d   V
) p
V
^ 8  p\        P"                  P%                  VP                  \'        V
4      4      pMVP                  P(                  '       du   VP                  P*                  f   \        VP                  R4       V# TpR;rh\        P"                  P%                  VP                  VP                  P*                  4      pM4VP                  P                  '       g   \        VP                  R4       V# V'       d/   VP-                  \.        P0                  V P3                  4       4      pV'       d/   VP-                  \.        P0                  V P3                  4       4      pVfL   V'       d,   \        P"                  P%                  VP                  R4      pM\        VP                  R4       V# V'       d5   V'       g+   \        P"                  P%                  VP                  ^ 4      pYvrvVP                  pVP(                  '       d   VP5                  4       pVP7                  V P3                  4       4      pV'       d8   VP                  ^ 8w  d'   \        P8                  ! VP                  VRVVR7      pMTpV'       di   VP                  ^ 8w  dX   \        P8                  ! VP                  \        P:                  ! V4      RVVR7      P7                  V P3                  4       4      pM\        P:                  ! V4      p\<        P>                  ! V4      pVPA                  VPB                  P                  4      pVP                  PD                  '       Edw   VPB                  P                  P                  '       EdP   VP                  \F        PH                  J d   \        PJ                  ! \        PL                  ! VPB                  P                  VVPN                  R7      \.        PP                  4      P-                  VPB                  P                  V P3                  4       4      pEMk\        P                  ! VPB                  P                  \        P"                  PS                  VPB                  P                  ^ 4      \        P"                  PS                  VPB                  P                  ^4      V\F        PT                  ^R7      pMVPB                  P                  PV                  '       d9   VPB                  P                  PY                  VPN                  4      '       g   TpMj\        PZ                  ! VPB                  P                  \        P"                  PS                  VPB                  P                  ^ 4      VVPN                  R7      pVP                  VPB                  P                  8w  d5   VP-                  VPB                  P                  V P3                  4       4      p\\        P^                  ! VPB                  P                  VPB                  VR	7      p\\        P`                  ! VP                  VVPb                  .R
7      pV Pe                  WC4      w  pp\\        Pf                  ! VP                  VVVVVVVVPh                  RR7
      p\<        Pj                  ! VP                  V.VR7      # )FNz*C array iteration requires known end indexz8C array iteration requires known step size and end indexr:  rE   r   rF   rH   r  )ri  rk  r   rH   r-  )r4  r   rH   r5  r   Tr{  r   rM   )6r&   r   ro  r   r<   ri  rk  rH   r   r   r   r   r4  	SliceNoderj  r;   intr   rA  absr   sizer   r	   r@  r   element_ptr_typecoerce_to_simpleAddNode	CloneNoder   r   r   r   	is_stringr
   r   CastNodeDereferenceNoder   r   r   r  r   assignable_fromrD  r   r   r   r   _find_for_from_node_relationsr  r   r   )r`   r(   rL  r   neg_step
slice_baseri  rk  rj  r4  
step_valueptr_type
carray_ptrstart_ptr_nodestop_ptr_nodecounterr  rY  rZ  r   rS  rT  for_nodes   &&&&                   r!   r   .IterationTransform._transform_carray_iteration  sB   j)":":;;#J$Z%5%56E#JOO4DD!222*..*VW 
 $$$j..	0C0CDDDD#J$$E$U[[1E#EJJ/D#EJJ/D!$"6"6<<..!3..24..25%??666dhh(bcK "&!5!5J&0[
)A~H$,,55dhhJPD__%%%##+jnn&RS#JE$$--jnnjoo>R>RSD ??...jnn&RSKOOJ$@$@$BRBRBTUE>>*">">@P@P@RSD< ((11*.."Ejnn&`a!))22:>>1E4??002H001A1A1CD
U**a/&..		#N (ND((A-%--",,Z8 #"4#3#3#56  &//
;M&&x0{{4;;??3??$$$)9)9)E)E)E'"6"66(11--%//1 --	 / 09y(($*:*:*<0>	   )77KKOO#++33DKKOOQG"**224;;??AF% ++  [[$$$T[[-=-=-M-MhN`N`-a-a'L %..''//C!''	)L  0 00'11$++2B2B262B2B2DFL 22++//++ 
 !!HH"DII.0  $AA(U	9((HH!YD(( ''HHWI 	r#   c           
     n   VP                   P                  p\        V4      ^ 8X  d   \        VP                  R4       V# \        V4      ^8  d   \        VP                  R4       V# VP
                  P                  '       g   V# VP
                  P                  p\        V4      ^8w  d   V# Vw  rVVP                  pVP                  '       g   VP                  '       g   V# \        V4      ^8X  d1   \        V^,          4      P                  WpP                  4       4      pM,\        P                  P                  VP                  ^ VR7      p\         P"                  ! V4      p	\        P$                  ! VP                  V	\        P                  P                  VP                  ^VR7      RVVP                  R7      p
\&        P(                  ! VP                  VV	R7      \&        P(                  ! VP                  V	V
R7      .p\+        VP,                  \&        P.                  4      '       d-   WP,                  P0                  ,           VP,                  n        MLVP3                  VP,                  4       \&        P.                  ! VP,                  P                  VR7      Vn        Wan        VP4                  P                  VP                  V P                  4       4      Vn        V^ ,          VP6                  n        \         P:                  ! WP=                  WP6                  P8                  4      4      # )r   z)enumerate() requires an iterable argumentz%enumerate() takes at most 2 argumentsr   r:  )rE   rF   r   rH   r-  r5  r   )r	  r   rP   r   r   r   r   rH   r   r  r*   r   r   r   r   r   r   r=  r  r   r   r&   r   r   r   rR   r   r   r   rK  r   )r`   r(   enumerate_functionr   targetsenumerate_targetiterable_targetcounter_typeri  tempinc_expression	loop_bodys   &&&         r!   r  1IterationTransform._transform_enumerate_iterationP  sw   !++00t9>$((=?KY]$((9;K{{222K++""w<1K,3)',,'''0C0C0CKt9>'Q0::<IYIYI[\E%%--.@.D.Dal-[E##E*"**"" ((001<0P".. &&&**& &&&**$&		 dii!3!344'))//9DIIOTYY'**		!#DI &II''(<(<d>N>N>PQ	!%a   '>'>t]]E[E['\]]r#   c                B    V'       d   V'       d   R# R# V'       d   R# R# )r2  )r2  r1  )r/  r0  )r0  r/  )r1  r2  rl   )r`   neg_step_valuer   s   &&&r!   r  0IterationTransform._find_for_from_node_relations  s#            r#   c                   VP                   P                  p\        V4      ^8  d0   VP                  p^p\        P
                  P                  V^4      pMkV^,          pVP                  p\        VP                  \        4      '       g   V# VP                  pV^ 8X  d   V# \        P
                  P                  WV4      p\        V4      ^8X  dR   \        P
                  P                  VP                  ^ 4      pV^ ,          P                  V P                  4       4      p	MLV^ ,          P                  V P                  4       4      pV^,          P                  V P                  4       4      p	V P                  V^ 8  V4      w  rRpV'       Eda   Yr\        V4      pV^8w  EdL   \        VP                  \        4      '       Ed   \        V	P                  \        4      '       d   V^ 8  dD   V	P                  pVP                  pWW,
          ^,
          V,          ,          ,
          ^,
          pMBVP                  pV	P                  pWW,
          ^,
          V,          ,          ,           ^,           p\        P
                  P                  VP                  V\        P                   ! VP"                  V	P"                  4      R7      pM(\$        P&                  ! V	4      pV P)                  WWv4      pV^ 8  d   V) p\+        V4      Vn        Wgn        VP                  V P                  4       4      pV	P.                  '       g$   RpT;'       g    \$        P&                  ! V	4      p	MRp\0        P2                  ! VP                  VP4                  WWWqP6                  VP8                  RR7
      pVP;                  V P                  4       4       V'       d   \$        P<                  ! V	V4      pV# )   Nr   TF)	r   r|  rS  rT  r}  rj  r   r   r~  )r	  r   rP   r   r   r   rA  r&   r;   r  coerce_to_indexr   r  r  r   r	   spanning_typerH   r   r=  _build_range_step_calculationstrr   r  r   r  r   r   r   set_up_looprK  )r`   r(   range_functionr   r   step_posr  rj  r|  r}  rS  rT  bound2_ref_nodeabs_stepbegin_value	end_valuebound1_valuebound2_is_tempr  s   &&&&               r!   r  -IterationTransform._transform_range_iteration  s*   '',,t9q=%))HJ$$--h:D7DxxHd22C88--JQ$$--hCDt9>&&//0B0BAFF!W,,T-=-=-?@F!W,,T-=-=-?@F!W,,T-=-=-?@F#AA*q.RZ[	8#F:H1}v55s;;"6#9#93??!A~&,&<&<$*$:$:	'2+BY\]B]bjAj5k'kno'o&,&<&<$*$:$:	'0@WZ[@[`h?h3i'ilm'm&..66

L'55fkk6;;O 7 QF
 '0&:&:6&BO!??CF >$J_
)##D$4$4$67   !N$DD	(<(<V(DF"N((HH;;II(( 	T--/0 ((:Hr#   c                X   \        V4      p\        P                  ! VP                  VP                  4      pVP                  P                  '       d.   VR 8  d'   \        P                  ! V\        P
                  4      pM \        P                  ! WcP                  4      pV^ 8  d   TpTp	Rp
MTpTp	Rp
\        P                  ! VP                  \        P                  ! VP                  VV
\        P                  ! VP                  \        P                  P                  VP                  WWR7      R\        P                  ! VP                  \        P                  ! VP                  \        P                  ! VP                  VRV	VR7      R\        P                  P                  VP                  ^4      VR7      R\        P                  P                  VP                  WWR7      VR7      VR7      VR7      V
\        P                  P                  VP                  ^4      VR7      pV# )i  r9  r:  r   *r  z//)r  r	   r  rH   r  r  r   rI  r   MulNoder   r   DivNodeSubNode)r`   r|  r  rj  r  r  r  spanning_step_typer  r  final_opstep_calculation_nodes   &&&&&       r!   r  0IterationTransform._build_range_step_calculation  s   z?"00o>R>RS996 1!+!9!9-I^I^!_!+!9!9-!S>)KIH K'IH ) 4 4JJ))

(!"**JJ&..66vzz86e &..

!*!2!2"JJ%.%6%6 &

)4),)2%2&4 &)%.%6%6%>%>vzz1%M!3
"5 "&!*!2!2!:!:6::x!:!i/1  ,)-* (3)4 &&..vzz1==! > %$r#   c                l
   . p\         P                  ! \        P                  4      pVP	                  V4       VP                  VP                  4      p\         P                  ! \        P                  4      pVP	                  V4       VP                  VP                  4      p	R ;p
;rV'       dq   V'       di   VP                  P                  '       d@   \        VP                  P                  4      ^8X  d   VP                  P                  w  rM0V# VP                  pM!V'       d   VP                  p
MVP                  p\        VP                  \        P                  4      '       d   VP                  pM7\        P                  ! VP                  P                  VP                  .R7      p\         P                  ! \        P                  4      pVP	                  V4       \         P"                  ! VP                  VP                  VP                  4      \        P$                  ! VP&                  4      R7      p\         P                  ! \        P(                  4      pVP	                  V4       VP                  VP                  4      p\         P"                  ! VP                  V\        P$                  ! VP&                  4      R7      p\        P*                  ! WP                  VP                  4      V	WVV4      pVP-                  V P/                  4       4      pV.VP0                  R&   V'       dZ   \         P2                  ! VP                  VR7      pTP5                  RP7                  \        V4      ^8:  d   RMR4      RV.R	7      pM1\         P8                  ! VP                  4      pVP5                  R
4      p\         P:                  P=                  VP                  \?        VP&                  \@        PB                  J 4      4      p\        PD                  ! VP                  V	\         P:                  PG                  VP                  ^ 4      R7      \        PD                  ! VP                  V\         PH                  ! VP                  RV PJ                  \L        PN                  ! RR4      VVVVV.RR7      R7      \        PP                  ! VP                  R VVPR                  R7      .p\         PT                  ! VP                  V\        P                  ! VP                  VR7      R7      # )Nr   r   r  r   r   Nr   )'NoneType' object has no attribute '%{}s'.30 PyExc_AttributeErrorr   format_argsr$  r   __Pyx_dict_iterator	dict_iterr   Tr  r   r-  r<  r   r   )+r   r   r	   py_object_typerR   r   r   r@  r   r   rP   r   r&   r   r   r   r   r  
c_ptr_typerH   r  DictIterationNextNoder   r   r   IdentifierStringNoder'  rA   NullNoder   r   r  r
   r   r   rA  rl  PyDict_Iterator_func_typer   r   rJ  r   r   )r`   r(   r   r   r   r   r   r  	dict_temppos_temp
key_targetvalue_targettuple_targetr   dict_len_tempdict_len_temp_addris_dict_tempis_dict_temp_addriter_next_nodemethod_nodeis_dictresult_codes   &&&&&&                r!   r   ,IterationTransform._transform_dict_iteration#  s   ##J$=$=>THHX\\*	##J$@$@AT88DHH%377
7\F{{222t{{''(A-/3{{/?/?,J  K#{{J;;Ldii!3!34499D%%DIIMM/3yyk;D ",,Z-I-IJ]#&44HHm//=&&}'9'9:< ##J$9$9:Txx)%33HHl&&tyy13 44((6l (;;D<L<L<NO)*

3#88VTK11;BBCPVK[]L]5cef.%h 2 (H
 $,,X\\:K112UVH##++DHHc(--7K\K\:\6]^ &&''001=
 &&22LL)22#.#:#:;#U$g{<NPab 
  "..	#2 ''HHE### 	r#   r   r  method_namep_orig_length	p_is_dictrO   is_setp_is_setc                   . p\         P                  ! \        P                  4      pVP	                  V4       VP                  VP                  4      p\         P                  ! \        P                  4      pVP	                  V4       VP                  VP                  4      p\        VP                  \        P                  4      '       d   VP                  pM7\        P                  ! VP                  P                  VP                  .R 7      p\         P                  ! \        P                  4      pVP	                  V4       \        P                  ! VP                  VP                  VP                  4      \        P                  ! VP                  4      R7      p	\         P                  ! \        P                   4      pVP	                  V4       VP                  VP                  4      p
\        P                  ! VP                  V
\        P                  ! VP                  4      R7      pVP"                  p\        P$                  ! WXP                  VP                  4      WlV
4      pVP'                  V P)                  4       4      pV.VP*                  R&   \        P,                  P/                  VP                  \1        VP                  \2        P4                  J 4      4      p\        P6                  ! VP                  V\        P,                  P9                  VP                  ^ 4      R7      \        P6                  ! VP                  V\        P:                  ! VP                  RV P<                  \>        P@                  ! RR4      W.W.RR7      R7      \        PB                  ! VP                  R	VVPD                  R
7      .p\         PF                  ! VP                  V\        P                  ! VP                  VR7      R7      # )r  r  r  r   __Pyx_set_iteratorset_iterr   Tr  Nr<  r   r   )$r   r   r	   r  rR   r   r   r@  r&   r   r   r   r   r  r  rH   r  r   SetIterationNextNoder   r   r   r   r   r  r
   r   r   rA  rl  PySet_Iterator_func_typer   r   rJ  r   r   )r`   r(   set_objr   r  set_tempr  r   set_len_tempset_len_temp_addris_set_tempis_set_temp_addrr  r  r  r  s   &&&             r!   r   +IterationTransform._transform_set_iteration  s   ##J$=$=>T88GKK(##J$@$@AT88DHH%dii!3!34499D%%DIIMM/3yyk;D !++J,H,HI\"%33HHl..w{{;&&|'8'89; ##J$9$9:Thhtxx($22HHk&&tyy13 {{33&&w{{3X[Z';;D<L<L<NO)*

3""**488SIYIY9Y5Z[ &&%%..txx;
 &&00KK(11!,!8!8\!R!+<O 
  ,,	#2 ''HHE### 	r#   rl   r1   rM   ))rv   rw   rx   ry   rz   r   r   r   r  r  r	   	CFuncTypec_char_ptr_typeCFuncTypeArgr
   r  rm  r@  rn  r  r   r  r  r  r  r  r  r  r  r  r   r  r  r  r  r   r  r  r   r|   r}   r~   s   @r!   r   r      s    0dEIVA(aF #-"6"6""##C););TB%%#'
 ",!5!5$$##C););TB'
 	"%&N  *33!!##FJ,A,A4H##FJ,F,FM##GZ-I-I4P$
  (2';';##C)B)BDI##Hj.N.NPTU##FJ,J,JDQ##FJ,E,EtL	 
 ($VSpUnB^H
!Ob0%d\| !+ 4 4!!##FZ-F-FM##I
0E0EtL##MJ4M4MtT##Oj6V6VX\]##K*2K2KTR$!  *33!!##EJ,E,EtL##Hz/D/DdK##Oj6V6VX\]##J1J1JDQ	$ B Br#   r   c                      a  ] tR tRt o RtRtR tR tR tR t	R t
R	 tR
 tR tR tR t]P"                  P$                  tRtV tR# )SwitchTransformi  z
This transformation tries to turn long if statements into C switch statements.
The requirement is that every clause be an (or of) var == value, where the var
is common among all clauses and both var and value are ints.
Nc                    \        V\        P                  \        P                  34      '       d   VP                  pK?  \        V\        P
                  4      '       d   VP                  P                  pKw  \        V\        P                  4      '       d   VP                  pK  \        V\        P                  4      '       d   VP                  pK   \        T\        P                  4      '       Ed   TP                  e   T P                  # TP                  4       '       d   \        TP                  \        P                   \        P"                  34      '       dS   TP$                  R8H  pT'       d   T'       g   T P                  # Y1P&                  T P)                  TP                  4      3# TP+                  4       '       Eg   TP$                  R8X  d   RpM(T'       d   TP$                  R8X  d   R pMT P                  # \-        TP&                  TP&                  4      '       d   TP                  P.                  '       d   Y1P&                  TP                  .3# \1        TP                  RR4      '       d@   TP                  P2                  P4                  '       d   Y1P&                  TP                  .3# \-        TP                  TP                  4      '       d   TP&                  P.                  '       d   Y1P                  TP&                  .3# \1        TP&                  RR4      '       d@   TP&                  P2                  P4                  '       d   Y1P                  TP&                  .3# T P                  # \        T\        P6                  4      '       d   TP$                  R8X  g   T'       d   TP$                  R8X  d   TP$                  R8H  pT P9                  TP&                  T4      w  rEpT P9                  TP                  T4      w  rxp	Te2   YG8X  d,   \-        YX4      '       d   T'       d	   T'       d   YEYi,           3# T P                  # )	TNr   r   F!=r   orr3  )r&   r   CoerceToTempNodeCoerceToBooleanNoder'   BoolBinopResultNoder   EvalWithTempExprNodesubexpressionTypecastNoder   r   cascadeNO_MATCHis_c_string_containsrF   r   r  r   rE   extract_in_string_conditionsis_python_comparisonr5   r  getattrr   is_constrB  extract_conditions)
r`   condallow_not_inr   not_in_1t1c1not_in_2t2c2s
   &&&       r!   r!  "SwitchTransform.extract_conditions  s   $!;!;!*!>!>!@ A AxxD)"?"?@@xx||D)"@"@AA))D)"8"899||dI4455||'}}$**,,dmmi.C.CYEXEX-YZZ(2,==(}}d.O.OPTP]P].^^^..00==D("F!dmmt&;!F==( #4==$--@@}}///%}}t}}oEE >>!%!4!4!=!=!=%}}t}}oEE"4==$--@@}}///%}}t}}oEE >>!%!4!4!=!=!=%}}t}}oEE }} i5566}}$$--5:P $ 6#'#:#:4==,#W b#'#:#:4==,#W b>h&:r?V?V$'RU22}}r#   c           
     T   \        V\        P                  4      '       dr   \        \	        \        \        VP                  4      4      4      p\        \        P                  P                  VP                  4      pV Uu. uF
  qC! V4      NK  	  up# VP                  pVP                  p\        \        \        V4      4       Uu0 uF  quWw^,            kK  	  up4      pV Uu. uF/  p\        P                  ! VP                  \!        W4      VR7      NK1  	  up# u upi u upi u upi )r   r   r;   )r&   r   r   sortedrO   r   r   r   r   r   r   r   encodingr   rP   CharNoder   )	r`   string_literalcharvalsnode_for_charcharval
charactersr.  i	characters	   &&       r!   r  ,SwitchTransform.extract_in_string_conditions  s    ni&;&;<<c#c>+?+?"@ABH#I$5$5$=$=~?Q?QRM:BC(wM'*(CC (--J!**HU3z?=S U=SQs"3=S UVJ '13&0 ''(:(:-PYBd8AC&03 3 D
 !V3s   ?DD #5D%c                   V P                  W#4      w  rEpVf   V P                  # Ve   \        WQ4      '       g   V P                  # VP                  P                  '       g   VP                  P
                  '       dX   \        V Uu. uF;  qwP                  P                  ;'       g    VP                  P
                  '       * NK=  	  up4      '       d   V P                  # WEV3# u upi r%   )r!  r  r5   rH   r  r  r   )r`   
common_varr   r#  r   var
conditionsr"  s   &&&&    r!   extract_common_conditions)SwitchTransform.extract_common_conditions$  s    "&"9"9)"RZ;== #OC,L,L== ((///SXX%5%5%5#ISTii&&;;$))*;*;<T;V ;V== J&& Us    C%( C%c                   \        4       pV F  pVP                  4       '       d2   VP                  V9   d    R # VP                  VP                  4       KJ   VP                  pVP
                  P                  '       g   VP
                  P                  '       d   VP                  e   VP                  pMVP                  p WR9   d    R # VP                  V4       K  	  R#   \         d      R # i ; i)TF)rO   r  r;   addr   rH   r  is_cpp_enumenum_int_valuecnameAttributeError)r`   condition_valuesseenr   value_entryvalue_for_seens   &&    r!   has_duplicate_values$SwitchTransform.has_duplicate_values/  s    u%E((**((D0../ "'++K$))111[5E5E5Q5Q5Q + : : F)4)C)C)4):): ")(' &(  &   s$   'C$ C$C$7C$$C43C4c           	     >   V P                   P                  R 4      '       g   V P                  V4       V# Rp. pVP                   Fw  pV P	                  W$P
                  R4      w  rRpVf   V P                  V4       Vu # VP                  \        P                  ! VP                  VVP                  R7      4       Ky  	  V UUu. uF  qwP                   F  qNK  	  K  	  p	pp\        V	4      ^8  d   V P                  V4       V# V P                  V	4      '       d   V P                  V4       V# V P                  VR4       V F  pV P                  VR4       K  	  \        V4      p\        P                  ! VP                  VVVP                   R7      p
V
# u uppi )optimize.use_switchNFr   r;  r   r   r   r   testcasesr   )current_directivesgetrc   r   r<  r   rR   r   SwitchCaseNoder   r   r;  rP   rH  r/   SwitchStatNoder   )r`   r(   r9  rO  	if_clause_r;  caser"  rD  switch_nodes   &&         r!   visit_IfStatNode SwitchTransform.visit_IfStatNodeH  s   &&**+@AAt$K
I(,(F(F//)8%A:!""4(LL--)--9C3<>>C D ) #@"TtDDU 	 @ 1$t$K$$%566t$K 	4/DtV,  !,
**txx0:167;7G7GI '@s   Fc                v   V P                   P                  R 4      '       g   V P                  V4       V# V P                  RVP                  R4      w  r#pVe(   \        V4      ^8  g   V P                  V4      '       d   V P                  V4       V# V P                  WWBVP                  VP                  4      # )rK  NT)
rP  rQ  rc   r<  rN  rP   rH  build_simple_switch_statementtrue_val	false_valr`   r(   r   r9  r;  s   &&   r!   visit_CondExprNode"SwitchTransform.visit_CondExprNoden  s    &&**+@AAt$K)-)G)G$))T*#&Jz?Q&,,Z88t$K11jMM4>>+ 	+r#   c                   V P                   P                  R 4      '       g   V P                  V4       V# V P                  RVR4      w  r#pVe(   \	        V4      ^8  g   V P                  V4      '       d3   V P                  V4       VP                  V P                  4       4       V# V P                  WWB\        P                  ! VP                  RR7      \        P                  ! VP                  RR7      4      # rK  NTr   F)rP  rQ  rc   r<  rP   rH  wrap_operandsr   r[  r   r   r   r^  s   &&   r!   visit_BoolBinopNode#SwitchTransform.visit_BoolBinopNode  s    &&**+@AAt$K)-)G)G$*&Jz?Q&,,Z88t$t//12K11jtxxt4txxu57 	7r#   c                   V P                   P                  R 4      '       g   V P                  V4       V# V P                  RVR4      w  r#pVe(   \	        V4      ^8  g   V P                  V4      '       d   V P                  V4       V# V P                  WWB\        P                  ! VP                  RR7      \        P                  ! VP                  RR7      4      # rb  )
rP  rQ  rc   r<  rP   rH  r[  r   r   r   r^  s   &&   r!   r   $SwitchTransform.visit_PrimaryCmpNode  s    &&**+@AAt$K)-)G)G$*&Jz?Q&,,Z88t$K11jtxxt4txxu57 	7r#   c           	     H   \         P                  ! V4      p\        P                  ! VP                  VVP                  VP                  V P                  4       4      R R7      p\        P                  ! VP                  VVP                  VP                  V P                  4       4      R R7      p	V'       d   Yr\        P                  ! VP                  VVR7      .p
\        V4      p\        P                  ! VP                  VV
V	R7      p\         P                  ! W{4      pV# )Tr   r   firstrL  rM  )r   r,   r   r   r   r   rH   r   rR  r/   rS  r   )r`   r(   r9  r;  r   r\  r]  r   	true_body
false_bodyrO  rW  replacements   &&&&&&&      r!   r[  -SwitchTransform.build_simple_switch_statement  s    ,,T2
..HH""499d.>.>.@A		
 //HH##DIIt/?/?/AB	
 $.z%%DHH3=-68 9 !,
**2<389CE  66zOr#   c                F   V P                   P                  R 4      '       g   V P                  V4       V# VP                  pVP                  pV P                  V4       VP                  VJd4   \
        P                  ! VP                  V4      '       g   VP                  # V# )rK  )rP  rQ  rc   r  	lazy_tempr   tree_contains)r`   r(   	orig_exprtemp_refs   &&  r!   visit_EvalWithTempExprNode*SwitchTransform.visit_EvalWithTempExprNode  s    &&**+@AAt$K &&	>>4 Y.((););XFF)))r#   rl   )NNN)rv   rw   rx   ry   rz   r  r!  r  r<  rH  rX  r_  rd  r   r[  rt  r   VisitorTransformrecurse_to_childrenr{   r|   r}   r~   s   @r!   r  r    sX     
 "H5n3	'2$L+"7&7$: ))==Jr#   r  c                   V   a  ] tR tRt o RtR t]P                  P                  t	Rt
V tR# )FlattenInListTransformi  z^
This transformation flattens "x in [val1, ..., valn]" into a sequential list
of comparisons.
c           	       aa V P                  S4       SP                  e   S# SP                  R8X  d   RoRpMSP                  R8X  d   RoRpMS# \        SP                  \
        P                  \
        P                  \
        P                  34      '       g   S# SP                  pSP                  P                  p\        V4      ^ 8X  dJ   VP                  4       '       d2   SP                  R8H  p\
        P                  ! SP                  VR7      # S# \        V Uu. uF  qfP                   NK  	  up4      '       d   S# \"        P$                  ! V4      p. p. pV F  pVP                  4       '       g(   \"        P&                  ! V4      pVP)                  V4       \
        P*                  ! SP                  VVVR R7      p	VP)                  \
        P,                  ! SP                  V	\.        P0                  R	7      4       K  	  VV3R
 lp
\3        W4      p\"        P4                  ! W;4      pVR R R1,           F  p\"        P4                  ! W4      pK  	  V# u upi )Ninr  r   r   r3  r  r   )r   rE   r   rF   r  )r   r   rH   c                 L   < \         P                  ! SP                  SV VR 7      # ))r   r   rE   rF   )r   rB  r   )leftrightconjunctionr(   s   &&r!   concat;FlattenInListTransform.visit_PrimaryCmpNode.<locals>.concat  s&    **&*hh+6+/+0	2 2r#   rM   )rc   r  r   r&   rF   r   	TupleNoder   SetNoderE   r   rP   try_is_simpler   r   r   r   r   r,   r=  rR   r   r  r	   c_bint_typer   r  )r`   r(   	eq_or_neqr   r   r;   r'   condsr   r"  r  r   r   r  r  s   &f            @r!   r   +FlattenInListTransform.visit_PrimaryCmpNode  s   4 <<#K]]d"KI]]h&KIK$--)*=*=*3*<*<*3*;*;*= > > Kmm}}!!t9>  """&--8"; ))$((/JJK$/$3$/00K%%c*C$$&&**3/S!++&*hh+.+4+.*.0D LL//&*hh*.'1'='=? @  	2 6)	11#A$B$KKD 55dEH  G 0s   !Irl   N)rv   rw   rx   ry   rz   r   r   rv  rw  r{   r|   r}   r~   s   @r!   ry  ry    s#     
>@ ))==Jr#   ry  c                   b   a  ] tR tRt o Rt]P                  P                  tR t	R t
R tRtV tR# )DropRefcountingTransformi  z&Drop ref-counting in safe places.
    c                   . . r2. . rT. pVP                    F  p\        V\        P                  4      '       dQ   V P	                  VP
                  VWF4      '       g   Vu # V P	                  VP                  VWV4      '       g   Vu # Ks  \        V\        P                  4      '       d   Vu # Vu # 	  V'       g	   V'       dj   V UU	u. uF  w  rVNK	  	  p
pp	V UU	u. uF  w  rVNK	  	  ppp	\        V
4      \        V4      8w  d   V# \        \        V
4      4      \        V4      8w  d   V# V'       g	   V'       d   . pV F1  pV P                  V4      pV'       g   Vu # VP                  V4       K3  	  . pV F1  pV P                  V4      pV'       g   Vu # VP                  V4       K3  	  \        V4      \        V4      8w  d   V# \        \        V4      4      \        V4      8w  d   V# V# V Uu. uF  pVP                  NK  	  ppV F
  pRVn        K  	  W#,            F  w  ppVV9  g   K  RVn        K  	  WE,            F
  pRVn        K  	  V# u up	pi u up	pi u upi )z6
Parallel swap assignments like 'a,b = b,a' are safe.
F)r   r&   r   r   _extract_operandr   r   CascadedAssignmentNoderO   rP   _extract_index_idrR   r'   use_managed_ref)r`   r(   
left_namesright_namesleft_indicesright_indicesr   statpathnlnamesrnameslindiceslhs_nodeindex_idrindicesrhs_nodet	temp_argsr  rU  	name_node
index_nodes   &&                     r!   visit_ParallelAssignmentNode5DropRefcountingTransform.visit_ParallelAssignmentNode!  s1    #%bK&("mJJD$ : :;;,,TXXz-9B BK,,TXX{-:C CKC D%">">??  +57:t:F7+68;t;F86{c&k)3v;3{#33= H(11(;K)	 )
 H)11(;K)	 * 8}H-3x=!S%77 K$)*EqQUUE	*D#(D   '44LAy	),1	) 5 '66J).J& 7 W 88> +s   II2Ic                Z   \        V4      pVP                  P                  '       g   R # \        V\        P
                  4      '       d   VP                  V4       VP                  p. pTpVP                  '       d>   VP                  '       d   R # VP                  VP                  4       VP                  pKO  VP                  '       dJ   VP                  VP                  4       VP                  RP                  VRRR1,          4      V34       R# VP                  '       d   VP                   P                  \"        P$                  8w  d   R # VP&                  P                  P(                  '       g   R # VP                   P                  '       g   R # VP                  V4       R# R # )F.NTrM   )r/   rH   r   r&   r   r  rR   r'   r   r4   memberr6   r   r    joinr   r   r
   r&  r4  r  )r`   r(   namesindicesr   	name_pathobj_nodes   &&&&&  r!   r  )DropRefcountingTransform._extract_operandf  s3   4 yy$$$dI6677LL88D	###"""X__-||HX]]+LL388IddO4d;=  yy~~!2!22::??)))99$$$NN4   r#   c                    VP                   pVP                  p\        V\        P                  4      '       d   VP
                  pM$\        V\        P                  4      '       d   R # R # VP
                  V3# r%   )r   r4  r&   r   r2   r    	ConstNode)r`   r  r   r4  	index_vals   &&   r!   r  *DropRefcountingTransform._extract_index_id  sZ      eY//00

Iy2233		9%%r#   rl   N)rv   rw   rx   ry   rz   r   rv  rw  r{   r  r  r  r|   r}   r~   s   @r!   r  r    s1     ))==JCJ:
& 
&r#   r  c                   `  a  ] tR tRt o Rt]P                  P                  tR t	R t
R tRR ltRR ltRR	 ltR
 tR tR tR tR tR t]P,                  ! ]P0                  ]P2                  ! R]P4                  R4      .4      tR tR tR tR tR t R t!R t"R t#R t$R t%R t&R t'Rt(V t)R# )EarlyReplaceBuiltinCallsi  a  Optimize some common calls to builtin types *before* the type
analysis phase and *after* the declarations analysis phase.

This transform cannot make use of any argument types, but it can
restructure the tree in a way that the type analysis phase can
respond to.

Introducing C function calls here may not be a good idea.  Move
them to the OptimizeBuiltinCalls transform instead, which runs
after type analysis.
c                    V P                  V4       VP                  pV P                  V4      '       g   V# V P                  WVP                  4      # r%   )rc   r
  _function_is_builtin_name_dispatch_to_handlerr   )r`   r(   r
  s   && r!   visit_SimpleCallNode-EarlyReplaceBuiltinCalls.visit_SimpleCallNode  sF    4 ==--h77K((CCr#   c                   V P                  V4       VP                  pV P                  V4      '       g   V# VP                  p\	        V\
        P                  4      '       g   V# VP                  pV P                  WWAP                  4      # r%   )
rc   r
  r  positional_argsr&   r   r  r   r  keyword_args)r`   r(   r
  r	  r   s   &&   r!   visit_GeneralCallNode.EarlyReplaceBuiltinCalls.visit_GeneralCallNode  sy    4 ==--h77K((	)Y%8%899K~~((D"3"35 	5r#   c                    VP                   '       g   R # V P                  4       pVP                  VP                  4      pW2P	                  4       P                  VP                  4      Jd   R # R# )FT)r   r   r?  r    r>  lookup_here)r`   r
  r  r   s   &&  r!   r  2EarlyReplaceBuiltinCalls._function_is_builtin_name  sU     

8==)))+77FFr#   Nc                    Vf   RVP                   ,          pMRVP                   ,          p\        WR 4      pVe   Vf	   V! W4      # V! WV4      # V# )Nz_handle_simple_function_%sz_handle_general_function_%s)r    r  )r`   r(   r
  r   kwargshandler_namehandle_calls   &&&&&  r!   r  -EarlyReplaceBuiltinCalls._dispatch_to_handler  sW    >7(--GL88==HLd$7"~"4.."4v66r#   c                    \         P                  ! VP                  P                  VP                  P                  W#VR 7      Vn        R# )r  N)r   PythonCapiFunctionNoder
  r   r    )r`   r(   rB  	func_typer  s   &&&&&r!   _inject_capi_function.EarlyReplaceBuiltinCalls._inject_capi_function  s2    !88MMt}}115')r#   c           
         V'       g   R pM,\        V\        4      '       g   V^8  d   RpMV^8X  d   RpMR pVe   RV,          pMR p\        VP                  RWV\	        V4      3,          4       R# r  z...xNzexpected %s, z3%s(%s) called with wrong number of args, %sfound %dr&   r  r   r   rP   r`   function_namer(   r   expectedarg_strexpected_strs   &&&&&  r!   _error_wrong_arg_count/EarlyReplaceBuiltinCalls._error_wrong_arg_count  o    G#&&(Q,G]GG*X5LLdhhML#d)Q= = 	>r#   c                $   V'       g#   \         P                  ! VP                  R R7      # \        V4      ^8  d   V P	                  RW^4       \        V^ ,          RR4      pV\        P                  \        P                  39   d
   V^ ,          # V# )0.0r   floatrH   N)
r   	FloatNoder   rP   r  r  r	   c_double_typer
   
float_type)r`   r(   pos_argsarg_types   &&& r!   _handle_simple_function_float6EarlyReplaceBuiltinCalls._handle_simple_function_float  st    &&txxu==x=1''C8A;5
00'2D2DEEA;r#   c                x   \        V4      pR ;rEV^8X  d   Vw  pM-V^8X  d   Vw  rFM!V^8X  d   Vw  rFpMV P                  RW4       V# \        P                  ! VP                  T;'       g!    \        P
                  ! VP                  4      TT;'       g!    \        P
                  ! VP                  4      R7      # )Nslice)ri  rk  rj  )rP   r  r   r  r   NoneNode)r`   r(   r  r  ri  rj  rk  s   &&&    r!   _handle_simple_function_slice6EarlyReplaceBuiltinCalls._handle_simple_function_slice  s    M	>ED!^"KE4!^ (E''@K""HH779--dhh755++DHH5	7 	7r#   c                j   \        V4      ^8w  d   V# V^ ,          p\        V\        P                  \        P                  34      '       dh   \        VP
                  4      ^8X  dN   \        P                  P                  VP                  \        VP
                  4      \        P                  R7      # V# )zUnpack ord('X').
        r   )rP   r&   r   r   r  r   r   r   r   r   r	   c_long_type)r`   r(   r  r'   s   &&& r!   _handle_simple_function_ord4EarlyReplaceBuiltinCalls._handle_simple_function_ord  s     x=AKqkcI1193F3FGHH399~" ((00#cii.zOeOe0ffr#   c                &    V P                  WR4      # )zTransform

_result = all(p(x) for L in LL for x in L)

into

for L in LL:
    for x in L:
        if not p(x):
            return False
else:
    return True
F_transform_any_allr`   r(   r  s   &&&r!   _handle_simple_function_all4EarlyReplaceBuiltinCalls._handle_simple_function_all	  s     &&tu==r#   c                &    V P                  WR4      # )zTransform

_result = any(p(x) for L in LL for x in L)

into

for L in LL:
    for x in L:
        if p(x):
            return True
else:
    return False
Tr  r  s   &&&r!   _handle_simple_function_any4EarlyReplaceBuiltinCalls._handle_simple_function_any  s     &&tt<<r#   c                   \        V4      ^8w  d   V# \        V^ ,          \        P                  4      '       g   V# V^ ,          pVP                  P
                  pVP                  p\        V4      w  rxVf   V# V'       d   Tp	M"\        P                  ! VP                  VR7      p	\        P                  ! VP                  R\        P                  ! VP                  V	\        P                  ! VP                  \        P                  ! VP                  VR7      R7      R7      .R7      p
\        P                  ! VP                  \        P                  ! VP                  V'       * R7      R7      Vn        \         P"                  ! WHV
4       \        P$                  ! VP                  YC'       d   RR7      # RR7      # )	r   Nr   r   r   )r   r   r   all)gen	orig_func)rP   r&   r   GeneratorExpressionNodedef_nodegbodyr   r   r   r   r   r   r   ReturnStatNoder   r   r   recursively_replace_nodeInlinedGeneratorExpressionNode)r`   r(   r  is_anygen_expr_nodegenerator_bodyr]  yield_expressionyield_stat_noder   rW  s   &&&&       r!   r  +EarlyReplaceBuiltinCalls._transform_any_all)  sr   x=AK(1+y'H'HIIK &//55"''	,I),T)#K(I!))*:*>*>HXYI$$  d""$(('--'001A1E1EVTV@	
	 !& 4 4HH$$%5%9%9VL!N	 	((S77=VEX 	XQVX 	Xr#   itc                   \        V4      ^8w  d   V# V^ ,          p\        V\        P                  4      '       d#   VP                  \
        P                  J d   TpEM\\        V\        P                  4      '       d   Tp\        VP                  4      pV'       g   V# \        P                  ! VP                  VR\
        P                  R7      pV FI  w  rx\        P                  ! VP                  VVP                  R7      p	\        P                  ! WXV	4       KK  	  MVP                   '       d   VP#                  4       pMv\        P$                  ! VP                  VP'                  4       '       d2   VP                  \(        P*                  \
        P                  39   d   RMRV P,                  VRR7      p\        P.                  ! VP                  V4      # )zTransform sorted(genexpr) and sorted([listcomp]) into
[listcomp].sort().  CPython just reads the iterable into a
list and calls .sort() on it.  Expanding the iterable in a
listcomp is still faster and the result can be sorted in
place.
r-  r  comprehension_typerh   r   __Pyx_PySequence_ListKeepNewPySequence_ListTrg  )rP   r&   r   ComprehensionNoderH   r
   r&  r  r   loopr  r   ComprehensionAppendNoder   r   r  r   as_listrl  result_in_tempr	   r  PySequence_List_func_typeSortedListNode)
r`   r(   r  r'   	list_noder  r   r   r  append_nodes
   &&&       r!   _handle_simple_function_sorted7EarlyReplaceBuiltinCalls._handle_simple_function_sortedQ  su    x=AKqkc96677CHHHYHY<YIY>>??M5m6H6HI#!@@-8#*#4#46I 6F1 '??$(()$++- 00Q\] 6F ((( I
 "44))++Z=V=VX_XiXi<j0j /*..t-I '')<<r#   c                   \        V4      R9  d   V# \        V^ ,          \        P                  \        P                  34      '       g   V# V^ ,          pVP
                  p\        V\        P                  4      '       d   \        V4      w  rVRpVf   V# MJVP                  pVP                  p VP                  '       d   VP                  P                  '       g   V#  \        V4      ^8X  d,   \        P                  P                  VP                  ^ 4      pM	V^,          p\         P"                  ! VP                  \$        P&                  R7      p\(        P*                  ! VP                  V\        P,                  ! VP                  RW4      R7      p	\.        P0                  ! W6V	4       \(        P2                  ! VP                  \(        P*                  ! VP                  \         P"                  ! VP                  VR7      VRR7      V.R7      p
\        P4                  ! VP                  WVP6                  R	VP8                  R
7      #   \         d    Tu # i ; i)zLTransform sum(genexpr) into an equivalent inlined aggregation loop.
        N)r   rH   r:  r   )r   r-   Tri  r   sum)r  result_node
expr_scoper  has_local_scoper   r>   )rP   r&   r   r  r
  r  r   rR   rh   r  rH   r  rC  r   rA  r   r   r,   r	   r  r   r   rI  r   r  r   r  r  r  )r`   r(   r  r  r]  r   r  ri  r   add_node	exec_codes   &&&        r!   __handle_simple_function_sum5EarlyReplaceBuiltinCalls.__handle_simple_function_sum  s    x=%K(1+	(I(I(1(C(C(E F FK !&&	mY%F%FGG0Mi0X-#' ( ,22O.33'222:J:O:O:V:V:VK ;W x=A%%..txx;EQKE,,
@Y@YZ
--  &&txxjS 	((R&&HH**II#11dhh:V 	"
 		 77i&11u+;;= 	== " s   0I I I IIc                &    V P                  WR 4      # )r2  _optimise_min_maxr  s   &&&r!   _handle_simple_function_min4EarlyReplaceBuiltinCalls._handle_simple_function_min      %%dc::r#   c                &    V P                  WR 4      # )r/  r   r  s   &&&r!   _handle_simple_function_max4EarlyReplaceBuiltinCalls._handle_simple_function_max  r$  r#   c                p   \        V4      ^8:  dO   \        V4      ^8X  d-   V^ ,          P                  '       d   V^ ,          P                  p\        V4      ^8:  d   V# \        \	        \
        P                  VR,          4      4      pV^ ,          pV Fu  p\
        P                  ! V4      p\        P                  ! VP                  VV\        P                  ! VP                  VVVR7      R7      p\
        P                  ! Wu4      pKw  	  VRRR1,           F  p\
        P                  ! W4      pK  	  V# )zKReplace min(a,b,...) and max(a,b,...) by explicit comparison code.
        r   NNrE   r   rF   )r\  r]  rN  NrM   )rP   r   r   r@   r   r   r,   r   CondExprNoder   r   r  )	r`   r(   r   r   cascaded_nodeslast_resultarg_noder   ref_nodes	   &&&&     r!   r!  *EarlyReplaceBuiltinCalls._optimise_min_max  s    t9>4yA~$q'"A"A"AAw||4yA~c)"9"948DE1g&H"00=J#00#& //LL'')		
K $88QK ' 'tt,,H#88OK - r#   c                    V'       g$   \         P                  ! VP                  . RR 7      # V P                  W\        P
                  4      pW1Jd#   \         P                  ! VP                  VR7      # V# )r   r;   )r'   rl   )r   r  r   _transform_list_set_genexprr
   r&  AsTupleNode)r`   r(   r  results   &&& r!   &_DISABLED_handle_simple_function_tuple?EarlyReplaceBuiltinCalls._DISABLED_handle_simple_function_tuple  sZ    &&txxb"MM 11$'BSBST((v>>r#   c                   \        V4      ^8w  d   V# V^ ,          P                  '       d   V^ ,          P                  '       g   V^  V# \        V^ ,          \        P
                  4      '       d   V^ ,          P                  4       V^ &   V# )zSReplace frozenset([...]) by frozenset((...)) as tuples are more efficient.
        )rP   r   r   r&   r   r   as_tupler  s   &&&r!   !_handle_simple_function_frozenset:EarlyReplaceBuiltinCalls._handle_simple_function_frozenset  sv     x=AKA;...x{7G7G7G  Y%7%788"1+..0HQKr#   c                    V'       g$   \         P                  ! VP                  . . R 7      # V P                  W\        P
                  4      # r2  )r   r   r   r3  r
   r&  r  s   &&&r!   _handle_simple_function_list5EarlyReplaceBuiltinCalls._handle_simple_function_list  s7    %%dhhRLL//@Q@QRRr#   c                    V'       g,   \         P                  ! VP                  . \        4       R 7      # V P	                  W\
        P                  4      # r=  )r   r  r   rO   r3  r
   r   r  s   &&&r!   _handle_simple_function_set4EarlyReplaceBuiltinCalls._handle_simple_function_set  s9    $$TXXBNN//@P@PQQr#   c                   \        V4      ^8  d   V# \        V^ ,          \        P                  4      '       g   V# V^ ,          pVP                  p\        V4      pV'       g   V# \        P                  ! VP                  TV\        P                  J d   RMRVR7      pV FI  w  r\        P                  ! VP                  VVP                  R7      p
\        P                  ! WIV
4       KK  	  V# )zLReplace set(genexpr) and list(genexpr) by an inlined comprehension.
        rO   r@   r  r  )rP   r&   r   r  r  r   r  r   r
   r   r  r   r   r  )r`   r(   r  rp  r  r]  r   r  r   r  r  s   &&&&       r!   r3  4EarlyReplaceBuiltinCalls._transform_list_set_genexpr	  s     x=1K(1+y'H'HIIK !&&	1)<K>>HHm*g.>.>>eF*,
 2B-#;; $$%"))+K ,,][Y 2B r#   c                   \        V4      ^ 8X  d$   \        P                  ! VP                  . / R7      # \        V4      ^8  d   V# \	        V^ ,          \        P
                  4      '       g   V# V^ ,          pVP                  p\        V4      pV'       g   V# V FG  w  rg\	        V\        P                  4      '       g   Vu # \        VP                  4      ^8w  g   KE  Vu # 	  \        P                  ! VP                  VR\        P                  R7      pV Fl  w  ri\        P                  ! VP                  VP                  ^ ,          VP                  ^,          VP                  R7      p
\        P                   ! W9V
4       Kn  	  V# )zDReplace dict( (a,b) for ... ) by an inlined { a:b for ... }
        key_value_pairsr;   r   r  )key_expr
value_exprr   )rP   r   DictNoder   r&   r  r  r   r  r   r  r
   r   DictComprehensionAppendNoder   r   r  )r`   r(   r  r  r]  r   r   rU  r  r  r  s   &&&        r!   _handle_simple_function_dict5EarlyReplaceBuiltinCalls._handle_simple_function_dict%  sN    x=A%%dhhTVWWx=1K(1+y'H'HIIK !&&	1)<K#3.	0C0CDD#(()Q.	 $4  >>HHmv&002 2B-#?? $$)..q1+003"))	+K
 ,,][Y 2B r#   c                n    \        V4      ^ 8  d   V# \        V\        P                  4      '       g   V# V# )z\Replace dict(a=b,c=d,...) by the underlying keyword dict
construction which is done anyway.
)rP   r&   r   rJ  )r`   r(   r  r  s   &&&&r!   _handle_general_function_dict6EarlyReplaceBuiltinCalls._handle_general_function_dictK  s2     x=1K&)"4"455Kr#   rl   r%   )*rv   rw   rx   ry   rz   r   rv  rw  r{   r  r  r  r  r  r  r  r  r  r  r  r  r	   r  r
   r&  r  r  r  r  5_EarlyReplaceBuiltinCalls__handle_simple_function_sumr"  r&  r!  r6  r:  r>  rA  r3  rL  rO  r|   r}   r~   s   @r!   r  r    s     
 ))==JD
5)
>$7$	> = "XH !+ 4 4		 	 z'@'@$	GH!J/=b8=t;;F	S
R
8"L r#   r  c                   X   a  ] tR tRt o ]P
                  P                  tR tR t	Rt
V tR# )InlineDefNodeCallsiV  c                V   VP                   f   R # VP                   P                  '       d   R # V P                  4       P                  VP                  4      pV'       d-   VP
                  '       d   \        VP
                  4      ^8w  d   R # VP
                  ^ ,          P                  # r%   )cf_state
cf_is_nullr   r?  r    cf_assignmentsrP   r   )r`   r  r   s   && r!   get_constant_value_node*InlineDefNodeCalls.get_constant_value_nodeY  s~    %(((  ")))..9U111 4 45:##A&***r#   c                   V P                  V4       V P                  P                  R 4      '       g   V# VP                  pVP                  '       g   V# V P                  V4      p\        V\        P                  4      '       g   V# \        P                  ! VP                  VW1P                  VP                  R7      pVP                  4       '       d   V P                  W4      # V# )zoptimize.inline_defnode_calls)r  r
  r   generator_arg_tag)rc   rP  rQ  r
  r   rX  r&   r   PyCFunctionNodeInlinedDefNodeCallNoder   r   r[  can_be_inlinedreplace)r`   r(   r  r
  inlineds   &&   r!   r  'InlineDefNodeCalls.visit_SimpleCallNodee  s    4 &&**+JKKK$$$K//>(I$=$=>>K22HHMII"446 !!##<<..r#   rl   N)rv   rw   rx   ry   r   rv  rw  r{   rX  r  r|   r}   r~   s   @r!   rS  rS  V  s%     ))==J
+ r#   rS  c                   '  a ] tR tRt oRtR tR tR tR t]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      .4      tR	 tR
 t]	P                   ]	P"                  ]	P$                  3 U u/ uF2  p V \        P                  ! V \        P                  ! RV R4      .4      bK4  	  up tR t]	P                  ! ]	P*                  ]	P                  ! R]	P,                  R4      .RR7      t]	P                  ! ]	P"                  ]	P                  ! R]	P,                  R4      .RR7      tR tRR ltR tR tR t]	P                  ! ]P>                  ]	P                  ! R]	P                  R4      .4      t R t!]!t"R t#]	P                  ! ]PH                  ]	P                  ! R]PH                  R4      .4      t%R t&]	P                  ! ]PN                  ]	P                  ! R]	P                  R4      .4      t(R t)]	P                  ! ]PT                  ]	P                  ! R]PN                  R4      .4      t+R t,]	P                  ! ]PZ                  ]	P                  ! R]	P                  R4      .4      t.R t/]	P                  ! ]P`                  ]	P                  ! R]	P                  R4      .4      t1R t2]	P                  ! ]	P"                  ]	P                  ! R]	P                  R4      .RRR 7      t3R! t4]	P                  ! ]Pj                  ]	P                  ! R]	P                  R4      .4      t6]	P                  ! ]Pj                  ]	P                  ! R"]	P"                  R4      .4      t7R# t8R$ t9]	P                  ! ]Pt                  ]	P                  ! R"]	P                  R4      .4      t;]	P                  ! ]Pt                  ]	P                  ! R"]Px                  R4      .4      t=R% t>]	P                  ! ]	P~                  ]	P                  ! R&]	P                  R4      .RR7      tA]	P                  ! ]	P~                  ]	P                  ! R']	P                  R4      .RR7      tC]	P                  ! ]	P~                  ]	P                  ! R]	P                  R4      .RR7      tD]P>                  R(]P                  R)]P                  R*]PN                  R+]PT                  R,]PZ                  R-]P`                  R-]PH                  R./P                  tHR/0tIR0 tJ]	P                  ! ]P                  ]	P                  ! R1]	P                  R4      .4      tLR2 tM]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      .4      tOR3 tPR4 tQ]	P                  ! ]	P                  ]	P                  ! R5]	P                  R4      ]	P                  ! R6]PT                  R4      .4      tR]	P                  ! ]	P                  ]	P                  ! R5]	P                  R4      ]	P                  ! R6]PT                  R4      ]	P                  ! R7]PH                  R4      .4      tSRR8 ltTRR9 ltU]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      ]	P                  ! R:]	P                  R4      .RR7      tWR; tXR< tY]	P                  ! ]	P                  ]	P                  ! R=]	P                  R4      ]	P                  ! R"]	P*                  R4      .RR7      tZ]	P                  ! ]	P                  ]	P                  ! R=]	P                  R4      ]	P                  ! R"]	P                  R4      .RR7      t[R> t\]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      .4      t]]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      ]	P                  ! R?]	P                  R4      ]	P                  ! R@]	P~                  R4      ]	P                  ! RA]	P*                  R4      .RRB7      t^RC t_RRD lt`]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      .RR7      taRE tb]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      ]	P                  ! RF]	P                  R4      ]	P                  ! RG]	P                  R4      .4      tcRH td]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      ]	P                  ! RF]	P                  R4      ]	P                  ! RG]	P                  R4      ]	P                  ! RI]	P*                  R4      .4      teRJ tf]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      ]	P                  ! RF]	P                  R4      ]	P                  ! RG]	P                  R4      .4      tg]	P                  ! ]	P*                  ]	P                  ! R]	P                  R4      ]	P                  ! RF]	P                  R4      ]	P                  ! RG]	P                  R4      .]	P*                  P                  R7      tiRK tj]	P                  ]	P"                  3 UUu/ uEF  p\        P                  \        P                  3 F  pW3\        P                  ! T\        P                  ! RL\        P                  R4      \        P                  ! RM\        P                  R4      \        P                  ! RNVR4      \        P                  ! RO\        P                  R4      \        P                  ! RP\        P                  R4      .VP                  '       d   RMVP                  R7      bK  	  EK  	  upptmRQ tnRR toRS tpRT tqRU trRV tsRW ttRX tuRY tvRZ twR[ txR\ tyR] tzR^ t{]nt|]ot}]pt~]qt]rt]st]tt]ut]vt]wt]xt]yt]ztR_ tR` tRa tRb tRc tRd tRe tRf tRg t]	P                  ! ]	P                  ]	P                  ! Rh]	P,                  R4      .4      tRi t]t]t]t]t]t]t]t]t]t]t]	P                  ! ]	P,                  ]	P                  ! Rh]	P,                  R4      .4      t ]	P                  ! ]PN                  ]	P                  ! Rj]P>                  R4      ]	P                  ! Rk]	P                  R4      .4      tRl t]	P                  ! ]PN                  ]	P                  ! Rj]P>                  R4      ]	P                  ! Rm]	P                  R4      ]	P                  ! Rn]	P~                  R4      .4      tRo t]	P                  ! ]P>                  ]	P                  ! Rj]P>                  R4      ]	P                  ! Rp]	P                  R4      .4      tRq t]	P                  ! ]	P                  ]	P                  ! Rj]	P                  R4      ]	P                  ! Rr]	P                  R4      ]	P                  ! Rs]	P~                  R4      ]	P                  ! Rt]	P~                  R4      ]	P                  ! Ru]	P*                  R4      .RR7      tRv tRw tRx t]	P                  ! ]	P~                  ]	P                  ! Rj]P>                  R4      ]	P                  ! Rr]	P                  R4      ]	P                  ! Rs]	P~                  R4      ]	P                  ! Rt]	P~                  R4      ]	P                  ! Ru]	P*                  R4      .RR7      tRy tRz tR{ t]	P                  ! ]	P~                  ]	P                  ! Rj]P>                  R4      ]	P                  ! Rr]	P                  R4      ]	P                  ! Rs]	P~                  R4      ]	P                  ! Rt]	P~                  R4      .RR7      tR| t]	P                  ! ]P>                  ]	P                  ! Rj]P>                  R4      ]	P                  ! Rr]	P                  R4      ]	P                  ! R}]	P                  R4      ]	P                  ! R~]	P~                  R4      .4      tR t]	P                  ! ]P                  ]	P                  ! R]P>                  R4      ]	P                  ! R]	P                  R4      ]	P                  ! R]	P                  R4      .4      t]	P                  ! ]P                  ]	P                  ! R]P>                  R4      .4      t. ROt] Uu. uF  pVE\h        EPj                  ! V4      3NK  	  uptR t]	EPp                  ! ]	P                  ! ]P>                  ]	P                  ! R]	P                  R4      ]	P                  ! R]	P~                  R4      ]	P                  ! R]	P                  R4      .4      4      t]	P                  ! ]P>                  ]	P                  ! R]	P                  R4      ]	P                  ! Rs]	P~                  R4      ]	P                  ! R]	P~                  R4      ]	P                  ! R]	P                  R4      ]	P                  ! R]	P                  R4      ]	P                  ! R]R4      .4      t]	P                  ! ]P>                  ]	P                  ! R]	P                  R4      ]	P                  ! Rs]	P~                  R4      ]	P                  ! R]	P~                  R4      ]	P                  ! R]	P                  R4      ]	P                  ! R]	P                  R4      ]	P                  ! R]R4      .4      tRtR t]tR tR tR tR tR t RRR]EP                  EP                  R3R ltR t]	P                  ! ]	P                  ]	P                  ! R]	P                  R4      .4      tR tR tR tRtVtR# u up i u uppi u upi )OptimizeBuiltinCallsix  a(  Optimize some common methods calls and instantiation patterns
for builtin types *after* the type analysis phase.

Running after type analysis, this transform can only perform
function replacements that do not alter the function return type
in a way that was not anticipated by the type analysis.
c                D    V P                  V4       VP                  4       # )z:Flatten redundant type checks after tree changes.
        )rc   	reanalyserd   s   &&r!   visit_PyTypeTestNode)OptimizeBuiltinCalls.visit_PyTypeTestNode  s     	4 ~~r#   c                    V P                  V4       VP                  VP                  P                  8X  d   VP                  # V# )z
Drop redundant type casts.
)rc   rH   r   rd   s   &&r!   _visit_TypecastNode(OptimizeBuiltinCalls._visit_TypecastNode  s7     	4 99)))<<r#   c                   V P                  V4       \        VP                  \        P                  4      '       d   VP                  P
                  Vn        VP                  pVe%   VP                  '       g   VP                  '       d   R# VP                  '       dM   VP                  '       d;   VP                  P                  '       g   VP                  P                  '       d   R# V# )z'
Drop dead code and useless coercions.
N)rc   r&   rh   r   r  r'   rG   r  r   r   is_localis_arg)r`   r(   rh   s   && r!   ri   'OptimizeBuiltinCalls.visit_ExprStatNode  s     	4 dii!=!=>>		DIyy<4<<<4???<<<DJJJDJJ,?,?,?4::CTCTCTr#   c                   V P                  V4       VP                  p\        V\        P                  4      '       d   VP                  p\        V\        P
                  4      '       dY   VP                  \        P                  \        P                  39   d*   VP                  P                  V P                  4       4      # V# )z<Drop redundant conversion nodes after tree changes.
        )rc   r'   r&   r   PyTypeTestNoder  rH   r	   r  r
   	bool_typecoerce_to_booleanr   r`   r(   r'   s   && r!   visit_CoerceToBooleanNode.OptimizeBuiltinCalls.visit_CoerceToBooleanNode  s     	4 hhc93344''Cc97788xxJ55w7H7HIIww001A1A1CDDr#   oNc                @   V P                  V4       VP                  p\        V\        P                  4      '       d   VP                  p\        V\        P
                  4      '       Ed4   VP                  P                  R8X  Ed   \        VP                  4      ^8X  d   VP                  ^ ,          pVP                  \        P                  J d   VP                  R4      # VP                  P                  '       d   VP                  P                  R8X  d   \        P
                  ! VP                   RV P"                  V.RVP$                  \&        P(                  ! RR4      VP*                  R7      P-                  VP                  V P/                  4       4      # V# )z3Drop redundant conversion nodes after tree changes.r  =float() argument must be a string or a number, not 'NoneType'__Pyx_PyObject_AsDouble__Pyx_PyNumber_Floatpynumber_floatzTypeConversion.c)r   py_namer-  r  r  )rc   r'   r&   r   CoerceFromPyTypeNoderl  r
  r    rP   r   rH   r
   r  r'  r   rB  r   PyNumber_Float_func_typer-  r   r   r  r   r   )r`   r(   r'   func_args   &&  r!   visit_CoerceToPyTypeNode-OptimizeBuiltinCalls.visit_CoerceToPyTypeNode  s-   4 hhc999::''Cc97788||  G+CHH0B88A;==G$6$66#556uvv]]...3<<3E3EIb3b$77"8$:W:W&Z ' $'2'>'>?OQc'd'+':':  i		4+;+;+=>? r#   c                   V P                  V4       VP                  pVP                  P                  '       gH   VP                  VP                  8w  d+   VP	                  VP                  V P                  4       4      pV# \        V\        P                  4      '       d   VP                  pVP                  '       d   VP                  P                  '       d!   \        V\        P                  4      '       gy   VP                  P                  '       d!   \        V\        P                  4      '       g=   VP                  P                  '       dK   \        V\        P                  4      '       d+   VP	                  VP                  V P                  4       4      # V# \        V\        P                  4      '       Ed!   VP                  \         P"                  J dm   VP                  P%                  VP                  P                  4      '       d5   VP                  P	                  VP                  V P                  4       4      #  V# VP                  \&        P(                  J dw   VP                  P                  P*                  '       dQ   VP                  P*                  '       d5   VP                  P	                  VP                  V P                  4       4      # V# \        V\        P,                  4      '       dJ   VP                  P                  '       g   VP                  P                  '       d   V P/                  W4      # V# )zDrop redundant conversion nodes after tree changes.

Also, optimise away calls to Python's builtin int() and
float() if the result is going to be coerced back into a C
type anyway.
)rc   r'   rH   r   r   r   r&   r   rp  r  r  r   is_floatr  r   r  r	   r  r  r
   r   is_unicode_charr  _optimise_numeric_cast_callrs  s   && r!   visit_CoerceFromPyTypeNode/OptimizeBuiltinCalls.visit_CoerceFromPyTypeNode  s-    	4 hhxx###yyCHH$mmDIIt/?/?/ABJc93344''C>>>		   ZY5F5F%G%GII&&&:c9;N;N+O+OII$$$C9K9K)L)L}}TYY0@0@0BCC  Y99::xx:44499,,SWW\\::77,,TYY8H8H8JKK ;  W11177<<///DII4M4M4M77,,TYY8H8H8JKK  Y5566yy499#5#5#577BBr#   r'   c           
        VP                   pR p\        V\        P                  4      '       d   VP                  pM|\        V\        P
                  4      '       d]   VP                  P                  '       dA   \        VP                  \        P                  4      '       d   VP                  P                  pVe   \        V4      ^8w  d   V# V^ ,          p\        V\        P                  4      '       d   VP                  pMVP                  P                  '       d   V# VP                  R8X  Ed   VP                  P                  '       g   VP                  P                  '       d   VP                  VP                  8X  d   V# VP                  \         P"                  \         P$                  39   d   V P'                  WP                  V4      # VP                  P)                  VP                  4      '       g   VP                  P*                  '       d-   \        P,                  ! VP.                  WQP                  R7      #  V# VP                  P*                  '       d   VP                  P0                  '       d   VP                  P2                  R8X  d   RpMRVP                  P2                  ,           p\        P                  ! VP.                  VV P4                  VP                  ,          V.RVP6                  VP8                  R7      P;                  VP                  V P=                  4       4      # V# VP                  R8X  Ed   VP                  P*                  '       g   VP                  P*                  '       d   VP                  VP                  8X  d   V# VP                  \         P"                  \         P$                  39   d   V P'                  WP                  V4      # VP                  P)                  VP                  4      '       g   VP                  P*                  '       d-   \        P,                  ! VP.                  WQP                  R7      # V# )Nr  r  l__Pyx_truncltrunc)r  r   r|  r-  r  r  )r
  r&   r   rl  r   r2   rH   is_builtin_typer	  r  rP   r  r'   r   r    r  r	   r   c_py_unicode_type_pyucs4_to_numberr  r  r  r   
is_numericmath_h_modifierfloat_float_func_typesr-  r  r   r   )r`   r(   r'   r
  r   r  truncls   &&&    r!   r  0OptimizeBuiltinCalls._optimise_numeric_cast_call  s   <<c9778888D)"4"455}},,,CMM9K^K^1_1_}}))<3t9>K7h	 < <==||H]]&&&K==E!}}###tyy'7'7'7==DII-#O]]z'@'@*B^B^&__11$xPPYY..x}}==AWAWAW$11$((HS\S\]] BX4 1 '''DII,@,@,@==00C7+F$x}}'D'DDF 33HHf"99(--H"! LL#'#6#6 )DIIt'7'7'9:;$  ]]g%}}%%%);););==DII-#O]]z'@'@*B^B^&__11$xPPYY..x}}==AWAWAW$11(D Dr#   rc  c                f   VR9   g   Q h\         P                  ! VP                  VR 8X  d   RMRVR 8X  d   V P                  MV P                  V.TVP
                  VP                  \        P                  ! VR 8X  d   RMRR4      R7      P                  VP                  V P                  4       4      # )r  __Pyx_int_from_UCS4__Pyx_double_from_UCS4
int_pyucs4float_pyucs4
Builtins.c)r  r   r|  r-  r  r  )r  r  )r   rl  r   pyucs4_int_func_typepyucs4_double_func_typer-  r  r   r   r   rH   r   )r`   r(   py_type_namer  s   &&&&r!   r  &OptimizeBuiltinCalls._pyucs4_to_number7	  s    ////++HH|u/D+Jb3?53Hd//dNjNj LL..$00QVAV\jlxy
 )DIIt//1
2	3r#   c           
         V'       g   R pM,\        V\        4      '       g   V^8  d   RpMV^8X  d   RpMR pVe   RV,          pMR p\        VP                  RWV\	        V4      3,          4       R# r  r  r  s   &&&&&  r!   r  +OptimizeBuiltinCalls._error_wrong_arg_countC	  r  r#   c                    V# r%   rl   )r`   r(   r  r
  arg_listr  s   &&&&&&r!   _handle_function%OptimizeBuiltinCalls._handle_functionU	  s    r#   c           
     |   V'       d   V# V'       d/   VP                   '       d   VP                  P                  '       g   V# V P                  4       P	                  V4      pV'       g   V# \
        P                  ! VP                  P                  \
        P                  ! VP                  VVVP                  R7      VRR7      P                  V P                  4       4      p	V	f   V P                  WWEV4      # VP                  p
V
f)   VP                  '       d   VP                  P                  p
\
        P                  ! VP                  V	V
R7      pV'       g   VP                  Vn        VP#                  V P                  4       4       RVn        VP'                  VP                  V P                  4       4      # )z
Try to inject C-API calls for unbound method calls to builtin types.
While the method declarations in Builtin.py already handle this, we
can additionally resolve bound and unbound methods here that were
assigned to variables ahead of time.
)r    r   rH   T)r6   r7   	is_calledr.  )r   r6   r   r   r?  r   r3   r
  r   r2   rH   analyse_as_type_attribute%_optimise_generic_builtin_method_callr   r	  r  r`   analyse_c_function_callanalysedr   )r`   r(   	type_name	attr_namer
  r  is_unbound_methodr  
type_entryr   r   	call_nodes   &&&&&&&&    r!   _handle_method#OptimizeBuiltinCalls._handle_methodX	  sf    Kx444HLL<P<P<P K%%'..y9
K((MM"" __	&
   65d6F6F6HI 	 >==5FH Hyy<DNNN>>&&D,,HH	 !%\\IN))$*:*:*<=!	""499d.>.>.@AAr#   c                h   \        V4      pV'       g,   V^8  g%   VP                  '       d   VP                  '       g   V# VP                  P                  P
                  '       g   V# VP                  P                  \        P                  J d   V# \        P                  ! WP                  W$4      # )z
Try to inject an unbound method call for a call to a method of a known builtin type.
This enables caching the underlying C function of the method at runtime.
)
rP   r   r4   r6   rH   r  r
   rQ   r   CachedBuiltinMethodCallNode)r`   r(   r  r
  r  r  r  s   &&&&&& r!   r  :OptimizeBuiltinCalls._optimise_generic_builtin_method_call	  s    
 M		Qx7L7L7LQYQdQdQdK||  000K<< 1 11K44,,	5 	5r#   r6   c           
        \        V4      ^8w  d=   \        V4      ^ 8X  d+   \        P                  ! VP                  \	        4       R7      # V# V^ ,          pVP
                  \        P                  J d3   VP                  4       '       g   V# Rp\        P                  ! RR4      pMRp\        P                  ! RR4      p\        P                  ! VP                  WPP                  VVP                  VRR7      # )	z5Optimise single argument calls to unicode().
        r   __Pyx_PyUnicode_UnicodePyUnicode_UnicodeStringTools.c__Pyx_PyObject_UnicodePyObject_Unicodeunicoder   r-  r  r|  )rP   r   r   r   r   rH   r
   r   may_be_noner   r   rl  PyObject_Unicode_func_typer-  )r`   r(   r
  r  r'   rB  r  s   &&&&   r!   _handle_simple_function_unicode4OptimizeBuiltinCalls._handle_simple_function_unicode	  s     x=A8}! ,,TXX]_MMKqk88w+++??$$
-E&223FXL,E&223EWL++HHe<<LL% 	r#   c                B   V P                  V4       VP                  P                  \        P                  J df   VP
                  '       gT   VP                  '       gB   VP                  '       d   VP                  R8X  d   V P                  VRVP                  .4      # V# )zSimplify or avoid plain string formatting of a unicode value.
This seems misplaced here, but plain unicode formatting is essentially
a call to the unicode() builtin, which is optimised right above.
ra  N)	rc   r   rH   r
   r   c_format_specformat_specconversion_charr  rd   s   &&r!   visit_FormattedValueNode-OptimizeBuiltinCalls.visit_FormattedValueNode	  sx    
 	4 ::??g2224;M;M;MVZVfVfVf'''4+?+?3+F;;D$UUr#   r   c                   \        V4      ^8w  d   V# V^ ,          pVP                  \        P                  J dL   VP	                  R4      p\
        P                  ! VP                  RV P                  V.VP                  R7      # V# )z;Replace dict(some_dict) by PyDict_Copy(some_dict).
        r+  PyDict_Copyrg  )
rP   rH   r
   r   r'  r   rl  r   PyDict_Copy_func_typer-  r`   r(   r
  r  r'   s   &&&& r!   rL  1OptimizeBuiltinCalls._handle_simple_function_dict	  sx     x=AKqk88w(((''(DEC//-)C)Cu,, 
 r#   r  c                d   \        V4      ^8w  d   V# V^ ,          p\        P                  ! VP                  VP	                  4       '       dH   VP	                  4       '       d2   VP
                  \        P                  \        P                  39   d   RMRV P                  VVP                  R7      # )z0Turn list(ob) into PySequence_List(ob).
        r  r	  rg  )rP   r   rl  r   r  rH   r	   r  r
   r&  r  r-  r  s   &&&& r!   r>  1OptimizeBuiltinCalls._handle_simple_function_list	  s     x=AKqk++HH''))c.@.@.B.BHH!:!:G<M<M NN + '**LL	
 		
r#   r@   c                   \        V4      ^8w  g   VP                  4       '       g   V# V^ ,          pVP                  \        P                  J d   VP                  4       '       g   V# VP                  \        P                  J dD   VP                  R4      V^ &   \        P                  ! VP                  RV P                  VRR7      # \        P                  ! VP                  V\        P                  R7      # )zDReplace tuple([...]) by PyList_AsTuple or PySequence_Tuple.
        r$  PyList_AsTupleTrg  )r'   rH   )rP   r  rH   r
   r%  r  r&  r'  r   rl  r   PyList_AsTuple_func_typer4  r  s   &&&& r!   _handle_simple_function_tuple2OptimizeBuiltinCalls._handle_simple_function_tuple	  s     x=AT%8%8%:%:Kqk88w)))#//2C2CJ88w(((//35HQK //*D,I,It- - ((sASASTTr#   c                   \        V4      ^8w  d   V# V^ ,          P                  '       d   . p. pV^ ,          P                   FQ  pVP                  4       '       g(   \        P
                  ! V4      pVP                  V4       VP                  V4       KS  	  \        P                  ! VP                  ^VR7      pV P                  W4       VRRR1,           F  p\        P                  ! W4      pK  	  V# V P                  V\        P                  ! VP                  RV P                  VVP                  RR7      4      # )r   )r-  r   N	PySet_NewrO   r   r-  r|  rM   )rP   r   r   	is_simpler   r=  rR   r   r  r   r_  r  rl  PySet_New_func_typer-  )	r`   r(   r
  r  r   r   r'   r5  r  s	   &&&&     r!   rA  0OptimizeBuiltinCalls._handle_simple_function_set
  s   x=AKA;... DE{''}}#..s3CLL%C 	 (
 &&txxFFLL&dd"77E $M <<i&B&B+(('    r#   c                   V'       g#   \         P                  ! VP                  4      .pM]\        V4      ^8  d   V# V^ ,          P                  \
        P                  J d'   V^ ,          P                  4       '       g
   V^ ,          # \         P                  ! VP                  RV P                  VVP                  \        P                  ! RR4      RR7      # )r   __Pyx_PyFrozenSet_Newpyfrozenset_newr  	frozensetr  )r   r  r   rP   rH   r
   r   r  rl  PyFrozenSet_New_func_typer-  r   r   r`   r(   r
  r  s   &&&&r!   r:  6OptimizeBuiltinCalls._handle_simple_function_frozenset&
  s    !**48845H]QKa[!7!77@W@W@Y@YA;++HH-**LL$001BLQ! 	!r#   z((double)-1)T)rd  exception_checkc           
     (   \        V4      ^ 8X  dF   \        P                  ! VRRR7      P                  \        P
                  V P                  4       4      # \        V4      ^8w  d   V P                  RWR4       V# V^ ,          p\        V\        P                  4      '       d   VP                  pVP                  \        P                  J d   V# VP                  \        P                  \        P                  39   d   V P!                  WP"                  V4      # VP                  P%                  VP                  4      '       g   VP                  P&                  '       d-   \        P(                  ! VP*                  WAP                  R7      # V^ ,          P-                  R4      pVP                  \        P.                  J d   RpR	pMvVP                  \        P0                  J d   R
pR	pMSVP                  \        P2                  J d   RpRpM0VP                  \        P4                  J d   RpRpMV^ ,          pRpRp\        P6                  ! VP*                  TV P8                  V.VP:                  V'       d   \=        V4      RR7      # RRR7      # )zITransform float() into either a C type cast or a faster C
function call.
r  g        r,  r  0 or 1r  rx  __Pyx_PyBytes_AsDoublepybytes_as_double__Pyx_PyByteArray_AsDouble__Pyx_PyUnicode_AsDoublepyunicode_as_doublePyLong_AsDoubleNry  pyobject_as_doubler  )rP   r   r  r   r
   r  r   r  r&   r  r'   rH   r	   r  r   r  r  r    r  r  r  r   r'  r  r  r   int_typerl  PyObject_AsDouble_func_typer-  r"   )r`   r(   r
  r  r  r'   
cfunc_nameutility_code_names   &&&&    r!   r  2OptimizeBuiltinCalls._handle_simple_function_float=
  s    x=A&&E3)G..0@0@0BCD ]a''JKA;h	 < <==||H==J444O]]z88*:V:VWW))$xHHYY&&x}}559Q9Q9Q))(< < qk++KM ==G...1J 3]]g4445J 3]]g2223J 5]]g...*J $1+C2J 4++HHj,,5ll@Q>*;< 	
 X\ 	r#   r   c           	        \        V4      ^ 8X  d;   \        P                  P                  VP                  ^ \
        P                  R7      # \        V4      ^8w  d   V# V^ ,          p\        V\        P                  4      '       dd   VP                  P                  P                  '       d<   \        P                  ! VP                  RV P                  VP                  .RRR7      # V# VP                  P                  '       dM   VP                  P                  '       d1   \        P                  ! VP                  RV P                  VRRR7      # V# )z7Transform int() into a faster C function call.
        r   PyLong_FromDoubleTr  r  __Pyx_PyNumber_Int)rP   r   r   r   r   r
   r  r&   r  r'   rH   r  rl  PyLong_FromDouble_func_typer   PyNumber_Int_func_type)r`   r(   r
  r  r  s   &&&& r!   _handle_simple_function_int0OptimizeBuiltinCalls._handle_simple_function_int}
  s    x=A$$,,TXXqw?O?O,PP]aKA;h	 < <==||  ))) 33HH143S3S",,u 
 ==$$$)>)>)>//.0K0KtU< < r#   c                   \        V4      ^ 8X  d2   \        P                  ! VP                  R\        P
                  R7      # \        V4      ^8w  d   V P                  RWR4       V# V^ ,          P                  V P                  4       4      p\        P                  ! VP                  VR7      p\        P                  ! VP                  VR7      pVP                  V P                  4       4      # )z=Transform bool(x) into a type coercion to a boolean.
        Fr   rH   boolr  r   )rP   r   r   r   r
   rq  r  rr  r   r   coerce_to_pyobject)r`   r(   r
  r  r   s   &&&& r!   _handle_simple_function_bool1OptimizeBuiltinCalls._handle_simple_function_bool
  s     x=A%%dhhe'BSBSTT]a''IK qk33D4D4D4FGG''GDG''GDG--d.>.>.@AAr#   c           	     .   \        V4      ^8w  d   V P                  RWR4       V# V^ ,          P                  P                  '       dC   \        P
                  ! VP                  RV P                  V^ ,          .VP                  RR7      # V^ ,          P                  P                  '       dh   V^ ,          P                  \        P                  J dC   \        P
                  ! VP                  RV P                  V^ ,          .VP                  RR7      # V# )r   
memoryview1PyMemoryView_FromObjectr  PyMemoryView_FromBuffer)rP   r  rH   r   r   rl  r   !PyMemoryView_FromObject_func_typer-  r   r   r
   py_buffer_type!PyMemoryView_FromBuffer_func_typer  s   &&&&r!   "_handle_simple_function_memoryview7OptimizeBuiltinCalls._handle_simple_function_memoryview
  s    x=A''dcJK{+++ 33HH7::$QK="ll*, , !!!(((Xa[-B-BgF\F\-\ !33HH7::$QK="ll*, , r#   bytesr  __Pyx_PyUnicode_GET_LENGTHrh  __Pyx_PyByteArray_GET_SIZE__Pyx_PyList_GET_SIZE__Pyx_PyTuple_GET_SIZE__Pyx_PySet_GET_SIZEPyDict_Sizezcpython.array.arrayc                   \        V4      ^8w  d   V P                  RW^4       V# V^ ,          p\        V\        P                  4      '       d   VP
                  pVP                  P                  '       d=   \        P                  ! VP                  RV P                  V.VP                  R7      pEM8VP                  P                  '       dS   \        P                  ! VP                  RV P                  V.VP                  \        P                  ! RR4      R7      pEMVP                  P                   '       d{   \"        P$                  ! \"        P&                  \"        P(                  ! RVP                  R	4      .R
R7      p\        P                  ! VP                  RVV.VP                  R7      pEM4VP                  P*                  '       d   V P-                  VP                  4      pVf[   VP                  pVP.                  '       g   VP0                  '       d)   VP2                  P4                  V P6                  9   d   RpMV# VP9                  R4      p\        P                  ! VP                  WpP:                  V.VP                  R7      pMTVP                  P<                  '       d7   \        P>                  PA                  VP                  ^VP                  R7      # V# VP                  \"        PB                  \"        P&                  39  d+   VPE                  VP                  V PG                  4       4      pV# )zReplace len(char*) by the equivalent call to strlen(),
len(Py_UNICODE) by the equivalent Py_UNICODE_strlen() and
len(known_builtin_type) by an equivalent C-API call.
rP   __Pyx_ssize_strlenrg  __Pyx_Py_UNICODE_ssize_strlenssize_pyunicode_strlenr  r   r-  r  memoryviewsliceNT)nogil__Pyx_MemoryView_LenPy_SIZEz&object of type 'NoneType' has no len()r   )$rP   r  r&   r   r  r'   rH   r  rl  r   Pyx_ssize_strlen_func_typer-  is_pyunicode_ptrPyx_Py_UNICODE_strlen_func_typer   r   r  r	   r  r@  r  r   _map_to_capi_len_functionis_extension_typer  r   qualified_name_ext_types_with_pysizer'  PyObject_Size_func_typer  r   r   c_size_t_typer   r   )	r`   r(   r
  r  r'   r   r  r  r  s	   &&&&     r!   _handle_simple_function_len0OptimizeBuiltinCalls._handle_simple_function_len
  sy   
 x=A''tqAKqkc97788''C88 33.0O0Ou,,(H XX&&& 3394;_;_u,,*667OQ`a	cH
 XX(((",,,,++,=sxxN/I !330)UDLL2H XX!!!77AJ!88///83K3K3K$NN99T=X=XX!*JK''8:C 33*&B&BUDLL2H XX%%%$$,,TXXqtyy,IIK99Z55z7S7STT))$))T5E5E5GHHr#   objectc                    \        V4      ^8w  d   V# \        P                  ! VP                  RV P                  VRR7      p\        P
                  ! V\        P                  4      # )z7Replace type(o) by a macro call to Py_TYPE(o).
        Py_TYPEFrg  )rP   r   rl  r   Pyx_Type_func_typer  r	   r  r  s   &&&&r!   _handle_simple_function_type1OptimizeBuiltinCalls._handle_simple_function_type  sW     x=AK++HHi!8!8 !!$
(A(ABBr#   c                  aa \        V4      ^8w  d   S# Vw  rE. p\        V\        P                  4      '       d   VP                  pMDVP
                  \        P                  J g!   \        V\        P                  4      '       d   V.pMS# \        V4      w  rxV'       dh   V'       g   \        V4      ^8  dP   VP                  '       g   VP                  4       '       g(   \        P                  ! V4      pVP                  V4       . p	V P                  4       oVea   V	P                  \        P                   ! VP"                  VRVR7      P%                  S4      P'                  \(        P*                  S4      4       \-        4       p
V EF  pR;rVP.                  '       dz   VP0                  '       dh   SP3                  VP0                  P4                  4      pV'       d;   VP
                  '       d)   VP
                  P6                  '       d   VP
                  pV\        P                  J dB   VP4                  R8w  g/   VP8                  '       d   VP8                  P:                  '       g   RpVe1   VP=                  RR7      pW9   d   EK  V
P?                  V4       V.pMbVP
                  \        P                  J d   RpWK.pM>VP@                  '       g(   \        P                  ! V4      pVP                  V4       RpWK.pT	P                  \        PB                  ! VP"                  YPD                  TVe   VPF                  MRR	R
7      4       EK  	  \        PH                  3VV3R llp\K        VV	4      P'                  SP
                  S4      pVRRR1,           F  p\        PL                  ! VV4      pK  	  V# )zSReplace isinstance() checks against builtin types by the
corresponding C-API call.
Nisr*  rH   F)exact__Pyx_TypeCheckPyObject_IsInstanceTr   r  r-  c                 |   < V! SP                   R W4      p\        P                  Vn        VP	                  S4       V# )r  )r   r	   r  rH   rc  )r8   r9   make_binop_nodeor_noder  r(   s   &&& r!   join_with_orMOptimizeBuiltinCalls._handle_simple_function_isinstance.<locals>.join_with_orx  s5    %dhha;G%11GL!!#&Nr#   rM   )'rP   r&   r   r  r   rH   r
   rQ   rJ   rX   r   r  r   r,   rR   r   r   r   r   r   r	   r  rO   r   r   r?  r    r  scopeis_builtin_scopetype_check_functionr?  r  rl  Py_type_check_func_typer  rI  r   r  )r`   r(   r
  r  r'   
type_nodesr   rS   rT   
test_nodesbuiltin_teststest_type_nodebuiltin_typer   r3  type_check_argsr/  rW  r  r  s   &f&&               @r!   "_handle_simple_function_isinstance7OptimizeBuiltinCalls._handle_simple_function_isinstance/  s    x=AK"j)"5"566#J__ 1 11Z
ILcLc5d5d$JK $<J#G  '3u:>s}}--c2S!
 (((%)) !.	
 mC :+A+A3!GI #N#''L%%%.*>*>*>

>#7#7#<#<=UZZZEJJ,F,F,F#(::Lw000::'(D(D(D#'L'&2&F&FU&F&S#&7!!"56#&%$$(9(99&7##&"7%000%.%<%<^%LNLL0&;##&"7,,"&&(;=Y=Y(7<7H!3!3d 	5 $D 09/C/C 	 	 <4>>tyy#N	$B$KKD!66tYGI  r#   c                   \        V4      ^8w  d   V# V^ ,          p\        V\        P                  4      '       d   VP                  P
                  P                  '       dd   \        P                  ! VP                  VP                  \        P                  R7      P                  VP
                  V P                  4       4      #  V# \        V\        P                  \        P                  34      '       d   \        VP                  4      ^8X  df   \        P                   P#                  VP                  \%        VP                  4      4      P                  VP
                  V P                  4       4      # V# )z-Unpack ord(Py_UNICODE) and ord('X').
        r  )rP   r&   r   r  r'   rH   r  r  r   r	   r  r   r   r   r  r   r   r   r   r  s   &&&& r!   r  0OptimizeBuiltinCalls._handle_simple_function_ord  s
    x=AKqkc97788ww||+++ --GGSWW:3I3Ii		4+;+;+=>? ,  i33Y5H5HIJJ399~" ((00#cii.ISSTXT]T]_c_o_o_qrrr#   rH   r   r  c           
        VP                   pV'       d   \        V4      ^8  d   V# V^ ,          pVP                  '       d   VP                  '       g   V# VP                  \        P
                  8w  g    VP                  \        P
                  8w  d   V# VP                  '       d   VP                  '       g   VP                  VP                  8w  d   V# MVP                  VP                  8w  d   V# \        P                  ! VP                  VR,          R7      pVP                  V P                  4       RR7      pVP                  '       Ed   VP                  P                  p	V	P                  '       Ed   V	P                  '       Ed   V	P                  P!                  4       V P                  4       P!                  4       8X  Edu   \"        P$                  ! RR4      p
\"        P&                  ! V	P                  V
4      pV'       Ed4   V P(                  P*                  p\,        P.                  ! VP1                  R4      P                  4      p\,        P2                  ! V	\,        P4                  ! RVR	4      \,        P4                  ! R
\,        P6                  R	4      \,        P4                  ! R\,        P6                  R	4      .4      p\        P8                  ! W}4      pV'       g1   \        P:                  ! VP                  \,        P6                  R7      p\        P<                  ! VP                  VVWxV.RRR7      # MVP?                  R4      p\@        PB                  ! RR4      pV'       d=   \        P<                  ! VP                  RV PD                  WxV.VVPF                  R7      # \        P<                  ! VP                  RV PH                  Wx.VVPF                  R7      # )zOReplace 'exttype.__new__(exttype, ...)' by a call to exttype->tp_new()
        r)  r   T)skip_childrentp_new__new__PyTypeObjectrH   Nr   r  r   F)r   may_return_noner-  z4object.__new__(X): X is not a type object (NoneType)zObjectHandling.c__Pyx_tp_new_kwargsr+  __Pyx_tp_new)%r6   rP   r   rH   r
   rQ   r  r    r   r  r   r   r   r  typeobj_cnamer1  r  r   ConstructorSlotget_slot_functionr  cython_scoper	   CPtrTyper?  r  r  r  r  r  rl  r'  r   r   Pyx_tp_new_kwargs_func_typer-  Pyx_tp_new_func_type)r`   r(   r
  r   r  r  r6   type_arg
args_tupleext_typetp_slotslot_func_cnamerJ  PyTypeObjectPtrpyx_tp_new_kwargs_func_typer  s   &&&&&&          r!   _handle_any_slot__new__,OptimizeBuiltinCalls._handle_any_slot__new__  s    ll CIMK7{{{("2"2"2K88w(((HMMW=N=N,NK"""#...xx8==( )   CNN2K((RA
--d . 4
 **//H***x/E/E/ENN//1T5E5E5G5T5T5VV#33HiH"+"="=hnng"V"?#'<<#<#<L&0&9&9$++N;@@'BO2<2F2F &33FotT&33Fj>W>WY]^&33Hj>W>WY]^#3/  )11(LH!!*!3!3DHH:C\C\!]$77/3&F;(- $& &  11FHH #..x9KL///1Q1QF3)	  //.$*C*C+)	 r#   c                    V# r%   rl   )r`   r(   r
  r   r  r  s   &&&&&&r!   _handle_any_slot__class__.OptimizeBuiltinCalls._handle_any_slot__class__  s	    
 r#   r   c                   \        V4      ^8w  g/   VP                  '       g   VP                  P                  '       d   V# \        P
                  ! VP                  RV P                  VRVP                  R\        R4      R7      # )zLOptimistic optimisation as X.append() is almost always
referring to a list.
__Pyx_PyObject_AppendFrR   )r   rD  r-  r  r  )
rP   r  r
  r   r   rl  r   PyObject_Append_func_typer-  r"   r`   r(   r
  r   r  s   &&&&&r!   #_handle_simple_method_object_append8OptimizeBuiltinCalls._handle_simple_method_object_append  sk     t9>T000DMM4G4G4GK++HH-t/M/M!LL '1
 	
r#   c                   \        V4      ^8w  d   V# Vw  rVVP                  '       g   V# \        VP                  4      pVP                  f   \        V4      ^8  d    T# V P                  WRVR4      p	V'       g   VP                  V	n        V	# T	;r\        V4      ^8  d-   VP                  4       '       g   \         P"                  ! V4      p
. pVR,          pVP                  4       '       g(   \         P"                  ! V4      pVP%                  V4       \        P&                  ! VP(                  RV P*                  W.R\-        R4      R7      pVRRR1,           F  pVP                  4       '       g(   \         P"                  ! V4      pVP%                  V4       \        P.                  ! VP(                  R\        P&                  ! VP(                  RV P*                  W.RR\-        R	4      R
7      V\0        P2                  R7      pK  	  VP                  Vn        WJd   VP%                  V
4       V F*  p\         P4                  ! W4      pVP                  Vn        K,  	  V# )zReplace list.extend([...]) for short sequence literals values by sequential appends
to avoid creating an intermediate sequence argument.
NTextend__Pyx_PyList_Append
ListAppendr  |__Pyx_ListComp_AppendListCompAppend)r   r|  r-  r  r   rM   )rP   r   r@   r   mult_factorr&   r   r   r9  r   r   r   r  _wrap_self_argr  r  r   r=  rR   rl  r   r\  r"   rI  r	   c_returncode_typer  )r`   r(   r
  r   r  r6   r   r   
tuple_nodewrapped_obj
cloned_objr   r'   r   r  s   &&&&&          r!   !_handle_simple_method_list_extend6OptimizeBuiltinCalls._handle_simple_method_list_extend  s    t9>K
,,,KUZZ (CJN  K))#9JHU)-)<)<K&&&
u:>#--//"--c2J Bi}}&&s+CLL//HH+T-K-K"'5	7
 R==C==??**3/S! ++#,,HH5t7U7U$*H !/0@!A	C
 11	H	 ! #'"5"5 LL$D 55dEH&*&9&9H#  r#   	bytearrayc           
        \        V4      ^8w  d   V# RpV P                  p\        V^,          4      pVP                  P                  '       g!   \        V\        P                  4      '       dG   VP                  \        P                  V P                  4       4      p\        P                  ! RR4      pMVP                  '       d_   VP                  4       '       g   V# VP                  \        P                   V P                  4       4      p\        P                  ! RR4      pMDVP                  P"                  '       d'   RpV P$                  p\        P                  ! RR4      pMV# \        P&                  ! VP(                  WVV^ ,          V.RVP*                  VR7      p	VP,                  '       d+   V	P                  VP                  V P                  4       4      p	V	# )r>   __Pyx_PyByteArray_AppendByteArrayAppendr  __Pyx_PyByteArray_AppendObjectByteArrayAppendObjectFr   rD  r-  r  )rP   PyByteArray_Append_func_typer*   rH   r  r&   r   r   r   r	   r  r   r   r   r   can_coerce_to_char_literalc_char_typer   "PyByteArray_AppendObject_func_typerl  r   r-  r  )
r`   r(   r
  r   r  	func_namer  r   r  r   s
   &&&&&     r!   &_handle_simple_method_bytearray_append;OptimizeBuiltinCalls._handle_simple_method_bytearray_appendX  sr   t9>K.	55	#DG,::
5)2C2C D DOOJ$9$94;K;K;MNE&223DoVL$$$3355OOJ$:$:D<L<L<NOE&223DoVLZZ###8I??I&223JO\LK//HHiq'5!!LL%
 ))$))T5E5E5GHHr#   py_indexc_index	is_signed)has_varargsc                *    V P                  WW4R R7      # )T)is_list) _handle_simple_method_object_popr]  s   &&&&&r!   _handle_simple_method_list_pop3OptimizeBuiltinCalls._handle_simple_method_list_pop  s#    44DT 5 C 	Cr#   c                   V'       g   V# V^ ,          pV'       d   RpVP                  RRR.R7      pMRp\        V4      ^8X  dM   \        P                  ! VP                  RV,          V P
                  V.RVP                  \        R4      R	7      # \        V4      ^8X  Ed>   \        V^,          4      p\        P                  ! VP                  4      p	VP                  p
VP                  P                  '       g   \        V\        P                  4      '       dP   VP                  V P                  4       4      p	VP!                  \"        P$                  V P                  4       4      pEM V'       d   VP                  P&                  '       d6   VP)                  V P                  4       4      p	\        P*                  ! V	4      pVP!                  \"        P$                  V P                  4       4      pMxV# \"        P,                  ! VP                  \"        P$                  4      '       g   V# \        V\        P                  4      '       d    VP                  V P                  4       4      p	V
P                  '       g   VP                  p
V
P/                  V P                  4       4      '       g   V# V
P0                  p\"        P2                  ! \"        P4                  \"        P6                  ! R
V
R4      .4      p\        P                  ! VP                  RV,          V P8                  YiT\        P                  P;                  VP                  V
P<                  '       d   ^M^ 4      \        P>                  ! VP                  \"        P@                  V
PC                  4       4      \        P>                  ! VP                  W4      .RVP                  \        R4      R	7      # V# )zLOptimistic optimisation as X.pop([n]) is almost always
referring to a list.
List*'NoneType' object has no attribute '%.30s'r  rN   r  Objectz__Pyx_Py%s_PopTrv  intvalNz__Pyx_Py%s_PopIndex	pop_index)"r'  rP   r   rl  r   PyObject_Pop_func_typer-  r"   r*   r  rH   r  r&   r   r  r   r   r	   r@  r   r  r  numeric_type_fitscreate_to_py_utility_codeto_py_functionr  r  r  PyObject_PopIndex_func_typer   signedRawCNameExprNodec_void_typeempty_declaration_code)r`   r(   r
  r   r  r  r6   r  r4  r~  orig_index_typeconvert_funcconversion_types   &&&&&&       r!   r  5OptimizeBuiltinCalls._handle_simple_method_object_pop  s    K1gI''<,"G ( %C
 !It9>//*Y6++U $+E2  Y!^'Q0E ))%))4H#jjO::$$$eY%6%677$778H8H8JKH!OOJ,H,H$JZJZJ\]Ezz---#(#9#9$:J:J:L#M ) 3 3H =!OOJ,H,H$JZJZJ\]EK11%**j>Z>Z[[E9#4#455 33D4D4D4FG")))"'**"<<T=M=M=OPP*99L(22))J,C,CHo_c,d+egO///);00U''//		@V@V@V1\]^00J<R<R1@1W1W1Y[00OZ	\
 !%+K8  r#   c           	         \        V4      ^8w  d   V# V P                  WRV P                  RWC4      P                  VP                  V P
                  4      # )z?Call PyList_Sort() instead of the 0-argument l.sort().
        PyList_Sortsort)rP   _substitute_method_callsingle_param_func_typer   rH   r   r]  s   &&&&&r!   _handle_simple_method_list_sort4OptimizeBuiltinCalls._handle_simple_method_list_sort  sQ     t9>K++M4+F+F%--6Ytyy$BRBR-S	Tr#   keydefaultc                "   \        V4      ^8X  d1   VP                  \        P                  ! VP                  4      4       M%\        V4      ^8w  d   V P                  RWR4       V# V P                  WRV P                  RWCR\        R4      R7	      # )z:Replace dict.get() by a call to PyDict_GetItem().
        zdict.get2 or 3__Pyx_PyDict_GetItemDefaultrQ  Tdict_getitem_defaultrD  r  )	rP   rR   r   r  r   r  r  Pyx_PyDict_GetItem_func_typer"   r]  s   &&&&&r!   _handle_simple_method_dict_get3OptimizeBuiltinCalls._handle_simple_method_dict_get  s     t9>KK	**48845Y!^''
DIK++)4+L+L$")*@A , C 	Cr#   is_safe_typec                :   \        V4      ^8X  d1   VP                  \        P                  ! VP                  4      4       M%\        V4      ^8w  d   V P                  RWR4       V# V P                  WRV P                  RWCR\        P                  ! RR4      R7	      # )	zUReplace dict.setdefault() by calls to PyDict_GetItem() and PyDict_SetItem().
        zdict.setdefaultr  __Pyx_PyDict_SetDefault
setdefaultTdict_setdefaultr  r  )
rP   rR   r   r  r   r  r  Pyx_PyDict_SetDefault_func_typer   r   r]  s   &&&&&r!   %_handle_simple_method_dict_setdefault:OptimizeBuiltinCalls._handle_simple_method_dict_setdefault  s     t9>KK	**48845Y!^''(94xPK++%t'K'K+ $001BLQ , S 	Sr#   c                r   RpRpV P                   p\        V4      ^8X  d1   VP                  \        P                  ! VP
                  4      4       MH\        V4      ^8X  d$   VP                  '       g   RpRpV P                  pMV P                  RWR4       V# V P                  WWWRWCR\        V4      R	7	      # )
z7Replace dict.pop() by a call to _PyDict_Pop().
        __Pyx_PyDict_Poppy_dict_pop__Pyx_PyDict_Pop_ignorepy_dict_pop_ignorezdict.popr  rN   Tr  )PyDict_Pop_func_typerP   rR   r   r  r   r  PyDict_Pop_ignore_func_typer  r  r"   )r`   r(   r
  r   r  	capi_funcr  r  s   &&&&&   r!   _handle_simple_method_dict_pop3OptimizeBuiltinCalls._handle_simple_method_dict_pop  s     '	)--	t9>KK	**48845Y!^&&&5	$8! <<	''
DIK++$ '(9: , < 	<r#   op1op2cvalr;  zerodiv_checkc                (    V P                  R WW44      # Add_optimise_num_binopr]  s   &&&&&r!   $_handle_simple_method_object___add__9OptimizeBuiltinCalls._handle_simple_method_object___add__B      ''ttWWr#   c                (    V P                  R WW44      # Subtractr  r]  s   &&&&&r!   $_handle_simple_method_object___sub__9OptimizeBuiltinCalls._handle_simple_method_object___sub__E      ''
DD\\r#   c                (    V P                  R WW44      # )Multiplyr  r]  s   &&&&&r!   $_handle_simple_method_object___mul__9OptimizeBuiltinCalls._handle_simple_method_object___mul__H  r  r#   c                (    V P                  R WW44      # Eqr  r]  s   &&&&&r!   #_handle_simple_method_object___eq__8OptimizeBuiltinCalls._handle_simple_method_object___eq__K      ''ddVVr#   c                (    V P                  R WW44      # Ner  r]  s   &&&&&r!   #_handle_simple_method_object___ne__8OptimizeBuiltinCalls._handle_simple_method_object___ne__N  r  r#   c                (    V P                  R WW44      # )Andr  r]  s   &&&&&r!   $_handle_simple_method_object___and__9OptimizeBuiltinCalls._handle_simple_method_object___and__Q  r  r#   c                (    V P                  R WW44      # )Orr  r]  s   &&&&&r!   #_handle_simple_method_object___or__8OptimizeBuiltinCalls._handle_simple_method_object___or__T  r  r#   c                (    V P                  R WW44      # )Xorr  r]  s   &&&&&r!   $_handle_simple_method_object___xor__9OptimizeBuiltinCalls._handle_simple_method_object___xor__W  r  r#   c                    \        V4      ^8w  g(   \        V^,          \        P                  4      '       g   V# V^,          P	                  4       '       d%   ^V^,          P
                  u;8:  d
   ^?8:  g    V#  V# V P                  RWW44      # )r>   RshiftrP   r&   r   r   r  r;   r  r]  s   &&&&&r!   '_handle_simple_method_object___rshift__<OptimizeBuiltinCalls._handle_simple_method_object___rshift__Z  w    t9>DGY5F5F!G!GKAw**,,Q$q':Q:Q5WUW5WK 6XK''$$ZZr#   c                    \        V4      ^8w  g(   \        V^,          \        P                  4      '       g   V# V^,          P	                  4       '       d%   ^V^,          P
                  u;8:  d
   ^?8:  g    V#  V# V P                  RWW44      # )r>   Lshiftr  r]  s   &&&&&r!   '_handle_simple_method_object___lshift__<OptimizeBuiltinCalls._handle_simple_method_object___lshift__a  r  r#   c                (    V P                  R WW44      # 	Remainder_optimise_num_divr]  s   &&&&&r!   $_handle_simple_method_object___mod__9OptimizeBuiltinCalls._handle_simple_method_object___mod__h  s    %%k44[[r#   c                (    V P                  R WW44      # )FloorDivider  r]  s   &&&&&r!   )_handle_simple_method_object___floordiv__>OptimizeBuiltinCalls._handle_simple_method_object___floordiv__k  s    %%mTT]]r#   c                (    V P                  R WW44      # 
TrueDivider  r]  s   &&&&&r!   (_handle_simple_method_object___truediv__=OptimizeBuiltinCalls._handle_simple_method_object___truediv__n  s    %%lDD\\r#   c                (    V P                  R WW44      # Divider  r]  s   &&&&&r!   $_handle_simple_method_object___div__9OptimizeBuiltinCalls._handle_simple_method_object___div__q  s    %%hXXr#   c                   \        V4      ^8w  g6   V^,          P                  4       '       d   V^,          P                  ^ 8X  d   V# \        V^,          \        P
                  4      '       d(   RV^,          P                  u;8:  d
   R8:  g    V#  V# MP\        V^,          \        P                  4      '       d(   RV^,          P                  u;8:  d
   R8:  g    V#  V# MV# V P                  WW4V4      # )r>   r   r   l          l       )rP   r  r;   r&   r   r   r  r  )r`   r   r(   r
  r   r  s   &&&&&&r!   r  &OptimizeBuiltinCalls._optimise_num_div  s    t9>a!<!<!>!>$q'BYBY]^B^Kd1gy0011d1g55>> ? ?Q!4!455d1g55>> ? ? K''HYZZr#   c                (    V P                  R WW44      # r  r  r]  s   &&&&&r!   #_handle_simple_method_float___add__8OptimizeBuiltinCalls._handle_simple_method_float___add__  r  r#   c                (    V P                  R WW44      # r  r  r]  s   &&&&&r!   #_handle_simple_method_float___sub__8OptimizeBuiltinCalls._handle_simple_method_float___sub__  r  r#   c                (    V P                  R WW44      # r   r  r]  s   &&&&&r!   '_handle_simple_method_float___truediv__<OptimizeBuiltinCalls._handle_simple_method_float___truediv__  s    ''dd^^r#   c                (    V P                  R WW44      # r  r  r]  s   &&&&&r!   #_handle_simple_method_float___div__8OptimizeBuiltinCalls._handle_simple_method_float___div__  s    ''$$ZZr#   c                (    V P                  R WW44      # r  r  r]  s   &&&&&r!   #_handle_simple_method_float___mod__8OptimizeBuiltinCalls._handle_simple_method_float___mod__  s    ''TT]]r#   c                (    V P                  R WW44      # r  r  r]  s   &&&&&r!   "_handle_simple_method_float___eq__7OptimizeBuiltinCalls._handle_simple_method_float___eq__  r  r#   c                (    V P                  R WW44      # r  r  r]  s   &&&&&r!   "_handle_simple_method_float___ne__7OptimizeBuiltinCalls._handle_simple_method_float___ne__  r  r#   c                T   \        VRR4      '       d   V# \        V4      ^8w  d   V# VP                  P                  '       d   \        P
                  pM8VP                  \        P                  J d   VR9   d   \        P                  pMV# \        WWd^ ,          V^,          4      pV'       g   V# Vw  rr\        V Uu. uF  qP                  P                  NK  	  up4      '       g   Q h\        V4      V
,           pV P                  W#VV P                  W3,          RVR,          P                  4       ,          WTRRV	R7
      pVP                  P                  '       dB   VP                  '       g0   \        P                  ! WP                  4       VP                  4      pV# u upi )	I
Optimise math operators for (likely) float or small integer operations.
special_bool_cmp_functionNz__%s__:Nr  NTF)rD  with_none_checkr  r  r  )r  rP   rH   r   r	   r  r  optimise_numeric_binopr  r@   r  Pyx_BinopInt_func_typeslowerr   r  r   )r`   r   r(   r
  r   r  ret_typer5  
func_cnamer  
extra_argsnum_typer'   r  s   &&&&&&        r!   r  (OptimizeBuiltinCalls._optimise_num_binop  sc    44d;;Kt9>K99   !00HYY*000X5M!--HK'q'4PQ7SK9?6
*D9DSHH((D9::::DzJ&00((()=>x|))++-> !% 1 '	 99   )=)=)=!44Y@P@P@RTXT]T]^I :s    F%ucharc                0   V'       g   \        V4      ^8w  d   V# V^ ,          p\        V\        P                  4      '       d'   VP                  P
                  P                  '       g   V# VP                  pVP                  p\        P                  ! RR\        VR7      R7      pRVP                  4       ,          p	V P                  WWP                  WtV.VR7      p
VP
                  P                  '       d   V
P                  V P                   4      p
V
# )r   py_unicode_predicater  )r  r  z__Pyx_Py_UNICODE_%sr  )rP   r&   r   r  r'   rH   r  r7   r   r   r   upperr  #PyUnicode_uchar_predicate_func_typer   r  r   )r`   r(   r
  r   r  ustringr-  r  r  r  	func_calls   &&&&&      r!   _inject_unicode_predicate.OptimizeBuiltinCalls._inject_unicode_predicate  s    D	QKq''9#?#?@@;;##333K(()55"O[1
 .0A0A0CC00CCUG'	 1 )	
 99   !44T5E5EFIr#   r  keependsc           	         \        V4      R9  d   V P                  RWR4       V# V P                  W^R4       V P                  WRV P                  RWC4      # )zVReplace unicode.splitlines(...) by a direct call to the
corresponding C-API function.
zunicode.splitlinesz1 or 2FPyUnicode_Splitlines
splitlinesr  )rP   r  _inject_bint_default_argumentr  PyUnicode_Splitlines_func_typer]  s   &&&&&r!   (_handle_simple_method_unicode_splitlines=OptimizeBuiltinCalls._handle_simple_method_unicode_splitlines  sa     t9E!''(<d(SK**4q%@++"D$G$G+3 	3r#   sepmaxsplitc           	     r   \        V4      R9  d   V P                  RWR4       V# \        V4      ^8  d1   VP                  \        P                  ! VP
                  4      4       MV P                  V^4       V P                  W^\        P                  R4       V P                  WRV P                  RWC4      # )zQReplace unicode.split(...) by a direct call to the
corresponding C-API function.
zunicode.split1-3-1PyUnicode_Splitsplit)r   r>   r  )rP   r  rR   r   r  r   _inject_null_for_none_inject_int_default_argumentr	   r@  r  PyUnicode_Split_func_typer]  s   &&&&&r!   #_handle_simple_method_unicode_split8OptimizeBuiltinCalls._handle_simple_method_unicode_split-  s     t9G#''UKKt9q=KK	**48845&&tQ/)):77	? ++t==&. 	.r#   seqc           	     2   \        V4      ^8w  d   V P                  RWR4       V# \        V^,          \        P                  4      '       d   V^,          pVP
                  p\        V4      pV'       d   \        P                  ! VP                  VR\        P                  R7      pV FI  w  r\        P                  ! V	P                  V	VP                  R7      p\        P                  ! WZV4       KK  	  W^&   V P                  WRV P                   RWC4      # )zN
unicode.join() builds a list first => see if we can do this more efficiently
zunicode.join2r@   r  r  PyUnicode_Joinr  )rP   r  r&   r   r  r  r   r  r   r
   r&  r  r   r   r  r  PyUnicode_Join_func_type)r`   r(   r
  r   r  r  r]  r   inlined_genexprr   r  r  s   &&&&&       r!   "_handle_simple_method_unicode_join7OptimizeBuiltinCalls._handle_simple_method_unicode_joinF  s     t9>''CHKd1gy@@AA GM%**I5i@"+"J"JHHmv'.'8'8#: :J5$"+"C"C(,,-.55#7K
 44]U`a :J *Q++d;;%- 	-r#   	substringri  end	directionc           
     6    V P                  WW4R R\        ^4      # )r  endswith_inject_tailmatchunicode_tailmatch_utility_coder]  s   &&&&&r!   &_handle_simple_method_unicode_endswith;OptimizeBuiltinCalls._handle_simple_method_unicode_endswithp  s#    %%DUJ*B0 	0r#   c           
     6    V P                  WW4R R\        R4      # )r  
startswithrM   rX  r]  s   &&&&&r!   (_handle_simple_method_unicode_startswith=OptimizeBuiltinCalls._handle_simple_method_unicode_startswithu  s#    %%DUL*B0 	0r#   c	                (   \        V4      R
9  d   V P                  V RV 2WR4       V# V P                  W^\        P                  R4       V P                  W^\        P                  R4       VP                  \        P                  P                  VP                  V4      4       VR8X  d   Rp	MRVP                  4        R2p	V P                  WWP                  WdVVR	7      p
V
P                  \        P                  V P!                  4       4      # )zpReplace unicode.startswith(...) and unicode.endswith(...)
by a direct call to the corresponding C-API function.
r  2-40PY_SSIZE_T_MAXr  __Pyx_PyUnicode_Tailmatch__Pyx_Py
_Tailmatchr  r>   r     )rP   r  rG  r	   r@  rR   r   r   r   r   
capitalizer  PyString_Tailmatch_func_typer   r
   rq  r   )r`   r(   r
  r   r  r  r  r  rU  r{  method_calls   &&&&&&&&&  r!   rY  &OptimizeBuiltinCalls._inject_tailmatchz  s   
 t9G#''9+Q{m(DdRWXK)):77	>)):779I	KI%%--dhh	BC3I"9#7#7#9":*EI2288D'	 3 )
 $$W%6%68H8H8JKKr#   c                *    V P                  WW4R ^4      # )find_inject_unicode_findr]  s   &&&&&r!   "_handle_simple_method_unicode_find7OptimizeBuiltinCalls._handle_simple_method_unicode_find  s     ((DVRA 	Ar#   c                *    V P                  WW4R R4      # )rfindrM   rp  r]  s   &&&&&r!   #_handle_simple_method_unicode_rfind8OptimizeBuiltinCalls._handle_simple_method_unicode_rfind  s     ((DWbB 	Br#   c           	        \        V4      R9  d   V P                  RV,          WR4       V# V P                  W^\        P                  R4       V P                  W^\        P                  R4       VP                  \        P                  P                  VP                  V4      4       V P                  WRV P                  WTV4      pVP                  V P                  4       4      # )zgReplace unicode.find(...) and unicode.rfind(...) by a
direct call to the corresponding C-API function.
z
unicode.%srb  rc  rd  PyUnicode_Findrh  )rP   r  rG  r	   r@  rR   r   r   r   r   r  PyUnicode_Find_func_typer  r   )r`   r(   r
  r   r  r  rU  rl  s   &&&&&&& r!   rq  )OptimizeBuiltinCalls._inject_unicode_find  s    
 t9G#''{(BDPUVK)):77	>)):779I	KI%%--dhh	BC22,d.K.KD2 --d.>.>.@AAr#   c           	     P   \        V4      R9  d   V P                  RWR4       V# V P                  W^\        P                  R4       V P                  W^\        P                  R4       V P                  WRV P                  RWC4      pVP                  V P                  4       4      # )zQReplace unicode.count(...) by a direct call to the
corresponding C-API function.
zunicode.countrb  rc  rd  PyUnicode_Countcountrh  )	rP   r  rG  r	   r@  r  PyUnicode_Count_func_typer  r   )r`   r(   r
  r   r  rl  s   &&&&& r!   #_handle_simple_method_unicode_count8OptimizeBuiltinCalls._handle_simple_method_unicode_count  s     t9G#''UKK)):77	>)):779I	K 22-t/M/M&. --d.>.>.@AAr#   replstrmaxcountc           	         \        V4      R9  d   V P                  RWR4       V# V P                  W^\        P                  R4       V P                  WRV P                  RWC4      # )zSReplace unicode.replace(...) by a direct call to the
corresponding C-API function.
zunicode.replacez3-4rC  PyUnicode_Replacer_  )r  ri  )rP   r  rG  r	   r@  r  PyUnicode_Replace_func_typer]  s   &&&&&r!   %_handle_simple_method_unicode_replace:OptimizeBuiltinCalls._handle_simple_method_unicode_replace  sn     t9E!''(94uMK)):77	? ++/1Q1Q(0 	0r#   r.  errorsc                X   \        V4      ^8  g   \        V4      ^8  d   V P                  RWR4       V# V^ ,          pV P                  VP                  V4      pVf   V# Vw  rxrVP	                  4       '       dc    VP
                  P                  Wy4      p\        Y;'       g    R4      p\        P                  ! VP                  V\        P                  R7      # \        V4      ^8X  dB   \        P                  ! VP                  4      pV P                  WRV P                  RWEW.4      # V'       dM   V	R8X  dF   V P                  V4      pVe1   RV9  d*   R	V,          pV P                  WVV P                   RWE.4      # V P                  WRV P                  RVWXV
.4      #     L; i)
zOReplace unicode.encode(...) by a direct C-API call to the
corresponding codec.
zunicode.encoderB  zUTF-8r  PyUnicode_AsEncodedStringr  strictr9  zPyUnicode_As%sString)rP   r  _unpack_encoding_and_error_moder   r  r;   r  r   r   r  r
   r  r  r  #PyUnicode_AsEncodedString_func_type_find_special_codec_namePyUnicode_AsXyzString_func_type)r`   r(   r
  r   r  string_node
parametersr.  encoding_nodeerror_handlingerror_handling_noder   	null_node
codec_nameencode_functions   &&&&&          r!   $_handle_simple_method_unicode_encode9OptimizeBuiltinCalls._handle_simple_method_unicode_encode  s    t9q=CIM''(8$eLK1g99$((DI
KGQD**,,b#33::8T
 &e-@-@A **;??%gN`N`aat9>!**4884I// ;88+9-PR R
 (266x@J%#Z*?"8:"E33O88/@ @
 ++744')<=	? 	?1s   =F% %F)stringr  rk  decode_funcc                   ^\        V4      u;8:  d   ^8:  g   M V P                  RWR4       V# V^ ,          pV P                  VP                  V4      pVf   V# Vw  rxrVP	                  4       '       dH    VP
                  P                  Wy4      p\        VP                  \        V4      VP
                  R7      # R;r\        V\        P                  4      '       dA   TpVP                  pVP                   VP"                  rV'       d   VP
                  ^ 8X  d   Rp\        V\        P$                  4      '       d   VP&                  pVP(                  pV\*        P,                  \*        P.                  39   d?   V'       d!   VP1                  RRVP2                  .R7      pM<VP1                  RR	R.R
7      pM&VP4                  '       g   VP6                  '       g   V# V'       g,   \        P8                  P;                  VP                  ^ 4      pMJVP(                  P<                  '       g/   VP?                  \@        PB                  V PE                  4       4      pV'       dK   VP(                  P<                  '       g/   VP?                  \@        PB                  V PE                  4       4      pRpVe   V PG                  V4      pVey   VR"9   d   RVPI                  RR4      ,          pM	RV,          p\        PJ                  ! VP                  V PL                  VR7      p\        PN                  ! VP                  4      pM \        PN                  ! VP                  4      p. pVP4                  '       d   V'       gj   VPP                  '       g(   \R        PT                  ! V4      pVPW                  V4       \        PX                  ! VP                  RV PZ                  V.RR7      pV P\                  pRpEMVP6                  '       EdZ   V'       g2   \        P8                  ! VP                  R\        P^                  R7      pV P`                  f   \@        Pb                  ! \*        Pd                  \@        Pf                  ! RVR4      \@        Pf                  ! R\@        PB                  R4      \@        Pf                  ! R\@        PB                  R4      \@        Pf                  ! R\@        Ph                  R4      \@        Pf                  ! R\@        Ph                  R4      \@        Pf                  ! RV PL                  R4      .4      V n0        V P`                  pRVP2                   2pM^V'       g2   \        P8                  ! VP                  R\        P^                  R7      pV Pj                  pV\*        P,                  J d   RpMRp\        PX                  ! VP                  RV,          VW\WV
V.VPl                  \n        Pp                  ! VR 4      R!7      pVRRR#1,           F  p\R        Pr                  ! VV4      pK  	  V#   \        \        \        3 d     ELi ; i)$zsReplace char*.decode() by a direct C-API call to the
corresponding codec, possibly resolving a slice on the char*.
zbytes.decoderB  Nr   r  @descriptor '%s' requires a '%s' object but received a 'NoneType'decoder  r  r  r  z__Pyx_PyUnicode_Decode%sr9  r  zPyUnicode_Decode%s)rH   rB  r  Trg  decode_c_stringrd  r,  r  ri  rk  r.  r  r  decode_cpp_decode_bytesdecode_bytearrayz__Pyx_%sr  r  )UTF16UTF-16LEUTF-16BErM   ):rP   r  r  r   r  r;   r  r   r   rC  
ValueErrorUnicodeDecodeErrorr&   r   ro  r   ri  rk  r  r'   rH   r
   r  r  r'  r    r  is_cpp_stringr   rA  r  r   r	   r@  r   r  r_  r  !PyUnicode_DecodeXyz_func_ptr_typer  r   r   r=  rR   rl  r  _decode_c_string_func_typer   _decode_cpp_string_func_typer  r   r  r  _decode_bytes_func_typer-  r   r   r  )r`   r(   r
  r   r  r  r  r.  r  r  r  r;   ri  rk  r  string_typer  codec_cnamedecode_functionr   helper_func_typer  r  s   &&&&&                  r!   "_handle_simple_method_bytes_decode7OptimizeBuiltinCalls._handle_simple_method_bytes_decodeI  s0    SY#!#''EJK 1g99$((DI
KGQD**,,	"-"="="D"DX"^ #OO'8 + ; ;  k9#;#;<<$J$//K$**JOO4E11Q6k9#?#?@@%//K!&&7--w/E/EFF );;V!);+;+; < < > *;;@0!)
 < , &&&{/H/H/HK%%..txx;E"""OOJ$@$@$BRBRBTUE		(((>>*">">@P@P@RSD 
66x@J!>>8:;M;McSU;VV2Z?'88tEE[ZO%..txx8M'00:O    "***"+"6"6{"CKLL- 33OO%94;Z;Z% 
  $>> 1&&& ((9I9B9Q9QS0084>4H4H(("//+tL"//9U9UW[\"//
8T8TVZ["//
J<\<\^bc"//*:Z:Z\`a"//t?e?egkl+51  $@@"-k.>.>-? @  ((9I9B9Q9QS#;;g000$2!$6!++HHj#446Fd;NP_`LL$001BOT	
 $B$KKD11$=D  _ #J0BC s   7X> >YYc                *    \         P                  ! V4      pT P                   FT  w  r4YB8X  g   K  RT9   d?   RP	                  TP                  R4       Uu. uF  pTP                  4       NK  	  up4      pTu # 	  R #   \         d     R # i ; iu upi )NrU  r  )r   
getencoderLookupError_special_codecsr  rE  rj  )r`   r.  requested_codecr    codecra  s   &&    r!   r  -OptimizeBuiltinCalls._find_special_codec_name  s    	$//9O  //KD'$;77-1ZZ_$>-< %&LLN-<$> ?D 0   		
$>s   A> B
>BBc                   \         P                  ! V4      p\        V4      ^8  d"   V P                  V^,          4      w  rEVf   R# MRpTp\        V4      ^8X  d+   V P                  V^,          4      w  rgVf   R# VR8X  d   TpMRpTpWEWg3# )r>   Nr  )r   r  rP   _unpack_string_and_cstring_node)r`   r   r   r  r.  r  r  r  s   &&&     r!   r  4OptimizeBuiltinCalls._unpack_encoding_and_error_mode  s    &&s+	t9>&*&J&J4PQ7&S#H$ % H%Mt9>262V2VW[\]W^2_/N"*)&/#%N"+MMr#   c                   \        V\        P                  4      '       d   VP                  p\        V\        P                  4      '       dO   VP
                  p\        P                  ! VP                  VP                  4       \        P                  R 7      pW!3# \        V\        P                  4      '       dZ   VP
                  P                  R4      p\        P                  ! VP                  VP
                  \        P                  R 7      pW!3# VP                  \        P                  J d4   RpVP                  \        P                  V P!                  4       4      pW!3# VP                  P"                  '       d   RpW!3# R;r!W!3# )r  z
ISO-8859-1N)r&   r   r  r'   r   r   r  r   as_utf8_stringr	   r  r  rH   r
   r  r   r   r  )r`   r(   r.  s   && r!   r  4OptimizeBuiltinCalls._unpack_string_and_cstring_node  s=   dI889988DdI1122zzH&& 7 7 9
@`@`bD ~ i1122zz((6H&&

1Q1QSD ~ YY',,,H>>*"B"BDDTDTDVWD
 ~	 YY   H ~ #"H~r#   c           
     6    V P                  WW4R R\        ^4      # )r  rW  rY  bytes_tailmatch_utility_coder]  s   &&&&&r!   $_handle_simple_method_bytes_endswith9OptimizeBuiltinCalls._handle_simple_method_bytes_endswith  s#    %%DWj(". 	.r#   c           
     6    V P                  WW4R R\        R4      # )r  r^  rM   r  r]  s   &&&&&r!   &_handle_simple_method_bytes_startswith;OptimizeBuiltinCalls._handle_simple_method_bytes_startswith  s#    %%DWl(". 	.r#   c                    \        V4      pV'       d&   V'       d   V P                  V^ ,          W&V4      V^ &   V	f   VP                  p	\        P                  ! VP
                  W4VV	VV
VP                  R7      # )r   )r   r-  r  rD  r  )r@   ri  r-  r   rl  r   r  )r`   r(   r
  r    r  r  r  r   r  r-  rD  r#  s   &&&&&&&&&&&&r!   r  ,OptimizeBuiltinCalls._substitute_method_call  sn    
 Dzt))$q'8PYZDG?llG++HHd'-!00 	r#   c                    VP                   '       d   V# V'       d+   VP                  R WAP                  P                  .R7      pV# TP                  RP	                  \        V4      ^8:  d   RMR4      RV.R7      pV# )r  r  r  r  r  r  r  )r  r'  rH   r    rA   rP   )r`   self_argr
  r  r  s   &&&&&r!   ri  #OptimizeBuiltinCalls._wrap_self_arg1  s    O11R&(:(:; 2 =H 	  11;BBCPYN^`L`5fhi,&K 2 )H r#   c           	     l   \        V4      V8:  d   R # W,          pVP                  4       '       g   R # VP                  '       d!   \        P                  ! VP
                  4      ML\        P                  ! VP
                  RV P                  VP                  V P                  4       4      .^ R7      W&   R # )N__Pyx_NoneAsNullrg  )
rP   r  rG   r   r  r   rl  obj_to_obj_func_typer  r   )r`   r   r4  r'   s   &&& r!   rF  *OptimizeBuiltinCalls._inject_null_for_noneD  s    t9k  58[[[i((1iFbFbGG'%%&&t'7'7'9:;	G
r#   c                   \        V4      V8  g   Q h\        V4      V8X  g   W#,          P                  '       d   \        V\        4      '       g/   \	        V4      P                  R 4      P                  4       '       d5   \        P                  P                  VP                  \        V4      4      pM,\        P                  ! VP                  \	        V4      VR7      pVP                  V4       R# W#,          P                  W@P                  4       4      p\        V\        P                  4      '       d   \	        V4      Vn        WrV&   R# )z+-r  N)rP   rG   r&   r  r  lstrip	isdecimalr   r   r   r   rR   r   r   r}  special_none_cvalue)r`   r(   r   	arg_indexrH   default_valueint_noder'   s   &&&&&&  r!   rG  1OptimizeBuiltinCalls._inject_int_default_argumentS  s     4yI%%%t9	!T_%<%<%<---]1C1J1J41P1Z1Z1\1\$,,44TXXs=?QR$,,TXXS=OVZ[KK!/++D2B2B2DEC#y==>>*-m*<'!Or#   c                   \        V4      V8  g   Q h\        V4      V8X  d=   VP                  \        P                  ! VP                  \        V4      R 7      4       R# W#,          P                  V P                  4       4      W#&   R# )r   N)rP   rR   r   r   r   r  rr  r   )r`   r(   r   r  r  s   &&&&&r!   r;  2OptimizeBuiltinCalls._inject_bint_default_argumentd  s_    4yI%%%t9	!KK	**4884;NOP"o??@P@P@RSDOr#   )r  rM   g      r%   r1   rg  )UTF8r  r  r  Latin1ASCIIunicode_escaperaw_unicode_escaperl   )rv   rw   rx   ry   rz   rf  ri  ri   rt  r	   r  r  r  r~  r  r  c_float_typer  c_longdouble_typer  r  r  r   r  r  r  r  r  r  r  r
   r   r  r  _handle_simple_function_strr  r   r  rL  r&  r  r>  r%  r  r  r   r  rA  r   r  r:  r  r  r  r  r  r  r  memoryview_typer   r  r  r  r@  r  r  c_const_py_unicode_ptr_typer  r  r  r  rQ  r  r  r  rQ   r#  r$  r  r4  r;  r  rM  rL  rU  rX  rj  r\  r^  rn  rw  rz  r|  r  r  r  r  r  r  r  r  r  r  r  rd  r  r  r  r   r&  r  r  r  r  r  r  r  r  r  r  r  r  r  r  !_handle_simple_method_int___add__!_handle_simple_method_int___sub__!_handle_simple_method_int___mul__ _handle_simple_method_int___eq__ _handle_simple_method_int___ne__!_handle_simple_method_int___and__ _handle_simple_method_int___or__!_handle_simple_method_int___xor__$_handle_simple_method_int___rshift__$_handle_simple_method_int___lshift__!_handle_simple_method_int___mod__&_handle_simple_method_int___floordiv__%_handle_simple_method_int___truediv__r  r  r  r  r  r  r  r  r  r2  r5  %_handle_simple_method_unicode_isalnum%_handle_simple_method_unicode_isalpha'_handle_simple_method_unicode_isdecimal%_handle_simple_method_unicode_isdigit%_handle_simple_method_unicode_islower'_handle_simple_method_unicode_isnumeric%_handle_simple_method_unicode_isspace%_handle_simple_method_unicode_istitle%_handle_simple_method_unicode_isupper)_handle_simple_method_unicode_isprintable$PyUnicode_uchar_conversion_func_typer<  r=  rH  rI  rO  rQ  rk  r[  r_  rY  rz  rr  rv  rq  r  r  r  r  r  r  _special_encodingsr   r  r  r  rK  r  r  r  r  r  &_handle_simple_method_bytearray_decoder  r  r  r  r  r   rl  rD  r  ri  r  rF  rG  r;  r|   r}   )r  ctyper(  r    r   s   0000@r!   rc  rc  x  sK     	 
  *33!!##C)B)BDI$ 
. N &22J4L4LjNjNjk
 lJ	 	J((''z4@ 	 l3j &//##E:+D+DdK 
 	 )22  ##E:+D+DdK#
 	
3>$(BX5  ",!5!5##E:+D+DdK"
. #B
 '00##FG,=,=tD
 !+ 4 4		 	 z'@'@$	GH!J
"  *33##FG,=,=tD 
U$ %..##D**C*CTJ

 < !+ 4 4##D**C*CTJ!
!
!  #-"6"6  ##E:+D+DdK# )# 4l (11##C)B)BDI
 #-"6"6##GZ-E-EtL#
,B  )3(<(<##GZ-F-FM")%
 )3(<(<##GW-C-CTJ")%
4 ",!5!5$$##GZ-M-MtT'
 	" '1&:&:$$##Iz/U/UW[\'
 	'# )22$$##E:+D+DdK'
 	 	!=!9!=!8!9!7!7	! 
c  442h $--##Hj.G.GN
	C )22##E:+D+DdK!
Rh$ &//!!##Fj.G.GN##Fg.@.@$G$ #-"6"6!!##Fj.G.GN##Fg.@.@$G##Hg.?.?F$
#GR !+ 4 4$$##FJ,E,EtL##FJ,E,EtL' !
 =~ $.#7#7$$##K1J1JDQ##GZ-B-BDI' $  *4)=)=$$##K1J1JDQ##GZ-F-FM' *&B (11!!##FJ,E,EtL$
 #-"6"6!!##FJ,E,EtL##J
0I0I4P##Iz/K/KTR##K1F1FM	$
 #C@D (11$$##E:+D+DdK' 	T $.#7#7!!##FJ,E,EtL##E:+D+DdK##Iz/H/H$O$$ C  '1&:&:!!##FJ,E,EtL##E:+D+DdK##Iz/H/H$O##NJ4I4I4P	$'#S  &//!!##FJ,E,EtL##E:+D+DdK##Iz/H/H$O$ #-"6"6##FJ,E,EtL##E:+D+DdK##Iz/H/H$O 
 '11AA#<F !,,j.F.FG
 HE#22J4J4JKH 
://''z/H/H$O''z/H/H$O''t<''	:3I3I4P''9O9OQUV (0';';';tAYAY[ 	[ L 	 H
X]]WWXWX[[\^]Y )M%(L%(L%'J$'J$(L%'J$(L%+R(+R((L%-V*,T)[X]_[^WW#N +5*>*>##GZ-F-FM!+'
0 /H).G).G+.G).G).G+.G).G).G)0I-+5+?+?!!##GZ-F-FM$,(0 &0%9%9##E7+?+?F##J
0F0FM&"3 !+ 4 4##E7+?+?F##E:+D+DdK##J
0L0LdS!
.&  *33##E7+?+?F##E:+D+DdK -@ $.#7#7##E:+D+DdK##K1J1JDQ##GZ-I-I4P##E:+G+GN##K1F1FM! $ 0
0
L4  *33$$##E7+?+?F##K1J1JDQ##GZ-I-I4P##E:+G+GN##K1F1FM'  ABB& !+ 4 4$$##E7+?+?F##K1J1JDQ##GZ-I-I4P##E:+G+GN	' !B" #-"6"6##E7+?+?F##K1J1JDQ##Iz/H/H$O##J
0L0LdS	#0 +5*>*>##E7+?+?F##J
0P0PRVW##Hj.N.NPTU+' '1&:&:##E7+?+?F'#
B %79$6D v0067$69O/?b )3(;(;J<P<P##Hj.N.NPTU##FJ,H,H$O##Hj.N.NPTU
= )% ",!5!5##Hj.N.NPTU##GZ-I-I4P##FJ,H,H$O##J
0P0PRVW##Hj.N.NPTU##M3TVZ[
" )22##Hj.G.GN##GZ-I-I4P##FJ,H,H$O##J
0P0PRVW##Hj.N.NPTU##M3TVZ[
 $( AF .P*N.(.
.

 DF-14090L0L0\0\04	& &//!!##E:+D+DdK$


""T Tm;N"
F9s   =8AO$/DAO)D1#AO/rc  c           
     >   \         P                  \         P                  3p\        WE4      '       dD   VP                  \
        P                  Jd!   VP                  \        P                  Jd   R# TpRpMV\        W54      '       dD   VP                  \
        P                  Jd!   VP                  \        P                  Jd   R# TpRpMR# VP                  4       '       g   R# \        V\         P                  4      pV'       d   \
        P                  M\
        P                  p	V'       d   V R9  d   R# M%V R8X  d   R# \        VP                  4      R8  d   R# V R9   d   VP                  ^ 8X  d   R# . p
T
P                  V'       d   \         P                  M\         P                  ! VP                  VP                   VP                  V	R7      4       \        V\         P"                  4      '       d   VP$                  MRpV
P                  \         P&                  ! VP                  VR7      4       V'       g   V R9  dr   VR8H  ;'       d4    \        V\         P(                  4      '       d   VP*                  '       * MRpV
P                  \         P&                  ! VP                  VR7      4       \,        P.                  ! V'       d   RM
V R9   d   R	MR
R\1        WVR7      R7      pRV'       d   RMR: RVP2                  '       d   RMR: V : V: 2pWW3# )r!  NObjCCObjr  ry  Fr   PyFloatBinopPyLongComparePyLongBinopr   )oporderr(  r0  rf  FloatLongrU  r  Bool)r  r  r  r  r  r  r  r   )r  r  r  r  r$  )r   r   r  r&   rH   r	   r  r
   r  r  r  r  r  r;   rR   r   r   NumBinopNoder;  r   r  	cdivisionr   r   r   r   )r   r(   r(  arg0arg1	num_nodesnumval	arg_orderr  r+  r*  r;  zerodivision_checkr  r)  s   &&&&&          r!   r%  r%  l  sj    ""I$7$78I$""99J555$))7K[K[:[		D	$	$99J555$))7K[K[:[	%%'' &)"5"56H+3z''9O9OH__ `	X		V##	$u	,GG1$Jhy**I<M<MM

&,,8N8N  )y/E/EFFdllEGi((AB8</&&0 R R",T93D3D"E"E5 	),,TXX=OPQ%11"8|;SYfHEGL '""".	J Z99r#   unicode_tailmatchr  bytes_tailmatchc                     a a ] tR tRt oRtR)V 3R lltR t]P                  ]P                  ]P                  ]P                  .tR tR tR tR tR	R
R
R	RRRR/P"                  tR tR tR tR tR tR tR tR tR tR tRtR tR tR t R t!R t"R t#R t$R t%R  t&R! t'R" t(R# t)R$ t*R% t+R& t,R' t-].P^                  P`                  t1R(t2Vt3V ;t4# )*ConstantFoldingi  a  Calculate the result of constant expressions to store it in
``expr_node.constant_result``, and replace trivial cases by their
constant result.

General rules:

- We calculate float constants to make them available to the
  compiler, but we do not aggregate them into a single literal
  node to prevent any loss of precision.

- We recursively calculate constants from non-literal nodes to
  make them available to the compiler, but we only aggregate
  literal nodes at each step.  Non-literal nodes are never merged
  into a single node.
c                0   < \         SV `  4        Wn        R# )zo
The reevaluate argument specifies whether constant values that were
previously computed should be recomputed.
N)superr]   
reevaluate)r`   r  	__class__s   &&r!   r]   ConstantFolding.__init__  s    
 	$r#   c                P   V P                   '       g!   VP                  \        P                  Jd   R # \        P                  pW!n        V P                  V4      pVP                  4        FJ  p\        V4      \        J d!   V F  p\        VRV4      VJ g   K    R # 	  K6  \        VRV4      VJ g   KI   R # 	   VP                  4        R #   \        \        \        \        \        \         3 d     R # \"         d)    ^ R Ip^ R IpTP)                  TP*                  R7        R # i ; i)Nr;   )file)r  r;   r   constant_value_not_setr   rc   r   rH   r@   r  calculate_constant_resultr  	TypeErrorr   
IndexErrorrC  ArithmeticError	Exception	tracebacksys	print_excstdout)r`   r(   r   childrenchild_resultchildr'  r(  s   &&      r!   _calculate_const ConstantFolding._calculate_const  s    $$I,L,LL #11- %%d+$OO-LL!T))Eu&7HNZ * '8.I^[ .
	1**, Ix^_] 	 	1!SZZ0	1s   9C %D%3D%<%D%$D%c           
          V P                   \        \        V P                   P                  \        \        V4      4      4      ,          #   \
         d     R # i ; ir%   )NODE_TYPE_ORDERmaxr   r4  rH   r  )r`   nodess   &*r!   _widest_node_class"ConstantFolding._widest_node_class  sP    	''C,,22Ce4DEFH H 		s   AA
 
AAc                X    \         P                  ! VP                  \        V4      R 7      # )r   )r   r   r   r  )r`   r(   r   s   &&&r!   
_bool_nodeConstantFolding._bool_node  s    !!$(($u+>>r#   c                (    V P                  V4       V# r%   )r.  rd   s   &&r!   visit_ExprNodeConstantFolding.visit_ExprNode  s    d#r#   c                   V P                  V4       VP                  4       '       g%   VP                  R 8X  d   V P                  V4      # V# VP                  P
                  '       g   V# VP                  R 8X  d   V P                  WP                  4      # \        VP                  \        P                  4      '       d>   \        P                  P                  VP                  \        VP                  4      4      # VP                  R8X  d   V P                  V4      # VP                  R8X  d   V P!                  V4      # V# )!r:  r9  )r.  r  r   _handle_NotNoder   r  r7  r;   r&   r   r   r   r   r   r  _handle_UnaryPlusNode_handle_UnaryMinusNoderd   s   &&r!   visit_UnopNodeConstantFolding.visit_UnopNode  s    d#''))}}#++D11K||&&&K==C??4)=)=>>i&8&899$$,,TXXs4;O;O7PQQ]]c!--d33]]c!..t44r#   r{  r   r'  is_notc                    VP                   p\        V\        P                  4      '       dQ   V P	                  VP
                  4      pV'       d.   \        P                  ! V4      pW1n        V P                  V4      pV# r%   )r   r&   r   r   _negate_operatorr   r   r   )r`   r(   r   r   s   &&  r!   r>  ConstantFolding._handle_NotNode  s_    ,,gy7788,,W-=-=>Hyy) (006r#   c                   R  pVP                   P                  p\        VP                   \        P                  4      '       dI   \        P                  ! VP
                  V! VP                   P                  4      VVP                  R7      # VP                  '       d   VP                  '       g=   \        VP                   \        P                  4      '       dp   VP                  '       d^   \        P                  ! VP
                  V! VP                   P                  4      VVP                   P                  VP                  R7      # V# )c                 \    V P                  R 4      '       d   V R,          p V # R V ,           p V # )r9  r)  )r^  r   s   &r!   _negate7ConstantFolding._handle_UnaryMinusNode.<locals>._negate#  s3    $$b	 L eLr#   )r   rH   r;   )r   rH   longnessr;   )r   rH   r&   r   r  r   r   r;   r  r  r   r   rK  )r`   r(   rI  	node_types   &&  r!   r@  &ConstantFolding._handle_UnaryMinusNode"  s    	 LL%%	dllI$7$788&&txxwt||?Q?Q7R,57;7K7KM M 	 0 0 04<<):):;;	@U@U@U$$TXXWT\\=O=O5P*3.2ll.C.C595I5IK K r#   c                    VP                   P                  4       '       d2   VP                  VP                   P                  8X  d   VP                   # V# r%   )r   r  r;   rd   s   &&r!   r?  %ConstantFolding._handle_UnaryPlusNode8  s<    LL,,..((DLL,H,HH<<r#   c                D   V P                  V4       VP                  P                  4       '       g   V# VP                  P                  '       d*   VP                  R 8X  d   VP
                  # VP                  # VP                  R 8X  d   VP                  # VP
                  # )r3  )r.  rE   r  r;   r   rF   rd   s   &&r!   rd  #ConstantFolding.visit_BoolBinopNode>  sx    d#}}0022K==(((}}%}}$}}$}}%}}$}}$r#   c                   V P                  V4       VP                  \        P                  J d   V# \	        VP                  \
        4      '       d   V# VP                  VP                  r2VP                  '       d   VP                  '       g   V#  VP                  VP                  rTVe   Vf   V#  TP                  '       d*   TP                  '       d   \        P                  ! YE4      pM\        P                  pT P                  Y#4      pTf   T# T\        P                   J d#   TP"                  R9   d   \        P$                  pM5T\        P&                  J d"   TP"                  R9   d   \        P$                  pT\        P$                  J Ed2   \)        TRR4      ;'       d    \)        TRR4      pRR \+        \-        \)        TRR4      4      \-        \)        TRR4      4      4       p	\/        \1        TP                  4      4      p
\2        P4                  ! T
4      p
\        P$                  ! TP6                  YT
\1        TP                  4      R7      pTP8                  '       g   TP                  P8                  '       d   \        P                  Tn	        T# \        P                  ! YkP                  4      Tn	         T# T\        P                   J d0   \        P                   ! TP6                  TP                  TR7      pT# T! TP6                  T\;        TP                  4      TP                  R	7      pT#   \         d    Tu # i ; i)
Nz+-//<<%**>>z+-//<<%**>>&|^unsignedr  LLrK  )r   rS  rK  r   r;   r  )r   rH   r   r;   )r.  r;   r   r   r&   r  rE   rF   r  rH   rC  r  r	   widest_numeric_typer  r4  r   r   r   r/  r  r2  rP   hexr  r   strip_py2_long_suffixr   r   r  )r`   r(   rE   rF   type1type2widest_typetarget_classrS  rK  r   r   s   &&          r!   visit_BinopNodeConstantFolding.visit_BinopNodeM  s   d#9#;#;;Kd**E22K!]]DMM("""(*=*=*=K	#==(--5} !.
  0 0 0$88FK$33K..xBKY///DMM]4R$,,LY///DMMEU4U$,,L9,,,xR8 9 9xR8  ISWXz2%F!G!$WXz2%F!GI JHD0012E//6E ((TXX2:/49<T=Q=Q9RTH &&&(--*C*C*C * 9 9  !+ > >{MM Z  Y/// ))$(($:N:NU`aH
  ${*-d.B.B*C484H4HJH S  	K	s    L? ?MMc                	   V P                  V4       \        VP                  \        4      '       d@   \        P
                  ! VP                  P                  \        VP                  4      R 7      # VP                  VP                  r2\        V\        P                  4      '       Ed.   \        V\        P                  4      '       dL   VP                  P                  VP                  4       \        P                  Vn        V P                  V4      # \        VP                  \        4      '       d   VP                  '       g   V# \        V\        P
                  4      '       g-   \        P
                  ! VP                  VP                  R 7      pVP                  P                  V4       \        P                  Vn        V P                  V4      # M\        V\        P                  4      '       d   \        VP                  \        4      '       d   VP                  '       g   V# \        V\        P
                  4      '       g-   \        P
                  ! VP                  VP                  R 7      pVP                  P!                  ^ V4       \        P                  Vn        V P                  V4      # VP                  \        P"                  J d   V# VP$                  '       Ed   VP$                  '       Ed   \        V\        P
                  4      '       d   \        V\        P
                  4      '       d   RpVP&                  ey   VP&                  ek   VP&                  P(                  VP&                  P(                  8X  d<   \+        VP&                  VP&                  ,           VP&                  P(                  4      p\        VP                  4      p\        P
                  ! VP                  WTR7      # \        V\        P,                  4      '       d   \        V\        P,                  4      '       d   VP.                  P(                  VP.                  P(                  8X  dW   \+        VP                  VP.                  P(                  4      p\        P,                  ! VP                  WAP                  R7      # V P1                  V4      # )r   Nr  r,  )r.  r&   r;   r  r   r   rE   r   r   rF   JoinedStrNoder   ra  r!  simplify_JoinedStrNoderR   insertr   r   r  r.  r   r  r   r\  )r`   r(   rE   rF   r  string_values   &&    r!   visit_AddNodeConstantFolding.visit_AddNode  s`   d#d**C00((!!t7K7K)LN N "]]DMM( h	 7 788(I$;$;<<&&x7+4+K+K(228<<(22C88///#O!(I,A,ABB(44 H,D,D FH&&x0+4+K+K(228<< 9 )"9"9::(22C88///#O!(I,A,ABB(44 H,D,D FH&&q(3+4+K+K(228<<9#;#;;K%%%(*D*D*D(I$9$9::z(T]TiTi?j?j"''38L8L8X++448L8L8U8UU&3$0083G3GG$0099';  -T-A-AB ,,X\\ggHi&9&9::z(T]TgTg?h?h>>**hnn.E.EE"/0D0DhnnF]F]"^K$..x||;`t`tuu##D))r#   c                   V P                  V4       VP                  P                  '       d'   V P                  WP                  VP                  4      # \        VP                  \        P                  4      '       dC   VP                  P                  '       d'   V P                  WP                  VP                  4      # VP                  P                  '       d'   V P                  WP                  VP                  4      # VP                  P                  '       d'   V P                  WP                  VP                  4      # V P                  V4      # r%   )r.  rE   r   _calculate_constant_seqrF   r&   r   r   r   _multiply_stringr\  rd   s   &&r!   visit_MulNodeConstantFolding.visit_MulNode  s    d#==000//mmT]]SSdmmY%6%677555//mmT]]SS==***((}}dmmLL]],,,((}}dmmLL##D))r#   c                   VP                   p\        V\        4      '       g   V# VP                  4       '       d!   \        VP                   \        4      '       g   V# \        VP                   4      R 8  d   V# \        V\        P                  4      '       d   \        pM\        V\        P                  4      '       dL   \        pVP                  e7   \        VP                  V,          VP                  P                  4      Vn        MQ R\        T4      ,          4       hV! VP                  V,          VP                  P                  4      Vn        VP                  Vn         V# )   zunknown string node type: %s)r;   r&   r  r  _py_string_typesrP   r   r  r   r   r   r  r.  rH   r   )r`   r(   r  multiplier_node
multiplierbuild_strings   &&&&  r!   rg   ConstantFolding._multiply_string  s   $44
*c**K((**z$:N:NP`/a/aKt##$s*Kk9#6#677(LY%:%:;;)L&&2*7++j8++44+6' M84;LLL5(
*&&( '2&7&7#r#   c                   VP                   ^8w  Ed,   VP                  '       Ed   \        VP                   \        4      '       d(   VP                   ^ 8:  d   VP                  R RVn        V# VP                  e   \        VP                   \        4      '       d   \        VP                  P                   \        4      '       dc   VP                  P                   VP                   ,          p\
        P                  P                  VP                  P                  V4      Vn        V# V P                  V4      # W2n        V# )r   NNNN)
r;   r   r&   r  rh  r   r   rA  r   r\  )r`   r(   sequence_nodefactorr   s   &&&& r!   rf  'ConstantFolding._calculate_constant_seq  s    !!Q&=+=+=+=&00#666;Q;QUV;V!&&q),0)  **6v55s;;"=#<#<#L#LcRR)55EEH^H^^E090A0A0J0J=KdKdKhKhjo0pM-   //55,2)r#   c                   V P                  V4       \        VP                  \        P                  4      '       d   \        VP
                  \        P                  4      '       dr   VP
                  P                  '       gV   V P                  VP                  P                  VP                  P                  VP
                  P                  4      pVe   V# V P                  V4      # r%   )rc   r&   rE   r   r   rF   r  rh  _build_fstringr   r   r   r\  )r`   r(   fstrings   && r!   visit_ModNodeConstantFolding.visit_ModNode  s    4 dmmY%:%:;;
4==ZcZmZm@n@n==,,,--dmm.?.?ATATVZVcVcVhVhi&"N##D))r#   z'(%(?:(?:[-0-9]+|[ ])?(?:[.][0-9]+)?)?.)c                   \        V4      p. pR p\        P                  ! V P                  V4       EF  pV'       g   K  VR8X  d3   VP	                  \
        P                  ! V\        R4      R7      4       KG  V^ ,          R8w  dX   VR,          R8X  d   \        VRVRR  R2^R7       RpVP	                  \
        P                  ! V\        V4      R7      4       K  VR,          p \        V4      p	T	P                  '       d   Rp MTR
9   d   TR,          p
RpTR9   d   RT
9   d   RpM?TR9   d0   T
RR p
TpT
P                  R4      '       d   RT
R,          ,           p
M	TR8X  d   RpT
P                  R4      '       d   RT
R,          ,           p
TP	                  \
        P                  ! T	P                  T	TT
'       d"   \
        P                  ! T\        T
4      R7      MRR7      4       EK  Rp M	  V'       g   R#  \        V4       \        VR^R7       R#   \         d    \        TR	^R7       Rp  KE  i ; i  \         d     Mi ; i\
        P                  ! YR7      pT P!                  T4      # )Tz%%%r   zIncomplete format: '...N')levelFz)Too few arguments for format placeholdersasrfdoxXr)  doxXr  arsrc  r/  dr9  r2  )r   r  r  z*Too many arguments for format placeholders)r   rM   )iterr   rE  _parse_string_format_regexrR   r   r   r   r   nextStopIterationr   r^  FormattedValueNoder   r_  visit_JoinedStrNode)r`   r   r3  r  r   
substringscan_be_optimisedra  format_typer'   r  r  r(   s   &&&&         r!   rw  ConstantFolding._build_fstring  sM   K 
$997CADy!!)"7"7=QTCU"VWts{R5C<C#:1RS6(!!DAN',$!!)"7"7=QRCS"TUB%K4j
 ~~~#( j(e"&&(SK-?',$ E)"-cr"2K&1O"--c22&)KO&; C'&)O))#.."%B"7K!!)">">GG3$3& !* 5 5c{A[ \,0	#  $) c Df  	J CEQO[ ! HPQR#( T "d"
 &&s>''--s$   'HH? H<;H<?IIc                   V P                  V4       VP                  ;'       g    R pVP                  e@   VP                  P                  '       d$   VP                  P                  '       g   RVn        VP                  f   VP                  P                  4       '       d   \        VP                  P                  \        4      '       dU   \        \        VP                  P                  4      4      p\        P                  ! VP                  P                  VR7      # VP                  f0   VR 8X  d)   VP                  P                  '       d   VP                  # V# )ra  Nr   )rc   r  r  r   r   r  r&   r;   r  r   r  r   r   r   )r`   r(   r  r   s   &&  r!   r  (ConstantFolding.visit_FormattedValueNodeM  s    4 ..55#'D,<,<,N,N,NW[WgWgWmWmWm#D#

(F(F(H(HZX\XbXbXrXrtwMxMx!#djj&@&@"ABE((uEE#3(>zz+++zz!r#   c                F    V P                  V4       V P                  V4      # r%   )rc   r`  rd   s   &&r!   r  #ConstantFolding.visit_JoinedStrNodeZ  s!    4 **400r#   c                   . p\         P                  ! VP                  \        R4      R7       F  w  r4V'       d   \	        V4      pV^ ,          p\        V4      ^8  dD   \        RP                  R V 4       4      4      p\        P                  ! VP                  VR7      pVP                  '       d   VP                  V4       K  K  VP                  V4       K  	  V'       g.   \        P                  ! VP                  \        R4      R7      pV# \        V4      ^8X  d   V^ ,          pV# \        V4      ^8X  d&   \        P                  ! VP                  R.VO5!  pV# W!n        V# )z
Clean up after the parser by discarding empty Unicode strings and merging
substring sequences.  Empty or single-value join lists are not uncommon
because f-string format specs are always parsed into JoinedStrNodes.
r   )r  r  c              3   8   "   T F  qP                   x  K  	  R # 5ir%   r   )r   r   s   & r!   r   9ConstantFolding.simplify_JoinedStrNode.<locals>.<genexpr>j  s     1V:%++:r   r   r:  )r   groupbyr   r   r@   rP   r   r  r   r   r   r   rR   ra  rI  )r`   r(   r   is_unode_groupr  unoder   s   &&     r!   r`  &ConstantFolding.simplify_JoinedStrNode^  s(    *3*;*;DKKZXkMl*m&N!*-
"1z?Q&)"''1V:1V*VWE%11%))5IE;;;MM%(  j) +n ((r9JKD  [A!9D  [A''#??D  !Kr#   c                  aaa V P                  V4       . o. oVVV3R loVP                   F  pS! W4       K  	  S'       d   SP                  S4       \        S4      ^8X  d>   S^ ,          pVP                  '       g!   \        V\        P                  4      '       d   V# SVP                  R&   V P                  V4       V# )z!Unpack **args in place if we can.c                   < VP                   '       dl   S'       dQ   SR,          P                  VP                  8X  d/   SR,          P                  P                  VP                  4       R# SP	                  V4       R# \        V\        P                  4      '       d9   V P                  VP                  8X  d   VP                   F  pS! W4       K  	  R# S'       d   SP                  S4       SR SP	                  V4       R# )r   rr  NrM   )	is_dict_literalreject_duplicatesrG  ra  rR   r&   r   MergedDictNoder  )parentr'   	child_argr?  r   r   s   && r!   r?  1ConstantFolding.visit_MergedDictNode.<locals>.add  s    """U2Y88C<Q<QQ"I--44S5H5HILL%C!9!9::v?W?W[^[p[p?p!$!1!1I' "2 KK&aC r#   rr  )	rc   r  ra  rP   r  r&   r   r  r.  )r`   r(   r'   r?  r   r   s   && @@@r!   visit_MergedDictNode$ConstantFolding.visit_MergedDictNode}  s    4 	! $$CN %KKt9>q'C"""ji6N6N&O&O
#!d#r#   c                :  aaaa V P                  V4       VP                  \        P                  J o. o. oVVVV3R loVP                   F  pS! V4       K  	  S'       d   SP                  S^ ,          4       \        S4      ^8X  dr   S^ ,          pS'       d   VP                  '       gM   VP                  '       d   VP                  VP                  J g!   \        V\        P                  4      '       d   V# SVP                  R&   V P                  V4       V# ) Unpack *args in place if we can.c                   < S'       d   V P                   '       g%   V P                  '       d\   V P                  '       gJ   S'       d/   S^ ,          P                  P	                  V P                  4       R# SP                  V 4       R# \        V \        P                  4      '       d   V P                   F  pS! V4       K  	  R# S'       d   SP                  S^ ,          4       SR SP                  V 4       R# )r   rr  N)	is_set_literalr   rh  r   ra  rR   r&   r   MergedSequenceNode)r'   r  r?  r   r  r   s   & r!   r?  5ConstantFolding.visit_MergedSequenceNode.<locals>.add  s    3---33N3N3NWZWfWfWf1INN))#((3MM#&C!=!=>>!$I	N "* KKq	*q	C r#   rr  )rc   rH   r
   r   r   rR   rP   r  r   r&   r   r  r.  )r`   r(   r'   r?  r   r  r   s   && @@@@r!   visit_MergedSequenceNode(ConstantFolding.visit_MergedSequenceNode  s    4 g...	! 	! 99CH KKq	"t9>q'CC...000SXX5JsI$@$@AA
		!d#r#   c                   V P                  V4       . pVP                   F  pVP                  '       g   VP                  V4       K(  VP                  P
                  '       dD   VP                  P                  '       g(   VP                  VP                  P                  4       K  VP                  V4       K  	  W!P                  R&   V P                  V4       V# )r  rr  )	rc   r   r   rR   r   r   rh  ra  r.  )r`   r(   r   r'   s   &&  r!   visit_SequenceNode"ConstantFolding.visit_SequenceNode  s    4 99C>>>C 333CJJ<R<R<RCJJOO,C   		!d#r#   c           	     6   V P                  VR .4       VP                  pTpVe   V P                  VR.4       VP                  p\        Vn        VP                  4       '       d3   VP                  4       '       d    VP                  VP                  4       TpVP                  pK  VP                  '       g4   VP                  4       '       d   V P                  WP                  4      # V# VP                  ..p. pTpVe   VP                  4       '       dR   VP                  '       g#   VP                  V P                  VR4      4       MCVP                  VP                  .4       MVR	,          P                  V4       VP                  pK  . pV F  p\!        V4      ^8  d   K  V^,          p\"        P$                  ! VP&                  V^ ,          VP(                  VP                  \        R7      p	VP                  V	4       T	p
VR,           F  pW:n        Tp
K  	  RV
n        K  	  V'       d   VP                  V^ ,          4       MV'       g   V P                  VR4      # V^ ,          p\!        V4      ^8X  d5   VP                  4       '       d   V P                  WP                  4      #  V# VR,           F,  p\"        P*                  ! VP&                  VRV\        R7      pK.  	  V#   \        \        \        \        \        \        3 d     ELi ; i)
rE   NrF   F)rE   r   rF   r;   :r>   NNTr)  r3  rM   )rc   rE   rF   r   r;   r  "calculate_cascaded_constant_resultr  r#  r   r$  rC  r%  r  r7  rR   rP   r   r   r   r   rB  )r`   r(   	left_noder   
right_nodecascadesfinal_false_result	cmp_nodesr  	pcmp_nodelast_cmp_nodes   &&         r!   r   $ConstantFolding.visit_PrimaryCmpNode  s   4*.MM	"x*6!**J'5H$,,..:3Q3Q3S3S??	@Y@YZ #I''H|||''))t-A-ABBK ]]O$"++--///&--dooh.NO OOX%6%6$78 ##H-''H	G7|aqzH!00 !**!** .0I Y'%M#BKK(0% ( ( %)M!!  $ /23??4..|y>Q''))t-A-ABB *  &bMM ..HH!"%$24 * E #Ix^Ude s   =K/ /%LLc                    V P                  V4       VP                  P                  4       '       g   V# VP                  P                  '       d   VP                  # VP
                  # r%   )r.  rN  r  r;   r\  r]  rd   s   &&r!   r_  "ConstantFolding.visit_CondExprNode$  sL    d#yy,,..K99$$$== >>!r#   c                   V P                  V4       . pVP                   F]  pVP                  pVP                  4       '       d(   VP                  '       d   VP
                  Vn         MKL  VP                  V4       K_  	  V'       d	   W!n        V# VP                  '       d   VP                  # \        P                  ! VP                  . R 7      # r   )rc   r   r   r  r;   r   r   rR   r   r   r   )r`   r(   r   rT  r   s   &&   r!   rX   ConstantFolding.visit_IfStatNode-  s    4 
I!++I,,..,,,'0~~D$ - !!), ) (OK###%%dhhb99r#   c                8   V P                  V4       VP                  e   VP                  P                  f
   R ;q!n        MVP                  P                  pVP                  e   VP                  P                  f
   R ;q1n        MVP                  P                  pVP                  \        Jdk   VP
                  pVP                  '       d$   VP                  f   VP                  W# Vn        V# VP                  '       d   VP                  W#4      pVe   V# V# r%   )r.  ri  r;   rk  r   r   r   rh  r   r   as_sliced_node)r`   r(   ri  rk  r   s   &&   r!   visit_SliceIndexNode$ConstantFolding.visit_SliceIndexNodeD  s    d#::!;!;!C!%%EJJJ..E99		 9 9 A##D999,,D~599D+++0@0@0H IIe1	'''**57#Kr#   c                J   V P                  V4       \        VP                  \        P                  4      '       d   VP                  P
                  '       g   VP                  \        P                  J d$   \        P                  ! VP                  . . R 7      # VP                  \        P                  J d,   \        P                  ! VP                  . \        4       R 7      # VP                  \        P                  J d$   \        P                   ! VP                  . / R7      # V# )r2  rF  )rc   r&   r  r   r   r   rH   r
   r&  r   r   r   r   r  rO   r   rJ  rd   s   &&r!   visit_ComprehensionNode'ConstantFolding.visit_ComprehensionNode[  s    4 dii!3!344TYY___yyG--- ))HH2r; ;g... ((HH2su> >g/// ))HHb"F Fr#   c                   V P                  V4       VP                  P                  p\        V\        P
                  4      '       d   VP                  '       gA   VP                  '       d   VP                  # \        P                  ! VP                  . R 7      # \        V\        P                  4      '       d    VP                  4       VP                  n        V# r  )rc   r   r   r&   r   SequenceNoder   r   r   r   r   r   r9  )r`   r(   r   s   && r!   r   #ConstantFolding.visit_ForInStatNodej  s    4 ==))h	 6 677===###+++ !--dhhbAA(I$6$677)1):):)<&r#   c                    V P                  V4       VP                  '       dY   VP                  P                  4       '       d9   VP                  P                  '       d   R Vn        R Vn        V# VP                  # V# r%   )rc   r   r  r;   r   rd   s   &&r!   visit_WhileStatNode#ConstantFolding.visit_WhileStatNodey  sd    4 >>>dnn@@BB~~---!%#'   '''r#   c                    V P                  V4       \        VP                  \        P                  4      '       g   V# VP                  P                  4       '       d   R # V# r%   )rc   r&   rh   r   ExprNoder  rd   s   &&r!   ri   "ConstantFolding.visit_ExprStatNode  sG    4 $))Y%7%788K99((**r#   c                    V P                  V4       VP                  f   V# VP                  P                  4       '       d2   VP                  P                  '       d
   R Vn        V# VP                  # V# r%   )rc   r   r  r;   r   rd   s   &&r!   visit_GILStatNode!ConstantFolding.visit_GILStatNode  se    4 >>!K>>--// ~~---!%  yy  r#   )r  r1   )5rv   rw   rx   ry   rz   r]   r.  r   r   r/  r   r  r1  r4  r7  r:  rA  rQ  rE  r>  r@  r?  rd  r\  rc  rh  rg  rf  ry  r  rw  r  r  r`  r  r  r  r   r_  rX  r  r  r   r  ri   r  r   rv  rw  r{   r|   r}   __classcell__)r  r   s   @@r!   r  r    s$     %1@ !))9+=+= (()*=*=?O?& 	h$h$	
 
c ,%8t5*n*6"*	 D.L1> D$LN`":..6 ))==JJr#   r  c                   z   a  ] tR tRt o RtRtR tR tR tR t	R t
R	 tR
 tR tR tRR ltV 3R lR ltRtV tR# )FinalOptimizePhasei  a  
This visitor handles several commuting optimizations, and is run
just before the C code generation phase.

The optimizations currently implemented in this class are:
    - eliminate None assignment and refcounting for first assignment.
    - isinstance -> typecheck for cdef types
    - eliminate checks for None and/or types that became redundant after tree changes
    - eliminate useless string formatting steps
    - inject branch hints for unlikely if-cases that only raise exceptions
    - replace Python function calls that look like method calls by a faster PyMethodCallNode
    - replace duplicate FormattedValueNodes in f-strings with CloneNodes
Fc                r    V P                  V4       VP                  '       d   VP                  pRVn        V# )zQAvoid redundant initialisation of local variables before their
first assignment.
T)rc   rj  r   lhs_of_first_assignment)r`   r(   r   s   && r!   visit_SingleAssignmentNode-FinalOptimizePhase.visit_SingleAssignmentNode  s1     	4 :::((C*.C'r#   c                   VP                   pVP                  pVP                  '       g   VP                  '       d   VP                  MR pV P                  4       pVP                  ;'       g?    VP                  ;'       g+    VP                  ;'       d    VP                  P                  pVP                  4       ;'       d    VP                  ;'       du    V\        P                  J;'       d[    T;'       d    VP                  '       * ;'       d8    V P                  P!                  V P"                  '       g   V'       d   RMR4      # )Nz&optimize.unpack_method_calls_in_pyinitzoptimize.unpack_method_calls)r
  rH   r   r   r   r   is_module_scopeis_c_class_scopeis_py_class_scopeouter_scoper  r   r
   rQ   r  rP  rQ  in_loop)r`   r(   r
  function_typer   r  in_global_scopes   &&     r!   _check_optimize_method_calls/FinalOptimizePhase._check_optimize_method_calls  s   == "*"2"2"2h6K6K6KQU  H H  H H""FFs'F'F 	 ! 5 5%%5 5!2!225 5 ++5++,5 5 ##''||| 935		
r#   c                Z   V P                  V4       VP                  pVP                  P                  '       Ed7   VP                  '       Ed$   VP
                  R8X  Ed   \        VP                  4      ^8X  d   VP                  ^,          pVP                  P                  '       d   VP                  P
                  R8X  d   V P                  P                  pVP                  R4      Vn        VP                  P                  Vn        \        P                  ! VP                  R4      P                  4      p\        P                   ! VP                  ^,          V4      VP                  ^&   V# \        P"                  P%                  VP&                  RR7      '       Ed	   \        P"                  P)                  V4      '       d   VP*                  '       d|   VP,                  '       dj   \/        VP0                  \        P2                  4      '       d@   VP0                  P4                  VP*                  J d   VP0                  P4                  Vn        V P7                  V\        P"                  P9                  WVP&                  VP                  V P;                  V4      R7      4      pV# )z
Replace generic calls to isinstance(x, type) by a more efficient type check.
Replace likely Python method calls by a specialised PyMethodCallNode.
r&   rH   PyObject_TypeCheckrC  F)
has_kwargs)r
  r	  rH   unpack)rc   r
  rH   is_cfunctionr   r    rP   r   r  r  rJ  r?  r   r	   rK  r   r  PyMethodCallNodecan_be_used_for_posargsr	  can_be_used_for_functionr`   r   r&   r6   r  r'   r_  	from_noder  )r`   r(   r
  rN  rJ  rS  s   &&    r!   r  'FinalOptimizePhase.visit_SimpleCallNode  s   
 	4 ====%%%(*:*:*:}},TYY11D99Q<==000X]]5G5G65Q#'<<#<#<L%1%8%89M%NHN$,NN$7$7HM&0&9&9,:M:Mn:]:b:b&cO#,#5#5diilO#TDIIaL  ))AA$..]bAcc--FFxPP			h&;&;&;&x||Y5H5HIIhllN^N^bfbkbkNk'/||'7'7<<i.H.H.R.R4>>PTPYPY#@@F /S /H ID r#   c                (   V P                  V4       \        VP                  4      p\        VP                  \        P
                  4      p\        P                  P                  VP                  W#R7      '       g   V# VP                  p\        P                  P                  V4      '       g   V# V P                  V\        P                  P                  WVP                  VP                  VP                  V P                  V4      R7      4      pV# )zG
Replace likely Python method calls by a specialised PyMethodCallNode.
)r  has_explicit_kwargs)r
  r	  kwdictrH   r  )rc   r  r  r&   r   rJ  r  r  r  r
  r  r_  r  rH   r  )r`   r(   r  r  r
  s   &&   r!   r  (FinalOptimizePhase.visit_GeneralCallNode  s     	4 $++,
():):I<N<NO))AA$$ B f fK==))BB8LLK||D)"<"<"F"Ft/C/CDL]L]4#D#DT#J #G #L M r#   c                (    V P                  V4       V# r%   )rc   rd   s   &&r!   visit_NumPyMethodCallNode,FinalOptimizePhase.visit_NumPyMethodCallNode  s    4 r#   c                    V P                  V4       VP                  '       g(   VP                  P                  4       '       g   RVn        V# )zyRemove tests for alternatively allowed None values from
type tests when we know that the argument cannot be None
anyway.
T)rc   notnoner'   r  rd   s   &&r!   rf  'FinalOptimizePhase.visit_PyTypeTestNode  s:    
 	4 |||88''))#r#   c                    V P                  V4       VP                  P                  4       '       g   VP                  # V# )zORemove None checks from expressions that definitely do not
carry a None value.
)rc   r'   r  rd   s   &&r!   visit_NoneCheckNode&FinalOptimizePhase.visit_NoneCheckNode  s3     	4 xx##%%88Or#   c                Z    V P                   pRV n         V P                  V4       W n         V# )zeRemember when we enter a loop as some expensive optimisations might still be worth it there.
        T)r  rc   )r`   r(   old_vals   && r!   visit_LoopNode!FinalOptimizePhase.visit_LoopNode$  s,     ,,4 r#   c                8   V P                  V4       Rp\        VP                  4       F6  w  r4V P                  WDP                  4       VP
                  '       d   K4  TpK8  	  VP                  '       d&   V'       d   V P                  W!P                  RR7       V# )zQAssign 'unlikely' branch hints to if-clauses that only raise exceptions.
        NT)inverse)rc   r   r   _set_ifclause_branch_hintr   branch_hintr   )r`   r(   last_non_unlikely_clauser5  rT  s   &&   r!   rX  #FinalOptimizePhase.visit_IfStatNode-  s     	4 #' %doo6LA**9nnE(((+4( 7  8**+CEUEU_c*dr#   c                   VP                   '       g   R# \        P                  \        P                  \        P                  \        P
                  \        P                  \        P                  3pV.p\        V^4       F  w  rg\        V\        P                  4      '       d   VP                  WgP                  4       KB  \        V\        P                  4      '       d   VP                  WVV% Kr  \        Wt4      '       d   K  V\        V4      8X  dB   \        V\        P                   \        P"                  34      '       d   V'       d   RMRVn         R# 	  R# )z\Inject a branch hint if the if-clause unconditionally leads to a 'raise' statement.
        Nlikelyunlikely)is_terminatorr   r  AssignmentNodeAssertStatNodeDelStatNode
GlobalNodeNonlocalNoder   r&   GILStatNodera  r   r   r   rP   RaiseStatNodeReraiseStatNoder  )r`   clausestatements_noder  non_branch_nodes
statementsnext_node_posr(   s   &&&&    r!   r  ,FinalOptimizePhase._set_ifclause_branch_hint;  s    ,,,     
 &&
#,Z#;M$ 1 122!!-;$ 2 233:>**
7d55 C
O3
4%J]J]_d_t_tIu8v8v5<*F& $<r#   c                4   < V ^8  d   QhRS[ P                  /# )r>   r(   )r   r_  )rA   r   s   "r!   rB   FinalOptimizePhase.__annotate__W  s     4 4	(?(? 4r#   c                   \         P                  p\         P                  p/ pVP                  R,          p\	        VP                  4       EF!  w  rg\        Wr4      '       g   K  VP                  p\        VP                  V4      '       d   VP                  pM.VP                  e   MVP                  P                  '       d   MK|  VP                  '       d   VP                  4       '       g   K  VP                  VP                  VP                  VP                  ;'       g    R3p	VP!                  W4      p
WJ d   K  \         P"                  ! V
4      pVP$                  Vn        WV&   EK$  	  WQP                  R&   V# )a  
Deduplicate repeatedly formatted (C) values by replacing them with CloneNodes.
It's not uncommon for a formatting expression to appear multiple times in an f-string.

Note that this is somewhat handwavy since it's potentially possible even for simple
expressions to change their value while processing an f-string, e.g. by modifying the
world in a ".__format__" method.  However, this seems unlikely enough to appear in
real-world code that we ignore the case here.
rr  ra  )r   r  r  r   r   r&   r   r'   r  rH   r  r   r  r    r  r  r  r  r   )r`   r(   r  r  rE  r   r5  fnodefnode_value_noder  
seen_fnodededup_fnodes   &&          r!   r  &FinalOptimizePhase.visit_JoinedStrNodeW  sA    '99&99Q!$++.HAe88${{%++'9::#3#7#7 $$0!&&666  $,,,1A1K1K1M1M
 #((%*=*=u?P?PRWRgRgRnRnknoC4J"#--j9K#iiKO#1IE /H  Ar#   )r  Nr1   )rv   rw   rx   ry   rz   r  r  r  r  r  r  rf  r  r  rX  r  r  r|   r}   r~   s   @r!   r  r    sM      G
*<&
	84 4r#   r  c                   4   a  ] tR tRt o RtRtR tR tRtV t	R# )ConsolidateOverflowChecki  a!  
This class facilitates the sharing of overflow checking among all nodes
of a nested arithmetic expression.  For example, given the expression
a*b + c, where a, b, and x are all possibly overflowing ints, the entire
sequence will be evaluated and the overflow bit checked only at the end.
Nc                    V P                   e-   V P                   pR V n         V P                  V4       W n         V# V P                  V4       V# r%   )overflow_bit_noderc   )r`   r(   saveds   && r!   r{   #ConsolidateOverflowCheck.visit_Node  sQ    !!-**E%)D"t$%*"  t$r#   c                   VP                   '       dj   VP                  '       dX   V P                  R J pV'       d   Wn        MV P                  Vn        RVn         V P                  V4       V'       d   R V n        V# V P                  V4       V# )NF)overflow_checkoverflow_foldr  rc   )r`   r(   top_level_overflows   && r!   visit_NumBinopNode+ConsolidateOverflowCheck.visit_NumBinopNode  s~    4#5#5#5!%!7!74!?!)-&)-)?)?&&+#t$!)-&  t$r#   )r  )
rv   rw   rx   ry   rz   r  r{   r&  r|   r}   r~   s   @r!   r  r    s!       r#   r  rl   )Fcythondeclarer   r   r   r   r   	functoolsr   r   r   r   r  r   r   r   r   r  r  rl  r   r	   r   r
   r   r   Coder   r   StringEncodingr   r   r   Errorsr   r   ParseTreeTransformsr   r   r"   r  r}  r*   r/   r5   r<   rX   r\   rZ   r   r   EnvTransformr   r  rv  ry  r  r  NodeRefCleanupMixinrS  MethodDispatcherTransformrc  r%  r   rZ  r  r  r  CythonTransformr  rl   r#   r!   <module>r3     sq     .6 . .v .^d ..'-.:@.JP..)/.7=. .  &. /5. AG. TZ. 	. '-	. 
    %   23<         1 H H " 1 7 /8.J.JILjLj-k #$L'-- @t-- tn!y>g** y>xF>W557G F>Rq&w77 q&hCw33 CL44g6J6J DqT766"<<qTh?B:J "-!8!89Lo!^ *667H/Z s>g..0@ s>l`--w/J/J `F w66  r#   