Server IP : 192.64.118.117 / Your IP : 18.222.215.20 Web Server : LiteSpeed System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : thecgapy ( 1160) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python37/lib/python3.7/site-packages/past/types/ |
Upload File : |
""" 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']