3
‡ŒðiÑ  ã               @   sZ   d Z ddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZmZ dZG dd„ dejƒZd	S )
z?
Fixer for:
it.__next__() -> it.next().
next(it) -> it.next().
é    )Útoken)Úpython_symbols)Ú
fixer_base)ÚNameÚCallÚfind_bindingÚAttrz;Calls to builtin next() possibly shadowed by global bindingc               @   s   e Zd ZdZdd„ ZdS )ÚFixNextas  
    power< base=any+ trailer< '.' attr='__next__' > any* >
    |
    power< head='next' trailer< '(' arg=any ')' > any* >
    |
    classdef< 'class' base=any+ ':'
              suite< any*
                     funcdef< 'def'
                              attr='__next__'
                              parameters< '(' NAME ')' > any+ >
                     any* > >
    c             C   s„   |st ‚|jdƒ}|jdƒ}|jdƒ}|jdƒ}|rh|jƒ }|jttt|ƒ|jd�tdƒƒƒ |jƒ  n|r€|jtd|jd�ƒ d S )NÚbaseÚattrÚheadÚarg)ÚprefixÚnext)	ÚAssertionErrorÚgetÚcloneÚreplacer   r   Úunicoder   Úremove)ÚselfÚnodeÚresultsr
   r   r   Zarg_r   © r   ú>/tmp/pip-build-6m2fasei/future/libpasteurize/fixes/fix_next.pyÚ	transform   s    




zFixNext.transformN)Ú__name__Ú
__module__Ú__qualname__ZPATTERNr   r   r   r   r   r	      s   r	   N)Ú__doc__Zlib2to3.pgen2r   Zlib2to3.pygramr   ZsymsZlib2to3r   Zlib2to3.fixer_utilr   r   r   r   Zbind_warningZBaseFixr	   r   r   r   r   Ú<module>   s   