U if* @sRdZddlmZddlmZddlmZddlmZmZm Z Gdddej Z dS) zIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).)pytree)token) fixer_base)CallComma parenthesizec@seZdZdZdZddZdS)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c Cs4|j}|st|d}|d}|d}|rN|j|jjkrN|jdjdkrNdS|rt|j|jjkrt|jdjdkrtdS|j}|}|jt j |j fkr|j|j ks|jdjt j krt|}d|_|}d|_|dk r|}d|_tt jd |g}|dk r&|ttt j d|gd |d_t|||d S) Nfuncargskwds>***r r )prefix)symsAssertionErrorgettypeZargumentZchildrenvaluerZclonerNAMEZatomZpower DOUBLESTARrrZLeafSTARextendrr) selfZnodeZresultsrr r r rZ l_newargsrs