From c8fa5058abb2eca99cfd40a2349127d56212029c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 17:41:26 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- categories/__init__.py | 1 + categories/admin.py | 1 + categories/apps.py | 1 + categories/base.py | 1 + categories/editor/settings.py | 1 + .../editor/templatetags/admin_tree_list_tags.py | 15 +++++++++------ categories/editor/tree_editor.py | 1 + categories/editor/utils.py | 1 + categories/fields.py | 1 + categories/genericcollection.py | 1 + .../management/commands/add_category_fields.py | 1 + .../management/commands/drop_category_field.py | 1 + categories/migration.py | 1 + categories/models.py | 1 + categories/registration.py | 1 + categories/settings.py | 1 + categories/templatetags/category_tags.py | 1 + categories/urls.py | 1 + categories/views.py | 1 + example/settings.py | 1 + example/simpletext/admin.py | 1 + example/simpletext/models.py | 1 + example/urls.py | 1 + 23 files changed, 31 insertions(+), 6 deletions(-) diff --git a/categories/__init__.py b/categories/__init__.py index f7bcb46c..414ef75b 100644 --- a/categories/__init__.py +++ b/categories/__init__.py @@ -1,4 +1,5 @@ """Django categories.""" + __version__ = "1.9.2" diff --git a/categories/admin.py b/categories/admin.py index 19740221..e8a4d64f 100644 --- a/categories/admin.py +++ b/categories/admin.py @@ -1,4 +1,5 @@ """Admin interface classes.""" + from django import forms from django.contrib import admin from django.utils.translation import gettext_lazy as _ diff --git a/categories/apps.py b/categories/apps.py index 5f583855..fb2a37e3 100644 --- a/categories/apps.py +++ b/categories/apps.py @@ -1,4 +1,5 @@ """Django application setup.""" + from django.apps import AppConfig diff --git a/categories/base.py b/categories/base.py index 756ff13f..7b795e2b 100644 --- a/categories/base.py +++ b/categories/base.py @@ -3,6 +3,7 @@ It provides customizable metadata and its own name space. """ + from django import forms from django.contrib import admin from django.db import models diff --git a/categories/editor/settings.py b/categories/editor/settings.py index fd2c1447..797d52cf 100644 --- a/categories/editor/settings.py +++ b/categories/editor/settings.py @@ -1,4 +1,5 @@ """Settings management for the editor.""" + from django.conf import settings STATIC_URL = getattr(settings, "STATIC_URL", settings.MEDIA_URL) diff --git a/categories/editor/templatetags/admin_tree_list_tags.py b/categories/editor/templatetags/admin_tree_list_tags.py index 46324845..9125774c 100644 --- a/categories/editor/templatetags/admin_tree_list_tags.py +++ b/categories/editor/templatetags/admin_tree_list_tags.py @@ -1,4 +1,5 @@ """Template tags used to render the tree editor.""" + from django.contrib.admin.templatetags.admin_list import _boolean_icon, result_headers from django.contrib.admin.utils import lookup_field from django.core.exceptions import ObjectDoesNotExist @@ -89,12 +90,14 @@ def items_for_tree_result(cl, result, form): table_tag, row_class, url, - format_html( - ' onclick="opener.dismissRelatedLookupPopup(window, ' ''{}'); return false;"', - result_id, - ) - if cl.is_popup - else "", + ( + format_html( + ' onclick="opener.dismissRelatedLookupPopup(window, ' ''{}'); return false;"', + result_id, + ) + if cl.is_popup + else "" + ), result_repr, table_tag, ) diff --git a/categories/editor/tree_editor.py b/categories/editor/tree_editor.py index 2673c007..c9c07d81 100644 --- a/categories/editor/tree_editor.py +++ b/categories/editor/tree_editor.py @@ -1,4 +1,5 @@ """Classes for representing tree structures in Django's admin.""" + from typing import Any import django diff --git a/categories/editor/utils.py b/categories/editor/utils.py index 3ce01651..877d86ea 100644 --- a/categories/editor/utils.py +++ b/categories/editor/utils.py @@ -1,6 +1,7 @@ """ Provides compatibility with Django 1.8. """ + from django.contrib.admin.utils import display_for_field as _display_for_field diff --git a/categories/fields.py b/categories/fields.py index 12f254e7..1f44d1ff 100644 --- a/categories/fields.py +++ b/categories/fields.py @@ -1,4 +1,5 @@ """Custom category fields for other models.""" + from django.db.models import ForeignKey, ManyToManyField diff --git a/categories/genericcollection.py b/categories/genericcollection.py index 7eab863d..767c6b17 100644 --- a/categories/genericcollection.py +++ b/categories/genericcollection.py @@ -1,4 +1,5 @@ """Special helpers for generic collections.""" + import json from django.contrib import admin diff --git a/categories/management/commands/add_category_fields.py b/categories/management/commands/add_category_fields.py index ebba247f..97be142b 100644 --- a/categories/management/commands/add_category_fields.py +++ b/categories/management/commands/add_category_fields.py @@ -1,4 +1,5 @@ """The add_category_fields command.""" + from django.core.management.base import BaseCommand diff --git a/categories/management/commands/drop_category_field.py b/categories/management/commands/drop_category_field.py index 77837ac0..3b3cdcf7 100644 --- a/categories/management/commands/drop_category_field.py +++ b/categories/management/commands/drop_category_field.py @@ -1,4 +1,5 @@ """Alter one or more models' tables with the registered attributes.""" + from django.core.management.base import BaseCommand, CommandError diff --git a/categories/migration.py b/categories/migration.py index 1561b312..e4f3ef60 100644 --- a/categories/migration.py +++ b/categories/migration.py @@ -1,4 +1,5 @@ """Adds and removes category relations on the database.""" + from django.apps import apps from django.db import DatabaseError, connection, transaction from django.db.utils import OperationalError, ProgrammingError diff --git a/categories/models.py b/categories/models.py index dcd96744..f1c23fa5 100644 --- a/categories/models.py +++ b/categories/models.py @@ -1,4 +1,5 @@ """Category models.""" + from functools import reduce from django.contrib.contenttypes.fields import GenericForeignKey diff --git a/categories/registration.py b/categories/registration.py index 1df28707..13d84e25 100644 --- a/categories/registration.py +++ b/categories/registration.py @@ -1,6 +1,7 @@ """ These functions handle the adding of fields to other models. """ + from typing import Optional, Type, Union from collections.abc import Iterable diff --git a/categories/settings.py b/categories/settings.py index 896a265d..fd76ca4e 100644 --- a/categories/settings.py +++ b/categories/settings.py @@ -1,4 +1,5 @@ """Manages settings for the categories application.""" + import collections from django.conf import settings diff --git a/categories/templatetags/category_tags.py b/categories/templatetags/category_tags.py index cc4a5798..1c57cd7c 100644 --- a/categories/templatetags/category_tags.py +++ b/categories/templatetags/category_tags.py @@ -1,4 +1,5 @@ """Template tags for categories.""" + from typing import Any, Type, Union from django import template diff --git a/categories/urls.py b/categories/urls.py index a7eaa0de..1320bd28 100644 --- a/categories/urls.py +++ b/categories/urls.py @@ -1,4 +1,5 @@ """URL patterns for the categories app.""" + from django.urls import path, re_path from django.views.generic import ListView diff --git a/categories/views.py b/categories/views.py index 9ec620e8..55940b0d 100644 --- a/categories/views.py +++ b/categories/views.py @@ -1,4 +1,5 @@ """View functions for categories.""" + from typing import Optional from django.http import Http404, HttpResponse diff --git a/example/settings.py b/example/settings.py index 5bc6203a..53a9c3a2 100644 --- a/example/settings.py +++ b/example/settings.py @@ -1,4 +1,5 @@ """Django settings for sample project.""" + import os import sys diff --git a/example/simpletext/admin.py b/example/simpletext/admin.py index 2d128156..dc4545ed 100644 --- a/example/simpletext/admin.py +++ b/example/simpletext/admin.py @@ -1,4 +1,5 @@ """Admin interface for simple text.""" + from django.contrib import admin from categories.admin import CategoryBaseAdmin, CategoryBaseAdminForm diff --git a/example/simpletext/models.py b/example/simpletext/models.py index 7d017203..aed1611c 100644 --- a/example/simpletext/models.py +++ b/example/simpletext/models.py @@ -1,4 +1,5 @@ """Example model.""" + from django.db import models from categories.base import CategoryBase diff --git a/example/urls.py b/example/urls.py index 615b8b72..a2524f9c 100644 --- a/example/urls.py +++ b/example/urls.py @@ -1,4 +1,5 @@ """URL patterns for the example project.""" + import os from django.conf.urls import include