ppdZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z GddejZdS) 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 eZdZdZdZdZdZdS) 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.filterc||rdSg}d|vr2|dD])}||*d|vr|d}|jt jkrd|_t|}t|d|d|d|}tt j |g|zd}n d|vrrttd td |d td }tt j |g|zd}nt|rdS|d }tt j td |gd}tt j td t|gg|z}d|_|j|_|S)Nextra_trailers filter_lambdaxpfpit)prefixnone_fseqargsfilterlist) should_skipappendclonegettypesymstestrr rrpowerrr r)selfnoderesultstrailerstrnewrs ?/opt/alt/python311/lib64/python3.11/lib2to3/fixes/fix_filter.py transformzFixFilter.transform:s   D ! !  F w & &-. + + **** g % %T""((**Bw$)## !"%%7;;t,,2244";;t,,2244";;t,,2244b::CtzC58#3B???CC w  4::::"5>//11::''CtzC58#3B???CC"$'' t6?((**DtzDNND#9"EEECtzDLL'3%..#AH#LMMCCJ[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr*r+r)r r s6MG<'G$$$$$r+r N)__doc__rrpytreerpygramrr fixer_utilrrrr r ConditionalFixr r2r+r)r8s  ++++++RRRRRRRRRRRRRRGGGGG )GGGGGr+