diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b705f9d..6a121e10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,16 +24,22 @@ exclude: | repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.1 + rev: v0.9.9 hooks: # Run the linter, and only the linter - id: ruff - repo: https://github.com/adamchainz/django-upgrade - rev: 1.22.2 + rev: 1.23.1 hooks: - id: django-upgrade - args: [--target-version=4.2] + args: [--target-version=5.1] + + - repo: https://github.com/asottile/pyupgrade # Ruff doesnt get everything. + rev: v3.19.1 + hooks: + - id: pyupgrade + args: [--py310-plus] # Formatting - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/allianceauth/authentication/models.py b/allianceauth/authentication/models.py index dd22883d..e1fb30e9 100644 --- a/allianceauth/authentication/models.py +++ b/allianceauth/authentication/models.py @@ -126,7 +126,7 @@ class UserProfile(models.Model): self.save(update_fields=['state']) notify( self.user, - _('State changed to: {}'.format(state)), + _(f'State changed to: {state}'), _('Your user\'s state is now: %(state)s') % ({'state': state}), 'info' diff --git a/allianceauth/authentication/tests/test_signals.py b/allianceauth/authentication/tests/test_signals.py index 3336677e..95e7fb9a 100644 --- a/allianceauth/authentication/tests/test_signals.py +++ b/allianceauth/authentication/tests/test_signals.py @@ -1,4 +1,3 @@ - from django.db.models.signals import post_save from django.test.testcases import TestCase diff --git a/allianceauth/authentication/views.py b/allianceauth/authentication/views.py index ba311cfa..b5983a27 100644 --- a/allianceauth/authentication/views.py +++ b/allianceauth/authentication/views.py @@ -175,9 +175,9 @@ def add_character(request, token): if CharacterOwnership.objects.filter(character__character_id=token.character_id).filter( owner_hash=token.character_owner_hash).filter(user=request.user).exists(): messages.success(request, _( - 'Added {name} to your account.'.format(name=token.character_name))) + f'Added {token.character_name} to your account.')) else: - messages.error(request, _('Failed to add {name} to your account: they already have an account.'.format(name=token.character_name))) + messages.error(request, _(f'Failed to add {token.character_name} to your account: they already have an account.')) return redirect('authentication:dashboard') diff --git a/allianceauth/groupmanagement/models.py b/allianceauth/groupmanagement/models.py index 23bba04b..39e93d32 100644 --- a/allianceauth/groupmanagement/models.py +++ b/allianceauth/groupmanagement/models.py @@ -1,5 +1,3 @@ - - from django.conf import settings from django.contrib.auth.models import Group, User from django.db import models diff --git a/allianceauth/hrapplications/managers.py b/allianceauth/hrapplications/managers.py index 4e41e5c9..3a2abeea 100644 --- a/allianceauth/hrapplications/managers.py +++ b/allianceauth/hrapplications/managers.py @@ -1,4 +1,3 @@ - from django.contrib.auth.models import User from django.db import models diff --git a/allianceauth/services/modules/openfire/views.py b/allianceauth/services/modules/openfire/views.py index c22f62ab..925eb8b9 100644 --- a/allianceauth/services/modules/openfire/views.py +++ b/allianceauth/services/modules/openfire/views.py @@ -112,7 +112,7 @@ def jabber_broadcast_view(request): OpenfireManager.send_broadcast_message(group_to_send, message_to_send) - messages.success(request, _('Sent Jabber broadcast to {}'.format(group_to_send))) + messages.success(request, _(f'Sent Jabber broadcast to {group_to_send}')) logger.info(f"Sent Jabber broadcast on behalf of user {request.user}") except PingBotException as e: messages.error(request, e) diff --git a/allianceauth/tests/auth_utils.py b/allianceauth/tests/auth_utils.py index bec16bcb..2d7f52a3 100644 --- a/allianceauth/tests/auth_utils.py +++ b/allianceauth/tests/auth_utils.py @@ -1,4 +1,3 @@ - from django.contrib.auth.models import Group, Permission, User from django.db.models.signals import m2m_changed, post_save, pre_save from django.test import TestCase diff --git a/allianceauth/tests/test_auth_utils.py b/allianceauth/tests/test_auth_utils.py index 62a06bd7..4eabfc3c 100644 --- a/allianceauth/tests/test_auth_utils.py +++ b/allianceauth/tests/test_auth_utils.py @@ -1,4 +1,3 @@ - from django.contrib.auth.models import Group, Permission, User from django.test import TestCase diff --git a/allianceauth/theme/hooks.py b/allianceauth/theme/hooks.py index 44b57643..fe818d1a 100644 --- a/allianceauth/theme/hooks.py +++ b/allianceauth/theme/hooks.py @@ -1,5 +1,3 @@ - - class ThemeHook: """ Theme hook for injecting a Bootstrap 5 Theme and associated JS into alliance auth.