/usr/lib/python3/dist-packages/webtest/compat.py is in python3-webtest 2.0.14-1ubuntu1.
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 40 41 | # -*- coding: utf-8 -*-
import sys
import six
from six import PY3
from six import text_type
from six.moves import http_cookies
SimpleCookie = http_cookies.SimpleCookie
CookieError = http_cookies.CookieError
def to_bytes(value, charset='latin1'):
if isinstance(value, text_type):
return value.encode(charset)
return value
if PY3: # pragma: no cover
from html.entities import name2codepoint
from urllib.parse import urlencode
from urllib.parse import splittype
from urllib.parse import splithost
import urllib.parse as urlparse
else: # pragma: no cover
from htmlentitydefs import name2codepoint # noqa
from urllib import splittype # noqa
from urllib import splithost # noqa
from urllib import urlencode # noqa
import urlparse # noqa
def print_stderr(value):
if not PY3:
if isinstance(value, text_type):
value = value.encode('utf8')
six.print_(value, file=sys.stderr)
try:
from collections import OrderedDict
except ImportError: # pragma: no cover
from ordereddict import OrderedDict # noqa
|