From b2cae16edc91d921b1d3ea056fec18f88e527300 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:02:20 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/conf.py | 2 +- example_extension_project/config/urls.py | 1 + example_extension_project/user_extension/admin.py | 1 + example_extension_project/user_extension/apps.py | 1 + example_extension_project/user_extension/factories.py | 1 + example_extension_project/user_extension/models.py | 1 + example_extension_project/user_extension/tests.py | 1 + example_integration_project/config/urls.py | 1 + example_integration_project/user_integration/apps.py | 1 + example_integration_project/user_integration/tests.py | 1 + example_replacement_project/config/urls.py | 1 + example_replacement_project/user_replacement/apps.py | 1 + example_replacement_project/user_replacement/models.py | 1 + example_replacement_project/user_replacement/tests.py | 1 + src/improved_user/__init__.py | 1 + src/improved_user/admin.py | 1 + src/improved_user/apps.py | 1 + src/improved_user/factories.py | 1 + src/improved_user/forms.py | 1 + src/improved_user/managers.py | 1 + src/improved_user/model_mixins.py | 1 + src/improved_user/models.py | 1 + tests/test_admin.py | 1 + tests/test_auth_backends.py | 1 + tests/test_basic.py | 1 + tests/test_factories.py | 1 + tests/test_forms.py | 7 ++++--- tests/test_management.py | 1 + tests/test_managers.py | 1 + tests/test_models.py | 1 + tests/test_signals.py | 1 + 31 files changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ef4a0cb..e31bb54 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -302,4 +302,4 @@ def setup(app): # -- Linkcheck configuration ----------------------------------------------- -linkcheck_ignore = [re.compile(r'https://djangopackages\.org/.*')] +linkcheck_ignore = [re.compile(r"https://djangopackages\.org/.*")] diff --git a/example_extension_project/config/urls.py b/example_extension_project/config/urls.py index 0d381b4..f4381ab 100644 --- a/example_extension_project/config/urls.py +++ b/example_extension_project/config/urls.py @@ -1,4 +1,5 @@ """Extension project URL Configuration""" + from django.contrib import admin try: diff --git a/example_extension_project/user_extension/admin.py b/example_extension_project/user_extension/admin.py index 497f889..b8e313a 100644 --- a/example_extension_project/user_extension/admin.py +++ b/example_extension_project/user_extension/admin.py @@ -1,4 +1,5 @@ """Demonstrate use of UserAdmin on extended User model""" + from django.contrib import admin from django.contrib.auth import get_user_model diff --git a/example_extension_project/user_extension/apps.py b/example_extension_project/user_extension/apps.py index 24cc5d7..a1fff6a 100644 --- a/example_extension_project/user_extension/apps.py +++ b/example_extension_project/user_extension/apps.py @@ -1,4 +1,5 @@ """Application Definition File""" + from django.apps import AppConfig diff --git a/example_extension_project/user_extension/factories.py b/example_extension_project/user_extension/factories.py index cef92bf..ab87a2c 100644 --- a/example_extension_project/user_extension/factories.py +++ b/example_extension_project/user_extension/factories.py @@ -3,6 +3,7 @@ Demonstrated here to ensure that Improved User Factory can be subclassed. """ + from factory import Faker from improved_user.factories import UserFactory as BaseUserFactory diff --git a/example_extension_project/user_extension/models.py b/example_extension_project/user_extension/models.py index 51d055b..f629d6a 100644 --- a/example_extension_project/user_extension/models.py +++ b/example_extension_project/user_extension/models.py @@ -1,4 +1,5 @@ """Demonstration of how to extend the Improved User model""" + from django.db import models from django.utils.translation import gettext_lazy as _ diff --git a/example_extension_project/user_extension/tests.py b/example_extension_project/user_extension/tests.py index 94824e9..b757c6c 100644 --- a/example_extension_project/user_extension/tests.py +++ b/example_extension_project/user_extension/tests.py @@ -1,4 +1,5 @@ """Tests to ensure proper subclassing of models, forms, and factories""" + from unittest.mock import patch from django.contrib.auth import get_user_model diff --git a/example_integration_project/config/urls.py b/example_integration_project/config/urls.py index 4b84f3e..a8d525a 100644 --- a/example_integration_project/config/urls.py +++ b/example_integration_project/config/urls.py @@ -1,4 +1,5 @@ """Integration project URL Configuration""" + from django.contrib import admin from django.urls import re_path from django.views.generic import TemplateView diff --git a/example_integration_project/user_integration/apps.py b/example_integration_project/user_integration/apps.py index 252ece5..8e5d9c5 100644 --- a/example_integration_project/user_integration/apps.py +++ b/example_integration_project/user_integration/apps.py @@ -1,4 +1,5 @@ """Application Definition File""" + from django.apps import AppConfig diff --git a/example_integration_project/user_integration/tests.py b/example_integration_project/user_integration/tests.py index e8dd786..e3878db 100644 --- a/example_integration_project/user_integration/tests.py +++ b/example_integration_project/user_integration/tests.py @@ -2,6 +2,7 @@ This test suite is legacy, and will be replaced in the near future. """ + from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse diff --git a/example_replacement_project/config/urls.py b/example_replacement_project/config/urls.py index 26b91f3..29362f3 100644 --- a/example_replacement_project/config/urls.py +++ b/example_replacement_project/config/urls.py @@ -1,4 +1,5 @@ """Replacement project URL Configuration""" + from django.contrib import admin try: diff --git a/example_replacement_project/user_replacement/apps.py b/example_replacement_project/user_replacement/apps.py index 8fa9683..7b6888d 100644 --- a/example_replacement_project/user_replacement/apps.py +++ b/example_replacement_project/user_replacement/apps.py @@ -1,4 +1,5 @@ """Application Definition File""" + from django.apps import AppConfig diff --git a/example_replacement_project/user_replacement/models.py b/example_replacement_project/user_replacement/models.py index 01497ce..2ada18c 100644 --- a/example_replacement_project/user_replacement/models.py +++ b/example_replacement_project/user_replacement/models.py @@ -1,4 +1,5 @@ """A User model created by django-improved-user mixins""" + from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin from django.utils.translation import gettext_lazy as _ diff --git a/example_replacement_project/user_replacement/tests.py b/example_replacement_project/user_replacement/tests.py index bc7ffae..8367784 100644 --- a/example_replacement_project/user_replacement/tests.py +++ b/example_replacement_project/user_replacement/tests.py @@ -1,4 +1,5 @@ """Tests for the extended User model""" + from types import MethodType from django.test import TestCase diff --git a/src/improved_user/__init__.py b/src/improved_user/__init__.py index b5138a4..f2ebf41 100644 --- a/src/improved_user/__init__.py +++ b/src/improved_user/__init__.py @@ -1,4 +1,5 @@ """Compose new Django User models that follow best-practices for international names and authenticate via email instead of username.""" + # This file: # 1. define directory as module # 2. set default app config diff --git a/src/improved_user/admin.py b/src/improved_user/admin.py index ceb9ddc..2fba14b 100644 --- a/src/improved_user/admin.py +++ b/src/improved_user/admin.py @@ -1,4 +1,5 @@ """Admin Configuration for Improved User""" + from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.utils.translation import gettext_lazy as _ diff --git a/src/improved_user/apps.py b/src/improved_user/apps.py index 77fbdaa..94a924a 100644 --- a/src/improved_user/apps.py +++ b/src/improved_user/apps.py @@ -1,4 +1,5 @@ """App Configuration for Improved User""" + from django.apps import AppConfig from django.contrib import admin from django.contrib.auth import get_user_model diff --git a/src/improved_user/factories.py b/src/improved_user/factories.py index 89ef321..fad4c30 100644 --- a/src/improved_user/factories.py +++ b/src/improved_user/factories.py @@ -1,4 +1,5 @@ """Factories to make testing with Improved User easier""" + from django.contrib.auth import get_user_model try: diff --git a/src/improved_user/forms.py b/src/improved_user/forms.py index a2111f9..2ce8d18 100644 --- a/src/improved_user/forms.py +++ b/src/improved_user/forms.py @@ -1,4 +1,5 @@ """Forms for Creating and Updating Improved Users""" + from django import forms from django.contrib.auth import get_user_model, password_validation from django.contrib.auth.forms import ReadOnlyPasswordHashField diff --git a/src/improved_user/managers.py b/src/improved_user/managers.py index 7c98b30..73e1ed4 100644 --- a/src/improved_user/managers.py +++ b/src/improved_user/managers.py @@ -1,4 +1,5 @@ """User Manager used by Improved User; may be extended""" + from django.contrib.auth.models import BaseUserManager diff --git a/src/improved_user/model_mixins.py b/src/improved_user/model_mixins.py index 86e1c43..5c221ce 100644 --- a/src/improved_user/model_mixins.py +++ b/src/improved_user/model_mixins.py @@ -1,4 +1,5 @@ """Mix-in Classes intended for use with Django Models""" + from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin from django.core.mail import send_mail from django.db import models diff --git a/src/improved_user/models.py b/src/improved_user/models.py index 114a379..0bba6f5 100644 --- a/src/improved_user/models.py +++ b/src/improved_user/models.py @@ -5,6 +5,7 @@ The UserManager is found in managers.py """ + from .model_mixins import AbstractUser diff --git a/tests/test_admin.py b/tests/test_admin.py index f9c4bc1..2ed7faf 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -1,4 +1,5 @@ """Test Admin interface provided by Improved User""" + import os import re diff --git a/tests/test_auth_backends.py b/tests/test_auth_backends.py index f40e2a0..6f93a41 100644 --- a/tests/test_auth_backends.py +++ b/tests/test_auth_backends.py @@ -1,4 +1,5 @@ """Test Improved User against Django's default backend""" + # pylint: disable=protected-access from unittest.mock import patch diff --git a/tests/test_basic.py b/tests/test_basic.py index 1df5ae2..901a193 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1,4 +1,5 @@ """Test basic functionality; test API used by a Django project developer""" + from django.contrib.auth import get_user, get_user_model from django.http import HttpRequest from django.test import TestCase diff --git a/tests/test_factories.py b/tests/test_factories.py index 3b70d3e..bf888fa 100644 --- a/tests/test_factories.py +++ b/tests/test_factories.py @@ -1,4 +1,5 @@ """Test model factories provided by Improved User""" + from django.test import TestCase from improved_user.factories import UserFactory diff --git a/tests/test_forms.py b/tests/test_forms.py index e73d0db..6ea0b9f 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -1,4 +1,5 @@ """Test UserCreationForm and UserChangeForm""" + from unittest.mock import patch from django import VERSION as DJANGO_VERSION @@ -269,9 +270,9 @@ class MyUserForm(UserChangeForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.fields[ - "groups" - ].help_text = "These groups give users different permissions" + self.fields["groups"].help_text = ( + "These groups give users different permissions" + ) class Meta(UserChangeForm.Meta): fields = ("groups",) diff --git a/tests/test_management.py b/tests/test_management.py index 722c764..7cd31db 100644 --- a/tests/test_management.py +++ b/tests/test_management.py @@ -1,4 +1,5 @@ """Test User model management commands""" + import builtins from io import StringIO diff --git a/tests/test_managers.py b/tests/test_managers.py index 516e059..e3ac2af 100644 --- a/tests/test_managers.py +++ b/tests/test_managers.py @@ -1,4 +1,5 @@ """Test User model manager""" + from datetime import datetime from django.test import TestCase diff --git a/tests/test_models.py b/tests/test_models.py index e17c9dd..0fcc22a 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,4 +1,5 @@ """Test Improved User Model""" + from datetime import datetime from types import MethodType from unittest.mock import patch diff --git a/tests/test_signals.py b/tests/test_signals.py index 9840eb6..034f2d8 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -1,4 +1,5 @@ """Test Signal Handling""" + from django.db.models.signals import post_save from django.test import TestCase