From 75cd4fc8e3ee9a47bb88b65813a3446b4ed0c2f3 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 11 Jun 2025 16:46:28 +0100 Subject: [PATCH] Removed default value for app_configs in system check functions. The documentation[0] encourages users to write functions without a default for `app_configs`, and checks are always passed the argument. [0] https://docs.djangoproject.com/en/5.2/topics/checks/ --- django/contrib/auth/checks.py | 4 ++-- django/contrib/contenttypes/checks.py | 4 ++-- django/contrib/staticfiles/checks.py | 4 ++-- django/core/checks/model_checks.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/django/contrib/auth/checks.py b/django/contrib/auth/checks.py index f2f9a74a6c..cf23c51746 100644 --- a/django/contrib/auth/checks.py +++ b/django/contrib/auth/checks.py @@ -25,7 +25,7 @@ def _subclass_index(class_path, candidate_paths): return -1 -def check_user_model(app_configs=None, **kwargs): +def check_user_model(app_configs, **kwargs): if app_configs is None: cls = apps.get_model(settings.AUTH_USER_MODEL) else: @@ -121,7 +121,7 @@ def check_user_model(app_configs=None, **kwargs): return errors -def check_models_permissions(app_configs=None, **kwargs): +def check_models_permissions(app_configs, **kwargs): if app_configs is None: models = apps.get_models() else: diff --git a/django/contrib/contenttypes/checks.py b/django/contrib/contenttypes/checks.py index 753c5d22f8..aae9dcb31b 100644 --- a/django/contrib/contenttypes/checks.py +++ b/django/contrib/contenttypes/checks.py @@ -4,7 +4,7 @@ from django.apps import apps from django.core.checks import Error -def check_generic_foreign_keys(app_configs=None, **kwargs): +def check_generic_foreign_keys(app_configs, **kwargs): from .fields import GenericForeignKey if app_configs is None: @@ -25,7 +25,7 @@ def check_generic_foreign_keys(app_configs=None, **kwargs): return errors -def check_model_name_lengths(app_configs=None, **kwargs): +def check_model_name_lengths(app_configs, **kwargs): if app_configs is None: models = apps.get_models() else: diff --git a/django/contrib/staticfiles/checks.py b/django/contrib/staticfiles/checks.py index 06b87c281c..da13b63e7b 100644 --- a/django/contrib/staticfiles/checks.py +++ b/django/contrib/staticfiles/checks.py @@ -8,7 +8,7 @@ E005 = Error( ) -def check_finders(app_configs=None, **kwargs): +def check_finders(app_configs, **kwargs): """Check all registered staticfiles finders.""" errors = [] for finder in get_finders(): @@ -21,7 +21,7 @@ def check_finders(app_configs=None, **kwargs): return errors -def check_storages(app_configs=None, **kwargs): +def check_storages(app_configs, **kwargs): """Ensure staticfiles is defined in STORAGES setting.""" errors = [] if STATICFILES_STORAGE_ALIAS not in settings.STORAGES: diff --git a/django/core/checks/model_checks.py b/django/core/checks/model_checks.py index 7a5bef9b26..2b9a7e77d5 100644 --- a/django/core/checks/model_checks.py +++ b/django/core/checks/model_checks.py @@ -9,7 +9,7 @@ from django.core.checks import Error, Tags, Warning, register @register(Tags.models) -def check_all_models(app_configs=None, **kwargs): +def check_all_models(app_configs, **kwargs): db_table_models = defaultdict(list) indexes = defaultdict(list) constraints = defaultdict(list) @@ -223,5 +223,5 @@ def _check_lazy_references(apps, ignore=None): @register(Tags.models) -def check_lazy_references(app_configs=None, **kwargs): +def check_lazy_references(app_configs, **kwargs): return _check_lazy_references(apps)