golden hour
/opt/cloudlinux/venv/lib/python3.11/site-packages/past/types
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.py
879 B
Del
OK
__pycache__
-
Del
OK
basestring.py
774 B
Del
OK
olddict.py
2.66 KB
Del
OK
oldstr.py
4.23 KB
Del
OK
Edit: 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']
Save