File: //opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyc
�
�A�[c           @   s�   d  Z  d d l m Z d d l m Z d d l m Z m Z e Z	 d e
 f d �  �  YZ d �  Z d e e e	 � f d	 �  �  YZ
 d g Z d
 S(   sH   
Pure-Python implementation of a Python 2-like str object for Python 3.
i����(   t   Iterable(   t   Integral(   t   PY2t   with_metaclasst
   BaseOldStrc           B   s   e  Z d  �  Z RS(   c         C   s
   t  | t � S(   N(   t
   isinstancet   _builtin_bytes(   t   clst   instance(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyt   __instancecheck__   s    (   t   __name__t
   __module__R	   (    (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyR      s   c         C   s   |  j  �  j d � S(   s�   
    Interprets strings with escape sequences
    Example:
    >>> s = unescape(r'abc\def')   # i.e. 'abc\\def'
    >>> print(s)
    'abc\def'
    >>> s2 = unescape('abc\ndef')
    >>> len(s2)
    8
    >>> print(s2)
    abc
    def
    t   unicode_escape(   t   encodet   decode(   t   s(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyt   unescape   s    t   oldstrc           B   s\   e  Z d  Z e d �  � Z d �  Z d �  Z d �  Z d �  Z d �  Z	 d �  Z
 d �  Z RS(	   sC   
    A forward port of the Python 2 8-bit string object to Py3
    c         C   s
   t  � d  S(   N(   t   AttributeError(   t   self(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyt   __iter__*   s    c         C   s)   g  t  t � D] } | d k r
 | ^ q
 S(   NR   (   t   dirR   (   R   t   thing(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyt   __dir__.   s    c         C   s   t  t |  � j �  } | d S(   Ni   (   t   superR   t   __repr__(   R   R   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyR   i   s    c         C   sL   t  t |  � j �  } | d  d k r5 | d d k s; t � t | d d !� S(   Ni   s   b'i����t   '(   R   R   t   __str__t   AssertionErrorR   (   R   R   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyR   m   s    &c         C   sL   t  | t � r2 t t |  � j t | | d � � St t |  � j | � Sd  S(   Ni   (   R   R   R   R   t   __getitem__t   slice(   R   t   y(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyR   s   s    #c         G   s   |  j  t | �  � S(   N(   R   R   (   R   t   args(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyt   __getslice__y   s    c         C   s   t  | t � r t Sd  S(   N(   R   t   intt   False(   R   t   key(    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyt   __contains__|   s    c         C   s
   t  |  � S(   N(   t   bytes(   R   (    (    sB   /opt/alt/python27/lib/python2.7/site-packages/past/types/oldstr.pyt
   __native__�   s    (   R
   R   t   __doc__t   propertyR   R   R   R   R   R!   R%   R'