/usr/lib/python2.7/dist-packages/past/types/basestring.py is in python-future 0.15.2-4ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | """
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']
|