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,
|
||||
"event type": HIDEvent.EventType(event.event_type).label,
|
||||
"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": (
|
||||
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"],
|
||||
"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"],
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional, Type, cast
|
||||
from typing import Any, cast
|
||||
|
||||
from django import forms
|
||||
from django.contrib import admin, messages
|
||||
@ -38,8 +38,8 @@ class AbstractAuditInline(admin.TabularInline):
|
||||
form = AlwaysChangedModelForm
|
||||
|
||||
def get_formset(
|
||||
self, request: HttpRequest, obj: Optional[AbstractAudit] = None, **kwargs: Any
|
||||
) -> Type[
|
||||
self, request: HttpRequest, obj: AbstractAudit | None = None, **kwargs: Any
|
||||
) -> type[
|
||||
"forms.models.BaseInlineFormSet[AbstractAudit, Any, forms.models.ModelForm[Any]]"
|
||||
]:
|
||||
formset = super().get_formset(request, obj, **kwargs)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
import re
|
||||
from typing import TYPE_CHECKING, Optional, TypedDict
|
||||
from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.validators import RegexValidator
|
||||
@ -106,14 +106,14 @@ class Department(models.Model):
|
||||
return self.name
|
||||
|
||||
@property
|
||||
def list_name(self) -> Optional[str]:
|
||||
def list_name(self) -> str | None:
|
||||
if self.has_mailing_list:
|
||||
return self.name.replace(" ", "_") + "-info"
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def list_address(self) -> Optional[str]:
|
||||
def list_address(self) -> str | None:
|
||||
if self.list_name:
|
||||
return self.list_name + "@claremontmakerspace.org"
|
||||
else:
|
||||
|
@ -43,7 +43,7 @@ admin_email = "cmsmanage.django_q2_admin_email_reporter:AdminEmailReporter"
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 88
|
||||
select = ["E4", "E7", "E9", "F", "I", "C4"]
|
||||
select = ["E4", "E7", "E9", "F", "I", "C4", "UP"]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = [
|
||||
|
Loading…
Reference in New Issue
Block a user