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 (#72)
by Kohki
01:04
created

is_anonyomus()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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