Enable/apply ruff's "pyupgrade" rules
This commit is contained in:
parent
de0db9ac5a
commit
27974e7de6
@ -213,7 +213,7 @@ class DeniedAccess(BaseAccessReport):
|
|||||||
"door name": event.door.name,
|
"door name": event.door.name,
|
||||||
"event type": HIDEvent.EventType(event.event_type).label,
|
"event type": HIDEvent.EventType(event.event_type).label,
|
||||||
"name": " ".join(
|
"name": " ".join(
|
||||||
(n for n in [event.forename, event.surname] if n is not None)
|
n for n in [event.forename, event.surname] if n is not None
|
||||||
),
|
),
|
||||||
"raw card number": (
|
"raw card number": (
|
||||||
event.raw_card_number if event.raw_card_number is not None else ""
|
event.raw_card_number if event.raw_card_number is not None else ""
|
||||||
@ -242,7 +242,7 @@ class MostActiveMembers(BaseAccessReport):
|
|||||||
{
|
{
|
||||||
"cardholder id": count["cardholder_id"],
|
"cardholder id": count["cardholder_id"],
|
||||||
"name": " ".join(
|
"name": " ".join(
|
||||||
(n for n in [count["forename"], count["surname"]] if n is not None)
|
n for n in [count["forename"], count["surname"]] if n is not None
|
||||||
),
|
),
|
||||||
"access count": count["access_count"],
|
"access count": count["access_count"],
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Optional, Type, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib import admin, messages
|
from django.contrib import admin, messages
|
||||||
@ -38,8 +38,8 @@ class AbstractAuditInline(admin.TabularInline):
|
|||||||
form = AlwaysChangedModelForm
|
form = AlwaysChangedModelForm
|
||||||
|
|
||||||
def get_formset(
|
def get_formset(
|
||||||
self, request: HttpRequest, obj: Optional[AbstractAudit] = None, **kwargs: Any
|
self, request: HttpRequest, obj: AbstractAudit | None = None, **kwargs: Any
|
||||||
) -> Type[
|
) -> type[
|
||||||
"forms.models.BaseInlineFormSet[AbstractAudit, Any, forms.models.ModelForm[Any]]"
|
"forms.models.BaseInlineFormSet[AbstractAudit, Any, forms.models.ModelForm[Any]]"
|
||||||
]:
|
]:
|
||||||
formset = super().get_formset(request, obj, **kwargs)
|
formset = super().get_formset(request, obj, **kwargs)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
from typing import TYPE_CHECKING, Optional, TypedDict
|
from typing import TYPE_CHECKING, TypedDict
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
@ -106,14 +106,14 @@ class Department(models.Model):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def list_name(self) -> Optional[str]:
|
def list_name(self) -> str | None:
|
||||||
if self.has_mailing_list:
|
if self.has_mailing_list:
|
||||||
return self.name.replace(" ", "_") + "-info"
|
return self.name.replace(" ", "_") + "-info"
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def list_address(self) -> Optional[str]:
|
def list_address(self) -> str | None:
|
||||||
if self.list_name:
|
if self.list_name:
|
||||||
return self.list_name + "@claremontmakerspace.org"
|
return self.list_name + "@claremontmakerspace.org"
|
||||||
else:
|
else:
|
||||||
|
@ -43,7 +43,7 @@ admin_email = "cmsmanage.django_q2_admin_email_reporter:AdminEmailReporter"
|
|||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
select = ["E4", "E7", "E9", "F", "I", "C4"]
|
select = ["E4", "E7", "E9", "F", "I", "C4", "UP"]
|
||||||
|
|
||||||
[tool.ruff.lint.isort]
|
[tool.ruff.lint.isort]
|
||||||
known-first-party = [
|
known-first-party = [
|
||||||
|
Loading…
Reference in New Issue
Block a user