remove noqa comments for SLF001 in various files

This commit is contained in:
FuzzyGrim
2025-06-07 17:41:15 +02:00
parent 7dd1815ab9
commit 377b1a30c8
6 changed files with 8 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ extend-exclude = ["migrations"]
[tool.ruff.lint]
select = ["ALL"]
ignore = ["ANN", "PT", "PD", "D100", "D104", "RUF012", "PLR0913"]
ignore = ["ANN", "PT", "PD", "D100", "D104", "RUF012", "PLR0913", "SLF001"]
[tool.ruff.lint.pycodestyle]
max-doc-length = 88
@@ -12,9 +12,6 @@ max-doc-length = 88
[tool.ruff.lint.pydocstyle]
convention = "pep257"
[tool.ruff.lint.per-file-ignores]
"**/tests/*" = ["SLF001"]
[tool.djlint]
custom_blocks = "element,slot,setvar"
preserve_blank_lines = true

View File

@@ -111,7 +111,7 @@ def collect_creation_changes(new_record, history_model, media_type):
"other_changes": [],
}
for field in history_model._meta.get_fields(): # noqa: SLF001
for field in history_model._meta.get_fields():
if (
field.name.startswith("history_")
or field.name in ["id"]

View File

@@ -19,12 +19,12 @@ class _DisableCalendarTriggers:
"""Disable calendar triggers for Item model."""
from app.models import Item
self.original_value = Item._disable_calendar_triggers # noqa: SLF001
Item._disable_calendar_triggers = True # noqa: SLF001
self.original_value = Item._disable_calendar_triggers
Item._disable_calendar_triggers = True
return self
def __exit__(self, exc_type, exc_val, exc_tb):
"""Restore calendar triggers."""
from app.models import Item
Item._disable_calendar_triggers = self.original_value # noqa: SLF001
Item._disable_calendar_triggers = self.original_value

View File

@@ -381,7 +381,7 @@ class MediaManager(models.Manager):
)
# Handle sorting by Item fields
item_fields = [f.name for f in Item._meta.fields] # noqa: SLF001
item_fields = [f.name for f in Item._meta.fields]
if sort_filter in item_fields:
if sort_filter == "title":
# Case-insensitive title sorting

View File

@@ -86,7 +86,7 @@ def get_model_fields(model):
"""Get a list of fields names from a model."""
return [
field.name
for field in model._meta.get_fields() # noqa: SLF001
for field in model._meta.get_fields()
if isinstance(field, Field) and not field.auto_created and not field.is_relation
]

View File

@@ -41,7 +41,7 @@ class CustomUserAdmin(UserAdmin):
]
field_groups = {}
for field in User._meta.get_fields(): # noqa: SLF001
for field in User._meta.get_fields():
if not isinstance(field, Field):
continue