Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/lib2to3/fixes/
Upload File :
Current File : //usr/lib/python2.7/lib2to3/fixes/fix_filter.pyc

ó
—|_c@sedZddlmZddlmZddlmZmZmZm	Z	dej
fd„ƒYZdS(s¸Fixer that changes filter(F, X) into list(filter(F, X)).

We avoid the transformation if the filter() call is directly contained
in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or
for V in <>:.

NOTE: This is still not correct if the original code was depending on
filter(F, X) to return a string if X is a string and a tuple if X is a
tuple.  That would require type inference, which we don't do.  Let
Python 2.6 figure it out.
i(ttoken(t
fixer_base(tNametCalltListComptin_special_contextt	FixFiltercBs#eZeZdZdZd„ZRS(sð
    filter_lambda=power<
        'filter'
        trailer<
            '('
            arglist<
                lambdef< 'lambda'
                         (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any
                >
                ','
                it=any
            >
            ')'
        >
    >
    |
    power<
        'filter'
        trailer< '(' arglist< none='None' ',' seq=any > ')' >
    >
    |
    power<
        'filter'
        args=trailer< '(' [any] ')' >
    >
    sfuture_builtins.filtercCs|j|ƒrdSd|krst|jdƒjƒ|jdƒjƒ|jdƒjƒ|jdƒjƒƒ}n}d|kr³ttdƒtdƒ|djƒtdƒƒ}n=t|ƒrÃdS|jƒ}d|_ttd	ƒ|gƒ}|j|_|S(
Nt
filter_lambdatfptittxptnoneu_ftsequulist(	tshould_skipRtgettcloneRRtNonetprefixR(tselftnodetresultstnew((s./usr/lib/python2.7/lib2to3/fixes/fix_filter.pyt	transform5s&	
	(t__name__t
__module__tTruet
BM_compatibletPATTERNtskip_onR(((s./usr/lib/python2.7/lib2to3/fixes/fix_filter.pyRsN(t__doc__tpgen2RtRt
fixer_utilRRRRtConditionalFixR(((s./usr/lib/python2.7/lib2to3/fixes/fix_filter.pyt<module>s"