404

[ Avaa Bypassed ]




Upload:

Command:

botdev@52.15.57.203: ~ $
"""
An implementation of the basestring type for Python 3

Example use:

>>> s = b'abc'
>>> assert isinstance(s, basestring)
>>> from past.types import str as oldstr
>>> s2 = oldstr(b'abc')
>>> assert isinstance(s2, basestring)

"""

import sys

from past.utils import with_metaclass, PY2

if PY2:
    str = unicode

ver = sys.version_info[:2]


class BaseBaseString(type):
    def __instancecheck__(cls, instance):
        return isinstance(instance, (bytes, str))

    def __subclasshook__(cls, thing):
        # TODO: What should go here?
        raise NotImplemented


class basestring(with_metaclass(BaseBaseString)):
    """
    A minimal backport of the Python 2 basestring type to Py3
    """


__all__ = ['basestring']


Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 880 B 0644
basestring.py File 729 B 0644
olddict.py File 2.67 KB 0644
oldstr.py File 4.2 KB 0644