Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#422)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/psf/black-pre-commit-mirror: 23.12.1 →
24.1.1](psf/black-pre-commit-mirror@23.12.1...24.1.1)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Feb 9, 2024
1 parent d37d450 commit 230eca8
Show file tree
Hide file tree
Showing 34 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/admin_allow_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://docs.djangoproject.com/en/2.0/releases/2.0/#features-removed-in-2-0
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/admin_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
https://docs.djangoproject.com/en/3.2/ref/contrib/admin/actions/#django.contrib.admin.action
https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#django.contrib.admin.display
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/admin_lookup_needs_distinct.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Rename django.contrib.admin.utils.lookup_needs_distinct to lookup_spawns_duplicates:
https://docs.djangoproject.com/en/4.0/releases/4.0/#miscellaneous
"""

from __future__ import annotations

import ast
Expand Down
13 changes: 7 additions & 6 deletions src/django_upgrade/fixers/admin_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace `admin.site.register` with the new `@register` decorator syntax:
https://docs.djangoproject.com/en/stable/releases/1.7/#minor-features
"""

from __future__ import annotations

import ast
Expand Down Expand Up @@ -47,9 +48,9 @@ def __init__(self, parent: ast.AST, lineno: int) -> None:
decorable_admins: MutableMapping[State, dict[str, AdminDetails]] = WeakKeyDictionary()
# Name of site to set of unregistered model names, or True if potentially all
# models have been unregistered
unregistered_site_models: MutableMapping[
State, dict[str, set[str] | Literal[True]]
] = WeakKeyDictionary()
unregistered_site_models: MutableMapping[State, dict[str, set[str] | Literal[True]]] = (
WeakKeyDictionary()
)


def _is_django_admin_imported(state: State) -> bool:
Expand Down Expand Up @@ -265,9 +266,9 @@ def visit_Call(
existing_names.update(unregistered_names)


site_definitions: MutableMapping[
ast.Module, dict[str, int | None]
] = WeakKeyDictionary()
site_definitions: MutableMapping[ast.Module, dict[str, int | None]] = (
WeakKeyDictionary()
)


def get_site_defined_line(module: ast.AST, site_name: str) -> int | None:
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/assert_form_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
https://docs.djangoproject.com/en/4.1/releases/4.1/#tests
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/assert_set_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
capitalized “Set”:
https://docs.djangoproject.com/en/4.2/releases/4.2/#miscellaneous
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/compatibility_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Replace `django.utils.functional.lru_cache` with `functools.lru_cache`
Undocumented change
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/crypto_get_random_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Add the 'length' argument to get_random_string():
https://docs.djangoproject.com/en/3.1/releases/3.1/#features-deprecated-in-3-1
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/default_app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Remove default_app_config:
https://docs.djangoproject.com/en/stable/releases/3.2/#features-deprecated-in-3-2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/django_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Update URL definitions:
https://docs.djangoproject.com/en/2.0/releases/2.0/#simplified-url-routing-syntax
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/email_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Rewrite django.core.validator.EmailValidator arguments:
https://docs.djangoproject.com/en/3.2/releases/3.2/#features-deprecated-in-3-2
"""

from __future__ import annotations

import ast
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace `list` error message key with `list_invalid` for ModelMultipleChoiceField.
https://docs.djangoproject.com/en/3.1/releases/3.1/#id2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace BaseCommand.requires_system_checks boolean flag by list of checks:
https://docs.djangoproject.com/en/stable/releases/3.2/#deprecated-features-3-2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/model_field_choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Drop `.choices` for model field `choices` parameters:
https://docs.djangoproject.com/en/5.0/releases/5.0/#forms
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/null_boolean_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Rewrite django.db.models.NullBooleanField to BooleanField:
https://docs.djangoproject.com/en/3.1/releases/3.1/#features-deprecated-in-3-1
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/on_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Add on_delete=models.CASCADE to ForeignKey and OneToOneField:
https://docs.djangoproject.com/en/stable/releases/1.9/#features-deprecated-in-1-9
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/password_reset_timeout_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
PASSWORD_RESET_TIMEOUT_DAYS setting replaced with PASSWORD_RESET_TIMEOUT:
https://docs.djangoproject.com/en/3.1/releases/3.1/#django-contrib-auth
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/postgres_float_range_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace FloatRangeField with DecimalRangeField:
https://docs.djangoproject.com/en/2.2/releases/2.2/#features-deprecated-in-2-2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/queryset_paginator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Rewrite django.core.paginator’s alias QuerySetPaginator of Paginator:
https://docs.djangoproject.com/en/2.2/releases/2.2/#features-deprecated-in-2-2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/request_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Update use of request.META to fetch headers to use request.headers
https://docs.djangoproject.com/en/2.2/releases/2.2/#requests-and-responses
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/settings_database_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
to the new 'django.db.backends.postgresql'.
https://docs.djangoproject.com/en/2.0/releases/2.0/#id1
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/settings_storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Merge DEFAULT_FILE_STORAGE and STATICFILES_STORAGE into new STORAGES setting:
https://docs.djangoproject.com/en/4.2/releases/4.2/#custom-file-storages
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/signal_providing_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Remove the 'providing_args' argument from Signal():
https://docs.djangoproject.com/en/3.1/releases/3.1/#features-deprecated-in-3-1
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/test_http_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
test Client and RequestFactory:
https://docs.djangoproject.com/en/4.2/releases/4.2/#tests
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/testcase_databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace declarations of database support in test cases:
https://docs.djangoproject.com/en/2.2/releases/2.2/#features-deprecated-in-2-2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/timezone_fixedoffset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Rewrite django.utils.timezone.FixedOffset to datetime.timezone.
https://docs.djangoproject.com/en/2.2/releases/2.2/#features-deprecated-in-2-2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/use_l10n.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
USE_L10N setting is deprecated:
https://docs.djangoproject.com/en/4.0/releases/4.0/#localization
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/utils_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace imports from django.utils.encoding:
https://docs.djangoproject.com/en/3.0/releases/3.0/#django-utils-encoding-force-text-and-smart-text # noqa: E501
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/utils_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace imports from django.utils.http:
https://docs.djangoproject.com/en/3.0/releases/3.0/#features-deprecated-in-3-0
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/utils_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace imports from django.utils.translation:
https://docs.djangoproject.com/en/3.0/releases/3.0/#features-deprecated-in-3-0
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/utils_timezone.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace django.utils.timezone.utc with datetime.timezone.utc
https://docs.djangoproject.com/en/4.1/releases/4.1/#id2
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/utils_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Replace imports from django.utils.translation:
https://docs.djangoproject.com/en/3.0/releases/3.0/#features-deprecated-in-3-0
"""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/django_upgrade/fixers/versioned_branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
else:
...
"""

from __future__ import annotations

import ast
Expand Down

0 comments on commit 230eca8

Please sign in to comment.