From 377b1a30c87bc090e4fb931bc06581bbce2bfd22 Mon Sep 17 00:00:00 2001 From: FuzzyGrim Date: Sat, 7 Jun 2025 17:41:15 +0200 Subject: [PATCH] remove noqa comments for SLF001 in various files --- pyproject.toml | 5 +---- src/app/history_processor.py | 2 +- src/app/mixins.py | 6 +++--- src/app/models.py | 2 +- src/integrations/exports.py | 2 +- src/users/admin.py | 2 +- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3af64920..e7082790 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/src/app/history_processor.py b/src/app/history_processor.py index a3096a1c..7e83954d 100644 --- a/src/app/history_processor.py +++ b/src/app/history_processor.py @@ -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"] diff --git a/src/app/mixins.py b/src/app/mixins.py index 349e67a9..1fa88f80 100644 --- a/src/app/mixins.py +++ b/src/app/mixins.py @@ -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 diff --git a/src/app/models.py b/src/app/models.py index 16427f40..0499b3e8 100644 --- a/src/app/models.py +++ b/src/app/models.py @@ -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 diff --git a/src/integrations/exports.py b/src/integrations/exports.py index 7e23995e..408a79fe 100644 --- a/src/integrations/exports.py +++ b/src/integrations/exports.py @@ -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 ] diff --git a/src/users/admin.py b/src/users/admin.py index 264ce90c..cfe1790f 100644 --- a/src/users/admin.py +++ b/src/users/admin.py @@ -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