Skip to content

Commit

Permalink
🚨(pylint) migrate to pylint 2.16.1
Browse files Browse the repository at this point in the history
Several new rules has added and errors are raised. So we update the codebase
accordingly.

Furthermore, a deprecation warning message appears. We had to update `.pylintrc`
 configuration
  • Loading branch information
jbpenrath committed Feb 14, 2023
1 parent 77c1d3c commit 1cea824
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,4 @@ min-public-methods=0

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
4 changes: 2 additions & 2 deletions src/richie/apps/courses/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,5 @@ def sync_course_runs_from_request(request, version):
sync_course_run(request.data)
except MissingResourceLinkError:
return Response({"resource_link": ["This field is required."]}, status=400)
else:
return Response({"success": True})

return Response({"success": True})
4 changes: 2 additions & 2 deletions src/richie/apps/courses/cms_wizards.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ def parent_page(self):
self.page.category
except models.Category.DoesNotExist:
return super().parent_page
else:
return self.page

return self.page

def save(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/richie/apps/courses/models/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(self, priority, date_time=None):
"call_to_action": self.STATE_CALLS_TO_ACTION[priority],
"text": text,
}
self._d = dict(**kwargs)
self._d = {**kwargs}

def __iter__(self):
"""Iterate on the inner dictionary."""
Expand Down
14 changes: 7 additions & 7 deletions src/richie/apps/courses/templatetags/extra_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ def get_plugins_render_tag(
placeholder = page.placeholders.get(slot=name)
except ObjectDoesNotExist:
return ""
else:
context[varname] = [
cms_plugin.get_plugin_instance()[0]
for cms_plugin in get_plugins(
request, placeholder, template=page.get_template()
)
]

context[varname] = [
cms_plugin.get_plugin_instance()[0]
for cms_plugin in get_plugins(
request, placeholder, template=page.get_template()
)
]

# Default content if there is no plugins in the placeholder
if not context[varname] and nodelist:
Expand Down
4 changes: 2 additions & 2 deletions src/richie/apps/search/filter_definitions/courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def base_page(self):
)
except Page.DoesNotExist:
return None
else:
self._base_page = page

self._base_page = page

return self._base_page

Expand Down
2 changes: 1 addition & 1 deletion src/richie/apps/search/index_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def regenerate_indices(logger):
def perform_aliases_update():
try:
ES_INDICES_CLIENT.update_aliases(
dict(actions=actions_to_create_aliases + actions_to_delete_aliases)
{"actions": actions_to_create_aliases + actions_to_delete_aliases}
)
except RequestError as exception:
# This operation can fail if an index exists with the same name as an alias we're
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/search/test_forms_search_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_forms_items_single_values_in_querystring(self, *_):
on the form should be single values (limit, offset and query).
"""
form = ItemSearchForm(
data=QueryDict(query_string=("limit=9&offset=3&query=maths"))
data=QueryDict(query_string="limit=9&offset=3&query=maths")
)
self.assertTrue(form.is_valid())
self.assertEqual(
Expand Down

0 comments on commit 1cea824

Please sign in to comment.