OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
past
/
types
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/14/2024 03:09:55 PM
rwxr-xr-x
📄
__init__.py
879 bytes
10/25/2018 10:21:01 PM
rw-r--r--
📁
__pycache__
-
05/14/2024 03:09:55 PM
rwxr-xr-x
📄
basestring.py
728 bytes
10/25/2018 10:21:01 PM
rw-r--r--
📄
olddict.py
2.66 KB
10/25/2018 10:21:01 PM
rw-r--r--
📄
oldstr.py
4.17 KB
10/25/2018 10:21:01 PM
rw-r--r--
Editing: basestring.py
Close
""" 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']