a 9dg @sZdZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z GdddejZdS) aFixer 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. ) fixer_base)Node)python_symbols)NameArgListListCompin_special_context parenthesizec@s eZdZdZdZdZddZdS) FixFilterTaV filter_lambda=power< 'filter' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > [extra_trailers=trailer*] > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > [extra_trailers=trailer*] > | power< 'filter' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > zfuture_builtins.filtercCsL||rdSg}d|vr6|dD]}||q"d|vr|d}|jtjkrfd|_t|}t |d|d|d|}t tj |g|dd}nd|vrt t d t d |d t d }t tj |g|dd}nTt |rdS|d }t tj t d |gdd}t tj t d t|gg|}d|_|j|_|S)NZextra_trailersZ filter_lambdaxpfpit)prefixZnoneZ_fseqargsfilterlist)Z should_skipappendZclonegettypesymstestrr rrZpowerrrr)selfZnoderesultsZtrailerstr newrr4/usr/local/lib/python3.9/lib2to3/fixes/fix_filter.py transform:s>      zFixFilter.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onrrrrrr sr N)__doc__r rZpytreerZpygramrrZ fixer_utilrrrrr ZConditionalFixr rrrrs