/usr/lib/python2.7/dist-packages/allauth/compat.py is in python-django-allauth 0.35.0-1.
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 42 43 44 45 | from django.utils import six
try:
from collections import UserDict
except ImportError:
from UserDict import UserDict # noqa
try:
from urllib.parse import parse_qsl, parse_qs, urlparse, urlunparse, urljoin
except ImportError:
from urlparse import parse_qsl, parse_qs, urlparse, urlunparse, urljoin # noqa
def int_to_base36(i):
"""
Django on py2 raises ValueError on large values.
"""
if six.PY2:
char_set = '0123456789abcdefghijklmnopqrstuvwxyz'
if i < 0:
raise ValueError("Negative base36 conversion input.")
if not isinstance(i, six.integer_types):
raise TypeError("Non-integer base36 conversion input.")
if i < 36:
return char_set[i]
b36 = ''
while i != 0:
i, n = divmod(i, 36)
b36 = char_set[n] + b36
else:
from django.utils.http import int_to_base36
b36 = int_to_base36(i)
return b36
def base36_to_int(s):
if six.PY2:
if len(s) > 13:
raise ValueError("Base36 input too large")
value = int(s, 36)
else:
from django.utils.http import base36_to_int
value = base36_to_int(s)
return value
|