
    ;e                     h    d Z ddlmZ ddlmZmZ dddiiZi Zd Zd Z	 G d	 d
ej
                  ZdS )z?Fix incompatible renames

Fixes:
  * sys.maxint -> sys.maxsize
   )
fixer_base)Name
attr_chainsysmaxintmaxsizec                 ^    dd                     t          t          |                     z   dz   S )N(|))joinmaprepr)memberss    0/usr/lib/python3.11/lib2to3/fixes/fix_renames.py
alternatesr      s(    #dG,,---33    c            	   #      K   t          t                                                    D ]Q\  } }t          |                                          D ]*\  }}|t          | |f<   d| d|d|dV  d| d|dV  +Rd S )Nz3
                  import_from< 'from' module_name=z, 'import'
                      ( attr_name=z | import_as_name< attr_name=z! 'as' any >) >
                  z&
                  power< module_name=z trailer< '.' attr_name=z > any* >
                  )listMAPPINGitemsLOOKUP)modulereplaceold_attrnew_attrs       r   build_patternr      s      00 + +"&w}}"7"7 	+ 	+Hh)1FFH%&&  8885 5 5 5 5  + + + + +	++ +r   c                   f     e Zd ZdZd                     e                      ZdZ fdZd Z	 xZ
S )
FixRenamesTr   prec                     t          t          |           j         |          }|r-t          fdt	          |d          D                       rdS |S dS )Nc              3   .   K   | ]} |          V  d S )N ).0objmatchs     r   	<genexpr>z#FixRenames.match.<locals>.<genexpr>5   s+      DD#55::DDDDDDr   parentF)superr   r&   anyr   )selfnoderesultsr&   	__class__s      @r   r&   zFixRenames.match1   si    j$''-%++ 	DDDDD()C)CDDDDD uNur   c                     |                     d          }|                     d          }|rF|rFt          |j        |j        f         }|                    t	          ||j                             d S d S d S )Nmodule_name	attr_name)prefix)getr   valuer   r   r2   )r+   r,   r-   mod_namer1   r   s         r   	transformzFixRenames.transform>   s    ;;}--KK,,	  	G	 	Gx~y?@Hd8I4DEEEFFFFF	G 	G 	G 	Gr   )__name__
__module____qualname__BM_compatibler   r   PATTERNorderr&   r6   __classcell__)r.   s   @r   r   r   *   so        Mhh}}''GE    G G G G G G Gr   r   N)__doc__ r   
fixer_utilr   r   r   r   r   r   BaseFixr   r#   r   r   <module>rB      s           ) ) ) ) ) ) ) )Hy) 	4 4 4+ + +*G G G G G# G G G G Gr   