3
‡Œði¾  ã               @   sp   d Z ddlmZ ddl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 ejdƒZG d	d
„ d
ejƒZdS )a  
For the ``future`` package.

Adds this import line:

    from past.builtins import str as oldstr

at the top and wraps any unadorned string literals 'abc' or explicit byte-string
literals b'abc' in oldstr() calls so the code has the same behaviour on Py3 as
on Py2.6/2.7.
é    )Úunicode_literalsN)Ú
fixer_base)Útoken)Úsyms)Úfuture_importÚtouch_import_topÚwrap_in_fn_callz[^uUrR]?[\'\"]c               @   s   e Zd ZdZdZdd„ ZdS )ÚFixOldstrWrapTÚSTRINGc             C   sX   |j tjkrTtdd|ƒ tj|jƒrT|jƒ }d|_d|j |_t	d|g|jd�}|S d S )Nz
past.typesZoldstrÚ Úb)Úprefix)
Útyper   r
   r   Ú_literal_reÚmatchÚvalueÚcloner   r   )ÚselfÚnodeÚresultsÚnewÚwrapped© r   úC/tmp/pip-build-6m2fasei/future/libfuturize/fixes/fix_oldstr_wrap.pyÚ	transform   s    zFixOldstrWrap.transformN)Ú__name__Ú
__module__Ú__qualname__ZBM_compatibleZPATTERNr   r   r   r   r   r	      s   r	   )Ú__doc__Ú
__future__r   ÚreZlib2to3r   Zlib2to3.pgen2r   Zlib2to3.fixer_utilr   Zlibfuturize.fixer_utilr   r   r   Úcompiler   ZBaseFixr	   r   r   r   r   Ú<module>   s   
