
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,a°  ã                   @   sj   d Z ddlmZ ddlmZ ddlmZ ddlmZmZmZ ddlmZ ej	dhB Z
G dd	„ d	ejƒZd
S )aj  Fixer for dict methods.

d.keys() -> list(d.keys())
d.items() -> list(d.items())
d.values() -> list(d.values())

d.iterkeys() -> iter(d.keys())
d.iteritems() -> iter(d.items())
d.itervalues() -> iter(d.values())

d.viewkeys() -> d.keys()
d.viewitems() -> d.items()
d.viewvalues() -> d.values()

Except in certain very specific contexts: the iter() can be dropped
when the context is list(), sorted(), iter() or for...in; the list()
can be dropped when the context is list() or sorted() (but not iter()
or for...in!). Special contexts that apply to both: list(), sorted(), tuple()
set(), any(), all(), sum().

Note: iter(d.keys()) could be written as iter(d) but since the
original d.iterkeys() was also redundant we don't fix this.  And there
are (rare) contexts where it makes a difference (e.g. when passing it
as an argument to a function that introspects the argument).
é   )Úpytree)Úpatcomp)Ú
fixer_base)ÚNameÚCallÚDot)Ú
fixer_utilÚiterc                   @   s@   e Zd ZdZdZdd„ ZdZe e¡Z	dZ
e e
¡Zdd„ Zd	S )
ÚFixDictTa  
    power< head=any+
         trailer< '.' method=('keys'|'items'|'values'|
                              'iterkeys'|'iteritems'|'itervalues'|
                              'viewkeys'|'viewitems'|'viewvalues') >
         parens=trailer< '(' ')' >
         tail=any*
    >
    c              	   C   s  |d }|d d }|d }| j }|j}| d¡}| d¡}	|sD|	rP|dd … }|dksdtt|ƒƒ‚d	d
„ |D ƒ}dd
„ |D ƒ}| o�|  ||¡}
|t |jt	ƒ t
||jd�g¡|d  ¡ g }t |j|¡}|
sô|	sôd|_tt
|rèdndƒ|gƒ}|�rt |j|g| ¡}|j|_|S )NÚheadÚmethodé    Útailr	   Zviewé   )ÚkeysÚitemsÚvaluesc                 S   s   g | ]}|  ¡ ‘qS © ©Úclone©Ú.0Únr   r   ú;/opt/alt/python38/lib64/python3.8/lib2to3/fixes/fix_dict.pyÚ
<listcomp>A   s     z%FixDict.transform.<locals>.<listcomp>c                 S   s   g | ]}|  ¡ ‘qS r   r   r   r   r   r   r   B   s     )ÚprefixZparensÚ Úlist)ÚsymsÚvalueÚ
startswithÚAssertionErrorÚreprÚin_special_contextr   ZNodeZtrailerr   r   r   r   Zpowerr   )ÚselfÚnodeÚresultsr   r   r   r   Zmethod_nameÚisiterZisviewZspecialÚargsÚnewr   r   r   Ú	transform6   s<    


ÿÿÿ
üzFixDict.transformz3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* >
            | comp_for< 'for' any 'in' node=any any* >
         c                 C   s‚   |j d krdS i }|j j d k	r^| j |j j |¡r^|d |kr^|rN|d jtkS |d jtjkS |sfdS | j |j |¡o€|d |kS )NFr%   Úfunc)ÚparentÚp1Úmatchr   Úiter_exemptr   Úconsuming_callsÚp2)r$   r%   r'   r&   r   r   r   r#   Z   s    
ÿ
þzFixDict.in_special_contextN)Ú__name__Ú
__module__Ú__qualname__ZBM_compatibleZPATTERNr*   ZP1r   Zcompile_patternr-   ZP2r1   r#   r   r   r   r   r
   )   s   


r
   N)Ú__doc__r   r   r   r   r   r   r   r   r0   r/   ZBaseFixr
   r   r   r   r   Ú<module>   s   