diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ec599db..3701c68f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.2 + rev: v0.3.2 hooks: - id: ruff args: diff --git a/example/example/wsgi.py b/example/example/wsgi.py index 1af2c1b9..938e2be3 100644 --- a/example/example/wsgi.py +++ b/example/example/wsgi.py @@ -13,6 +13,7 @@ framework. """ + import os # This application object is used by any WSGI server configured to use this diff --git a/example/pexp/management/commands/p2cmd.py b/example/pexp/management/commands/p2cmd.py index 77719fdf..e0383420 100644 --- a/example/pexp/management/commands/p2cmd.py +++ b/example/pexp/management/commands/p2cmd.py @@ -2,6 +2,7 @@ This module is a scratchpad for general development, testing & debugging Well, even more so than pcmd.py. You best ignore p2cmd.py. """ + import sys import time from pprint import pprint diff --git a/polymorphic/admin/__init__.py b/polymorphic/admin/__init__.py index 6e33ff4c..48933f1f 100644 --- a/polymorphic/admin/__init__.py +++ b/polymorphic/admin/__init__.py @@ -4,6 +4,7 @@ The admin consists of a parent admin (which shows in the admin with a list), and a child admin (which is used internally to show the edit/delete dialog). """ + # Admins for the regular models from .parentadmin import PolymorphicParentModelAdmin # noqa from .childadmin import PolymorphicChildModelAdmin diff --git a/polymorphic/admin/childadmin.py b/polymorphic/admin/childadmin.py index 5f7f4a69..4474a8b5 100644 --- a/polymorphic/admin/childadmin.py +++ b/polymorphic/admin/childadmin.py @@ -1,6 +1,7 @@ """ The child admin displays the change/delete view of the subclass model. """ + import inspect from django.contrib import admin diff --git a/polymorphic/admin/helpers.py b/polymorphic/admin/helpers.py index bb5b80d7..6ed6a109 100644 --- a/polymorphic/admin/helpers.py +++ b/polymorphic/admin/helpers.py @@ -3,6 +3,7 @@ This makes sure that admin fieldsets/layout settings are exported to the template. """ + import json from django.contrib.admin.helpers import AdminField, InlineAdminForm, InlineAdminFormSet diff --git a/polymorphic/admin/inlines.py b/polymorphic/admin/inlines.py index 39a1f71d..00fd29d2 100644 --- a/polymorphic/admin/inlines.py +++ b/polymorphic/admin/inlines.py @@ -3,6 +3,7 @@ Each row in the inline can correspond with a different subclass. """ + from functools import partial from django.conf import settings diff --git a/polymorphic/admin/parentadmin.py b/polymorphic/admin/parentadmin.py index d021522d..98ec5093 100644 --- a/polymorphic/admin/parentadmin.py +++ b/polymorphic/admin/parentadmin.py @@ -1,6 +1,7 @@ """ The parent admin displays the list view of the base model. """ + from django.contrib import admin from django.contrib.admin.helpers import AdminErrorList, AdminForm from django.contrib.admin.templatetags.admin_urls import add_preserved_filters diff --git a/polymorphic/base.py b/polymorphic/base.py index d6586c17..b1f40253 100644 --- a/polymorphic/base.py +++ b/polymorphic/base.py @@ -1,6 +1,7 @@ """ PolymorphicModel Meta Class """ + import inspect import os import sys diff --git a/polymorphic/contrib/extra_views.py b/polymorphic/contrib/extra_views.py index 831552f5..3762d412 100644 --- a/polymorphic/contrib/extra_views.py +++ b/polymorphic/contrib/extra_views.py @@ -4,6 +4,7 @@ This package provides classes that support both options for polymorphic formsets. """ + import extra_views from django.core.exceptions import ImproperlyConfigured diff --git a/polymorphic/formsets/__init__.py b/polymorphic/formsets/__init__.py index d0229c3c..5531fbdf 100644 --- a/polymorphic/formsets/__init__.py +++ b/polymorphic/formsets/__init__.py @@ -8,6 +8,7 @@ that describes how to display and construct the child. It's parameters are very similar to the parent's factory method. """ + from .generic import ( # Can import generic here, as polymorphic already depends on the 'contenttypes' app. BaseGenericPolymorphicInlineFormSet, GenericPolymorphicFormSetChild, diff --git a/polymorphic/models.py b/polymorphic/models.py index 0569e417..4d8f6937 100644 --- a/polymorphic/models.py +++ b/polymorphic/models.py @@ -1,6 +1,7 @@ """ Seamless Polymorphic Inheritance for Django Models """ + from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.fields.related import ForwardManyToOneDescriptor, ReverseOneToOneDescriptor diff --git a/polymorphic/query.py b/polymorphic/query.py index 5e811611..8e93281a 100644 --- a/polymorphic/query.py +++ b/polymorphic/query.py @@ -1,6 +1,7 @@ """ QuerySet for PolymorphicModel """ + import copy from collections import defaultdict diff --git a/polymorphic/query_translate.py b/polymorphic/query_translate.py index 2abe9174..15a02d4b 100644 --- a/polymorphic/query_translate.py +++ b/polymorphic/query_translate.py @@ -1,6 +1,7 @@ """ PolymorphicQuerySet support functions """ + import copy from collections import deque