Your IP : 3.17.75.8


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_has_key.cpython-33.pyc

�
��f�c@sidZddlmZddlmZddlmZddlmZmZGdd�dej	�Z
dS(	u&Fixer for has_key().

Calls to .has_key() methods are expressed in terms of the 'in'
operator:

    d.has_key(k) -> k in d

CAVEATS:
1) While the primary target of this fixer is dict.has_key(), the
   fixer will change any has_key() method call, regardless of its
   class.

2) Cases like this will not be converted:

    m = d.has_key
    if m(k):
        ...

   Only *calls* to has_key() are converted. While it is possible to
   convert the above to something like

    m = d.__contains__
    if m(k):
        ...

   this is currently not done.
i(upytree(utoken(u
fixer_base(uNameuparenthesizecBs,|EeZdZdZdZdd�ZdS(u	FixHasKeyu�
    anchor=power<
        before=any+
        trailer< '.' 'has_key' >
        trailer<
            '('
            ( not(arglist | argument<any '=' any>) arg=any
            | arglist<(not argument<any '=' any>) arg=any ','>
            )
            ')'
        >
        after=any*
    >
    |
    negation=not_test<
        'not'
        anchor=power<
            before=any+
            trailer< '.' 'has_key' >
            trailer<
                '('
                ( not(arglist | argument<any '=' any>) arg=any
                | arglist<(not argument<any '=' any>) arg=any ','>
                )
                ')'
            >
        >
    >
    c
Cs=|st�|j}|jj|jkrC|jj|j�rCdS|jd�}|d}|j	}dd�|dD�}|dj
�}|jd�}	|	r�dd�|	D�}	n|j|j|j|j|j
|j|j|jfkr�t|�}nt|�d	kr|d
}ntj|j|�}d|_	tdd
d�}
|r�tdd
d�}tj|j||
f�}
ntj|j||
|f�}|	r�t|�}tj|j|ft|	��}n|jj|j|j|j|j|j|j|j|j|jf	kr0t|�}n||_	|S(NunegationuanchorcSsg|]}|j��qS((uclone(u.0un((u>/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_has_key.pyu
<listcomp>Ss	u'FixHasKey.transform.<locals>.<listcomp>ubeforeuarguaftercSsg|]}|j��qS((uclone(u.0un((u>/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_has_key.pyu
<listcomp>Ws	iiu uinuprefixunot( uAssertionErrorusymsuparentutypeunot_testupatternumatchuNoneugetuprefixucloneu
comparisonuand_testuor_testutestulambdefuargumentuparenthesizeulenupytreeuNodeupoweruNameucomp_oputupleuexpruxor_expruand_expru
shift_expru
arith_exprutermufactor(
uselfunodeuresultsusymsunegationuanchoruprefixubeforeuarguafterun_opun_notunew((u>/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_has_key.pyu	transformHsF	
	!
	%	uFixHasKey.transformNT(u__name__u
__module__u__qualname__uTrueu
BM_compatibleuPATTERNu	transform(u
__locals__((u>/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_has_key.pyu	FixHasKey'su	FixHasKeyN(u__doc__uupytreeupgen2utokenu
fixer_baseu
fixer_utiluNameuparenthesizeuBaseFixu	FixHasKey(((u>/opt/alt/python33/lib64/python3.3/lib2to3/fixes/fix_has_key.pyu<module>s


?>