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.

Code Duplication    Length = 72-74 lines in 2 locations

pyjobs_web/pyjobsweb/controllers/admin.py 2 locations

@@ 20-93 (lines=74) @@
17
    prepare_company_for_validation
18
19
20
class JobGeocodingController(EasyCrudRestController):
21
    __table_options__ = {
22
        '__limit_fields__': ['url', 'id', 'source', 'address',
23
                             'address_is_valid'],
24
        '__field_order__': ['url', 'id', 'source', 'address',
25
                            'address_is_valid'],
26
        '__xml_fields__': ['url'],
27
        'url': lambda filler, row: '<a class="btn btn-default" '
28
                                   'target="_blank" href="%(url)s">'
29
                                   '<span class="glyphicon glyphicon-link">'
30
                                   '</span>'
31
                                   '</a>' % dict(url=row.url),
32
        '__actions__': lambda filler, row:
33
            JobGeocodingController.__actions__(filler, row)
34
    }
35
36
    __form_options__ = {
37
        '__hide_fields__': ['id', 'address_is_valid'],
38
        '__omit_fields__': [
39
            'description', 'company', 'company_url', 'tags',
40
            'publication_datetime', 'title', 'publication_datetime_is_fake',
41
            'crawl_datetime', 'last_modified', 'last_sync', 'url', 'source',
42
            'geolocation_is_valid', 'latitude', 'longitude', 'pushed_on_twitter'
43
        ],
44
        '__field_widget_types__': {
45
            'address': TextField
46
        }
47
    }
48
49
    def __init__(self, session, menu_items=None):
50
        super(JobGeocodingController, self).__init__(session, menu_items)
51
52
    @classmethod
53
    def __actions__(cls, filler, row):
54
        primary_fields = filler.__provider__.get_primary_fields(filler
55
                                                                .__entity__)
56
57
        pklist = '/'.join(map(lambda x: str(getattr(row, x)), primary_fields))
58
59
        value = '''
60
            <a href="%s/edit" class="btn btn-primary">
61
                <span class="glyphicon glyphicon-pencil"></span>
62
            </a>
63
        ''' % pklist
64
65
        return value
66
67
    @expose(inherit=True)
68
    def get_all(self, *args, **kw):
69
        # Since this controller is only meant to fix invalid addresses, we only
70
        # request job offers with invalid addresses.
71
        kw['address_is_valid'] = False
72
        return super(JobGeocodingController, self).get_all(*args, **kw)
73
74
    @expose(inherit=True)
75
    def post_delete(self, *args, **kw):
76
        raise HTTPNotFound()
77
78
    @expose(inherit=True)
79
    def post(self, *args, **kw):
80
        raise HTTPNotFound()
81
82
    @expose(inherit=True)
83
    def new(self, *args, **kwargs):
84
        raise HTTPNotFound()
85
86
    @expose(inherit=True)
87
    def put(self, *args, **kw):
88
        new_model = kw_to_sqlalchemy(model.JobAlchemy, kw)
89
90
        prepare_job_for_address_update(new_model)
91
        kw = sqlalchemy_to_kw(new_model)
92
93
        return EasyCrudRestController.put(self, *args, **kw)
94
95
96
class CompanyGeocodingController(EasyCrudRestController):
@@ 96-167 (lines=72) @@
93
        return EasyCrudRestController.put(self, *args, **kw)
94
95
96
class CompanyGeocodingController(EasyCrudRestController):
97
    __table_options__ = {
98
        '__limit_fields__': ['url', 'id', 'name', 'address',
99
                             'address_is_valid'],
100
        '__field_order__': ['url', 'id', 'name', 'address',
101
                            'address_is_valid'],
102
        '__xml_fields__': ['url'],
103
        'url': lambda filler, row: '<a class="btn btn-default" '
104
                                   'target="_blank" href="%(url)s">'
105
                                   '<span class="glyphicon glyphicon-link">'
106
                                   '</span>'
107
                                   '</a>' % dict(url=row.url),
108
        '__actions__': lambda filler, row:
109
            CompanyGeocodingController.__actions__(filler, row)
110
    }
111
112
    __form_options__ = {
113
        '__hide_fields__': ['id', 'address_is_valid'],
114
        '__omit_fields__': [
115
            'last_modified', 'last_sync', 'name', 'logo_url', 'description',
116
            'url', 'technologies', 'email', 'phone', 'latitude', 'longitude',
117
            'geolocation_is_valid', 'validated'
118
        ],
119
        '__field_widget_types__': {'address': TextField}
120
    }
121
122
    def __init__(self, session, menu_items=None):
123
        super(CompanyGeocodingController, self).__init__(session,
124
                                                         menu_items)
125
126
    @classmethod
127
    def __actions__(cls, filler, row):
128
        primary_fields = filler.__provider__.get_primary_fields(filler
129
                                                                .__entity__)
130
131
        pklist = '/'.join(map(lambda x: str(getattr(row, x)), primary_fields))
132
133
        value = '''
134
            <a href="%s/edit" class="btn btn-primary">
135
                <span class="glyphicon glyphicon-pencil"></span>
136
            </a>
137
        ''' % pklist
138
139
        return value
140
141
    @expose(inherit=True)
142
    def get_all(self, *args, **kw):
143
        # Since this controller is only meant to fix invalid addresses, we only
144
        # request job offers with invalid addresses.
145
        kw['address_is_valid'] = False
146
        return super(CompanyGeocodingController, self).get_all(*args, **kw)
147
148
    @expose(inherit=True)
149
    def post_delete(self, *args, **kw):
150
        raise HTTPNotFound()
151
152
    @expose(inherit=True)
153
    def post(self, *args, **kw):
154
        raise HTTPNotFound()
155
156
    @expose(inherit=True)
157
    def new(self, *args, **kwargs):
158
        raise HTTPNotFound()
159
160
    @expose(inherit=True)
161
    def put(self, *args, **kw):
162
        new_model = kw_to_sqlalchemy(model.CompanyAlchemy, kw)
163
164
        prepare_company_for_address_update(new_model)
165
        kw = sqlalchemy_to_kw(new_model)
166
167
        return EasyCrudRestController.put(self, *args, **kw)
168
169
170
class CompanyModerationController(EasyCrudRestController):