← Back
Editing: oldstr.cpython-38.pyc
U ,�]� � @ sz d Z ddlmZ ddlmZmZ er2ddlmZ nddlmZ e Z G dd� de�Zdd� Z G d d � d eee ��Zd gZdS )zH Pure-Python implementation of a Python 2-like str object for Python 3. � )�Integral)�PY2�with_metaclass)�Iterablec @ s e Zd Zdd� ZdS )� BaseOldStrc C s t |t�S �N)� isinstance�_builtin_bytes)�cls�instance� r �3/usr/lib/python3/dist-packages/past/types/oldstr.py�__instancecheck__ s zBaseOldStr.__instancecheck__N)�__name__� __module__�__qualname__r r r r r r s r c C s | � � �d�S )z� 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 Zunicode_escape)�encode�decode)�sr r r �unescape s r c sd e Zd ZdZedd� �Zdd� Z� fdd�Z� fdd �Z� fd d�Z dd � Z dd� Zdd� Z� Z S )�oldstrzC A forward port of the Python 2 8-bit string object to Py3 c C s t �d S r )�AttributeError��selfr r r �__iter__- s zoldstr.__iter__c C s dd� t t�D �S )Nc S s g | ]}|d kr|�qS )r r )�.0�thingr r r � <listcomp>2 s z"oldstr.__dir__.<locals>.<listcomp>)�dirr r r r r �__dir__1 s zoldstr.__dir__c s t t| ��� }|dd � S �N� )�superr �__repr__�r r �� __class__r r r# l s zoldstr.__repr__c s>