ó
	Q˜[c           @  sš   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 d	 e j f d
 „  ƒ  YZ d S(   u  
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.
iÿÿÿÿ(   t   unicode_literalsN(   t
   fixer_base(   t   token(   t   syms(   t   future_importt   touch_import_topt   wrap_in_fn_callu   [^uUrR]?[\'\"]t   FixOldstrWrapc           B  s   e  Z e Z d  Z d „  Z RS(   u   STRINGc         C  s   | j  t j k r{ t d d | ƒ t j | j ƒ r{ | j ƒ  } d | _ d | j | _ t	 d | g d | j ƒ} | Sn  d  S(   Nu
   past.typesu   oldstru    u   bt   prefix(
   t   typeR   t   STRINGR   t   _literal_ret   matcht   valuet   cloneR   R   (   t   selft   nodet   resultst   newt   wrapped(    (    s@   lib/python2.7/site-packages/libfuturize/fixes/fix_oldstr_wrap.pyt	   transform   s    	(   t   __name__t
   __module__t   Truet   BM_compatiblet   PATTERNR   (    (    (    s@   lib/python2.7/site-packages/libfuturize/fixes/fix_oldstr_wrap.pyR      s   (   t   __doc__t
   __future__R    t   ret   lib2to3R   t   lib2to3.pgen2R   t   lib2to3.fixer_utilR   t   libfuturize.fixer_utilR   R   R   t   compileR   t   BaseFixR   (    (    (    s@   lib/python2.7/site-packages/libfuturize/fixes/fix_oldstr_wrap.pyt   <module>   s   