Skip to content

Commit

Permalink
🚨(back) lint code with black 24.1.1
Browse files Browse the repository at this point in the history
Black linter version 24.1.1 has new style rules. We have to reformat the
code using these new rules.
  • Loading branch information
lunika authored and jbpenrath committed Jan 31, 2024
1 parent 9be3bef commit 81c01f6
Show file tree
Hide file tree
Showing 268 changed files with 411 additions and 97 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Customizing Django storage backends to enable blue/green deployments."""

import re
from collections import OrderedDict

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test cnfpt configuration."""

from unittest import mock

from django.conf import settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test demo views."""

from django.test import TestCase

from lxml import etree # nosec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Django settings for the richie {{cookiecutter.site}} project.
"""

import json
import os

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
{{cookiecutter.site}} urls
"""

from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
Expand Down
1 change: 1 addition & 0 deletions gitlint/gitlint_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Gitlint extra rule to validate that the message title is of the form
"<gitmoji>(<scope>) <subject>"
"""

from __future__ import unicode_literals

import re
Expand Down
1 change: 1 addition & 0 deletions sandbox/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Django settings for richie project.
"""

import json
import os

Expand Down
1 change: 1 addition & 0 deletions sandbox/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
FUN CMS urls
"""

from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
Expand Down
1 change: 1 addition & 0 deletions src/richie/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Richie: a FUN portal for Open edX
"""

from importlib_metadata import version


Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for admin classes."""

from django.urls import reverse
from django.utils.html import format_html

Expand Down
7 changes: 4 additions & 3 deletions src/richie/apps/core/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Template context processors
"""

import json
from collections import OrderedDict
from urllib.parse import urlparse
Expand Down Expand Up @@ -126,9 +127,9 @@ def site_metas(request: HttpRequest):
context["FRONTEND_CONTEXT"] = json.dumps(context["FRONTEND_CONTEXT"])

if getattr(settings, "RICHIE_MINIMUM_COURSE_RUNS_ENROLLMENT_COUNT", None):
context[
"RICHIE_MINIMUM_COURSE_RUNS_ENROLLMENT_COUNT"
] = settings.RICHIE_MINIMUM_COURSE_RUNS_ENROLLMENT_COUNT
context["RICHIE_MINIMUM_COURSE_RUNS_ENROLLMENT_COUNT"] = (
settings.RICHIE_MINIMUM_COURSE_RUNS_ENROLLMENT_COUNT
)

return context

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Default settings for the core app of Richie."""

from django.conf import global_settings, settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import lazy
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/factories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Core factories
"""

import io
import os
import random
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/fields/duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A custom field that defines a duration as a number of pre-defined time units
(e.g 1 hour, 5 hours or 3 days)
"""

from django import forms
from django.core import checks, exceptions
from django.db import models
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/fields/effort.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A custom field that defines efforts as a number of pre-defined time units per reference time unit
(e.g 2 hours/day, 5 hours/week or 3 days/months).
"""

from django import forms
from django.core import checks, exceptions
from django.db import models
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/fields/multiselect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A multi select field where the array of values is stored as a comma separated string."""

from django.core import checks, exceptions, validators
from django.db import models
from django.forms import MultipleChoiceField, widgets
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Helpers that can be useful throughout the whole project
"""

from functools import reduce
from operator import or_

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Define a custom manager for page extensions"""

from django.apps import apps
from django.db import models
from django.utils import translation
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/templatetags/feature_flags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom template tags related to FEATURES settings."""

from django import template
from django.conf import settings

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/templatetags/joanie.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom template tags related to Joanie."""

from django import template

from richie.apps.courses.lms import LMSHandler
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/templatetags/language_name.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Simple tag related with language and i18n."""

from django import template
from django.conf import settings
from django.utils import translation
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/templatetags/rfc_5646_locale.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom template tags for the search application of Richie."""

from django import template
from django.core.exceptions import ImproperlyConfigured

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Useful stuff for testing
"""

from cms.test_utils.testcases import CMSTestCase


Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/core/views/error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Error views"""

from django.shortcuts import render
from django.utils.translation import gettext_lazy as _

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Courses application admin
"""

from itertools import chain
from operator import itemgetter

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
API endpoints for the courses app.
"""

from django.conf import settings
from django.db.models import Q

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/cms_toolbars.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Toolbar extension for the courses application
"""

from django.utils.text import capfirst
from django.utils.translation import gettext_lazy as _

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/cms_wizards.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
CMS Wizard to add a course page
"""

from django import forms
from django.conf import settings
from django.core import validators
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/defaults.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Settings specific to the courses application.
"""

from django.conf import settings
from django.utils.translation import gettext_lazy as _

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/factories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Courses factories
"""

import random
from collections import namedtuple
from datetime import datetime, timedelta
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Custom fields for the course application
"""

from datetime import datetime, time

from django.forms import SplitDateTimeField
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Helpers that can be useful throughout Richie's courses app
"""

from django.core.exceptions import PermissionDenied
from django.utils import timezone
from django.utils.text import slugify
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/lms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""LMS handler to select and return the right LMS backend for each url."""

import re

from django.conf import settings
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/lms/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Base backend to connect richie with an LMS
"""

from django.conf import settings

from ..models.course import CourseRunSyncMode
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/lms/edx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Backend to connect Open edX richie with an LMS
"""

import logging
import re

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/lms/joanie.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Backend to connect Richie with Joanie
"""

import re

from .base import BaseLMSBackend
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/management/commands/richie_init.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create_demo_site management command."""

import logging

from django.contrib.sites.models import Site
Expand Down
8 changes: 5 additions & 3 deletions src/richie/apps/courses/migrations/0031_auto_20210811_1234.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ def normalize_course_code(apps, schema_editor):

for course in Course.objects.only("id", "code").iterator():
Course.objects.filter(id=course.id).update(
code=slugify(course.code, allow_unicode=True).upper()
if course.code
else None
code=(
slugify(course.code, allow_unicode=True).upper()
if course.code
else None
)
)


Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Make models.py a module containing one file per model as it was getting too long."""

# flake8: noqa
# pylint: disable=wildcard-import

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/blog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Declare and configure the models for the blog part
"""

from django.db import models
from django.utils import translation
from django.utils.translation import gettext_lazy as _
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/category.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Declare and configure the models for the courses application
"""

from django.conf import settings
from django.db import models
from django.utils.translation import gettext_lazy as _
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/course.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Declare and configure the models for the courses application
"""

# pylint: disable=too-many-lines
from collections.abc import Mapping
from datetime import MAXYEAR, datetime
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/organization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Declare and configure the models for the courses application
"""

from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/person.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Declare and configure the model for the person application
"""

from django.db import models
from django.utils.translation import gettext_lazy as _

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/program.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Declare and configure the models for the program part
"""

from django.db import models
from django.utils.translation import gettext_lazy as _

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/models/role.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Declare and configure the models for the courses application
"""

from django.contrib.auth.models import Group
from django.db import models
from django.utils.translation import gettext_lazy as _
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Serializers for Richie's courses app."""

from django.utils.functional import lazy

from rest_framework import serializers
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class MyConfiguration(RichieCoursesConfigurationMixin, Configuration):
from richie.apps.courses.settings import *
```
"""

from django.utils.translation import gettext_lazy as _


Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/settings/mixins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Django Configuration mixins for the Richie courses app."""

from configurations.utils import uppercase_attributes

from .. import settings
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/templatetags/category_tags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Richie template tags to manipulate categories."""

from django import template
from django.utils import translation

Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/templatetags/extra_tags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom template tags for the courses application of Richie."""

import json

from django import template
Expand Down
1 change: 1 addition & 0 deletions src/richie/apps/courses/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
API routes exposed by our Courses app.
"""

from django.urls import path, re_path

from rest_framework import routers
Expand Down
Loading

0 comments on commit 81c01f6

Please sign in to comment.