Server : LiteSpeed
System : Linux server64.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : nimalaab ( 3358)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /opt/cloudlinux/venv/lib64/python3.11/site-packages/past/types/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/past/types/basestring.py
"""
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 __subclasscheck__(cls, subclass):
        return super(BaseBaseString, cls).__subclasscheck__(subclass) or issubclass(subclass, (bytes, str))


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


__all__ = ['basestring']

F1le Man4ger