Your IP : 3.149.24.49


Current Path : /opt/alt/python33/lib64/python3.3/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/lib2to3/fixes/__pycache__/fix_dict.cpython-33.pyc

�
��f�c@s�dZddlmZddlmZddlmZddlmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZejedg�BZGd	d
�d
ej�ZdS(ujFixer 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).
i(upytree(upatcomp(utoken(u
fixer_base(uNameuCalluLParenuRParenuArgListuDot(u
fixer_utiluitercBsb|EeZdZd	ZdZdd�ZdZej	e�Z
dZej	e�Zdd�Z
dS(
uFixDictu
    power< head=any+
         trailer< '.' method=('keys'|'items'|'values'|
                              'iterkeys'|'iteritems'|'itervalues'|
                              'viewkeys'|'viewitems'|'viewvalues') >
         parens=trailer< '(' ')' >
         tail=any*
    >
    c

Cs�|d}|dd}|d}|j}|j}|jd�}|jd�}	|s^|	rq|dd�}n|dks�tt|���dd�|D�}d
d�|D�}|o�|j||�}
|tj|jt	�t
|d|j�g�|dj�g}tj|j
|�}|
p-|	s`d|_tt
|rKdnd�|g�}n|r�tj|j
|g|�}n|j|_|S(NuheadumethodiutailuiteruviewiukeysuitemsuvaluescSsg|]}|j��qS((uclone(u.0un((u;/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_dict.pyu
<listcomp>Bs	u%FixDict.transform.<locals>.<listcomp>cSsg|]}|j��qS((uclone(u.0un((u;/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_dict.pyu
<listcomp>Cs	uprefixuparensuulist(ukeysuitemsuvalues(usymsuvalueu
startswithuAssertionErrorurepruin_special_contextupytreeuNodeutraileruDotuNameuprefixucloneupoweruCall(
uselfunodeuresultsuheadumethodutailusymsumethod_nameuisiteruisviewuspecialuargsunew((u;/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_dict.pyu	transform7s4

				'uFixDict.transformu3power< func=NAME trailer< '(' node=any ')' > any* >umfor_stmt< 'for' any 'in' node=any ':' any* >
            | comp_for< 'for' any 'in' node=any any* >
         cCs�|jdkrdSi}|jjdk	r�|jj|jj|�r�|d|kr�|rm|djtkS|djtjkSn|s�dS|j	j|j|�o�|d|kS(NunodeufuncF(
uparentuNoneuFalseup1umatchuvalueuiter_exemptu
fixer_utiluconsuming_callsup2(uselfunodeuisiteruresults((u;/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_dict.pyuin_special_context[suFixDict.in_special_contextNT(u__name__u
__module__u__qualname__uTrueu
BM_compatibleuPATTERNu	transformuP1upatcompucompile_patternup1uP2up2uin_special_context(u
__locals__((u;/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_dict.pyuFixDict*s
uFixDictN(u__doc__uupytreeupatcompupgen2utokenu
fixer_baseu
fixer_utiluNameuCalluLParenuRParenuArgListuDotuconsuming_callsusetuiter_exemptuBaseFixuFixDict(((u;/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_dict.pyu<module>s.

?>