GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#68)
by Lambda
01:05
created

isiterable()   A

Complexity

Conditions 2

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
c 2
b 0
f 0
dl 0
loc 2
rs 10
1
# coding=utf-8
2
import django
3
if django.VERSION >= (1, 9):
4
    add_to_builtins = None
5
else:
6
    try:
7
        from django.template.base import add_to_builtins
8
    except ImportError:
9
        from django.template.loader import add_to_builtins
10
11
try:
12
    # django.utils.importlib is removed from Django 1.9
13
    from importlib import import_module
14
except ImportError:
15
    from django.utils.importlib import import_module
16
17
if django.VERSION < (1, 10):
18
    def is_authenticated(user_obj):
19
        return user_obj.is_authenticated()
20
21
    def is_anonyomus(user_obj):
22
        return user_obj.is_anonymous()
23
else:
24
    def is_authenticated(user_obj):
25
        return user_obj.is_authenticated
26
27
    def is_anonyomus(user_obj):
28
        return user_obj.is_anonymous
29
 
30
try:
31
    # Django 1.7 or over use the new application loading system
32
    from django.apps import apps
33
    get_model = apps.get_model
34
except ImportError:
35
    from django.db.models.loading import get_model
36
37
try:
38
    from django.utils.module_loading import import_string
39
except ImportError:
40
    try:
41
        from django.utils.module_loading import import_by_path as import_string
42
    except ImportError:
43
        def import_string(dotted_path):
44
            try:
45
                module_path, class_name = dotted_path.rsplit('.', 1)
46
            except ValueError:
47
                raise ImportError(
48
                    "%s doesn't look like a module path" % dotted_path
49
                )
50
            module = import_module(module_path)
51
            try:
52
                return getattr(module, class_name)
53
            except AttributeError:
54
                raise ImportError(
55
                    'Module "%s" does not define a "%s" attribute/class' % (
56
                        module_path, class_name
57
                    ))
58
59
try:
60
    # Python 3
61
    from urllib.parse import urlparse
62
except ImportError:
63
    # Python 2
64
    from urlparse import urlparse
65
66
import sys
67
if sys.version_info >= (3, 0):
68
    def isstr(x):
69
        return isinstance(x, str)
70
else:
71
    def isstr(x):
72
        return isinstance(x, basestring)
73
74
try:
75
    from django.util import six
76
except ImportError:
77
    # Django 1.2/1.3 does not have six
78
    import six
79