From e9f00b4f06a02d20f205c7439839ac16d6e5b41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sat, 4 Jul 2020 13:30:54 +0200 Subject: [PATCH] Update the isort config for version 5.* --- .gitlab-ci.yml | 2 +- .pre-commit.sh | 2 +- cof/settings/bds_prod.py | 4 ++-- cof/settings/cof_prod.py | 4 ++-- cof/settings/local.py | 4 ++-- cof/urls.py | 8 ++++---- gestioncof/apps.py | 1 + kfet/apps.py | 1 + setup.cfg | 1 - 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ef29950..28ab0748 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,7 +63,7 @@ linters: - pip install --upgrade black isort flake8 script: - black --check . - - isort --recursive --check-only --diff bda bds clubs cof events gestioncof kfet petitscours provisioning shared + - isort --check --diff . # Print errors only - flake8 --exit-zero bda bds clubs cof events gestioncof kfet petitscours provisioning shared cache: diff --git a/.pre-commit.sh b/.pre-commit.sh index 0e0e3c1a..abf1fe7d 100755 --- a/.pre-commit.sh +++ b/.pre-commit.sh @@ -48,7 +48,7 @@ if type isort &>/dev/null; then ISORT_OUTPUT="/tmp/gc-isort-output.log" touch $ISORT_OUTPUT - if ! echo "$STAGED_PYTHON_FILES" | xargs -d'\n' isort --check-only &>$ISORT_OUTPUT; then + if ! echo "$STAGED_PYTHON_FILES" | xargs -d'\n' isort --check &>$ISORT_OUTPUT; then echo "$STAGED_PYTHON_FILES" | xargs -d'\n' isort &>$ISORT_OUTPUT printf "Reformatted.\n" formatter_updated=1 diff --git a/cof/settings/bds_prod.py b/cof/settings/bds_prod.py index d674a0a6..65245ad2 100644 --- a/cof/settings/bds_prod.py +++ b/cof/settings/bds_prod.py @@ -2,12 +2,12 @@ Django development settings for the cof project. The settings that are not listed here are imported from .common """ - import os -from .common import * # NOQA from .common import BASE_DIR, INSTALLED_APPS +from .common import * # NOQA + # --- # BDS-only Django settings # --- diff --git a/cof/settings/cof_prod.py b/cof/settings/cof_prod.py index fe60af24..4bca38d2 100644 --- a/cof/settings/cof_prod.py +++ b/cof/settings/cof_prod.py @@ -2,10 +2,8 @@ Django development settings for the cof project. The settings that are not listed here are imported from .common """ - import os -from .common import * # NOQA from .common import ( AUTHENTICATION_BACKENDS, BASE_DIR, @@ -15,6 +13,8 @@ from .common import ( import_secret, ) +from .common import * # NOQA + # --- # COF-specific secrets # --- diff --git a/cof/settings/local.py b/cof/settings/local.py index b0ce5ae1..ee9fc407 100644 --- a/cof/settings/local.py +++ b/cof/settings/local.py @@ -1,11 +1,11 @@ """Django local development settings.""" - import os from . import bds_prod -from .cof_prod import * # NOQA from .cof_prod import BASE_DIR, INSTALLED_APPS, MIDDLEWARE, TESTING +from .cof_prod import * # NOQA + # --- # Merge COF and BDS configs # --- diff --git a/cof/urls.py b/cof/urls.py index 12cf4f5a..0b03f2db 100644 --- a/cof/urls.py +++ b/cof/urls.py @@ -1,7 +1,6 @@ """ Fichier principal de configuration des urls du projet GestioCOF """ - from django.conf import settings from django.conf.urls.i18n import i18n_patterns from django.conf.urls.static import static @@ -20,6 +19,10 @@ urlpatterns = [ ] if "gestioncof" in settings.INSTALLED_APPS: + from django_js_reverse.views import urls_js + from wagtail.admin import urls as wagtailadmin_urls + from wagtail.documents import urls as wagtaildocs_urls + from gestioncof import csv_views, views as gestioncof_views from gestioncof.autocomplete import autocomplete from gestioncof.urls import ( @@ -29,9 +32,6 @@ if "gestioncof" in settings.INSTALLED_APPS: export_patterns, surveys_patterns, ) - from django_js_reverse.views import urls_js - from wagtail.admin import urls as wagtailadmin_urls - from wagtail.documents import urls as wagtaildocs_urls # Also includes BdA, K-FĂȘt, etc. urlpatterns += [ diff --git a/gestioncof/apps.py b/gestioncof/apps.py index 88e2fbfc..0ac33f93 100644 --- a/gestioncof/apps.py +++ b/gestioncof/apps.py @@ -12,6 +12,7 @@ class GestioncofConfig(AppConfig): def register_config(self): import djconfig + from .forms import GestioncofConfigForm djconfig.register(GestioncofConfigForm) diff --git a/kfet/apps.py b/kfet/apps.py index f3c7b07b..2843fd67 100644 --- a/kfet/apps.py +++ b/kfet/apps.py @@ -10,6 +10,7 @@ class KFetConfig(AppConfig): def register_config(self): import djconfig + from kfet.forms import KFetConfigForm djconfig.register(KFetConfigForm) diff --git a/setup.cfg b/setup.cfg index 1a9901cb..995af0a4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,5 +39,4 @@ known_django = django known_first_party = bda,bds,clubs,cof,events,gestioncof,kfet,petitscours,shared line_length = 88 multi_line_output = 3 -not_skip = __init__.py sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER