🚨(backend) lint code with new ruff 0.16

New ruff version need to lint the code again and adapt exceptions
This commit is contained in:
Manuel Raynaud
2026-08-04 10:16:51 +02:00
parent a57fb7cbde
commit f7d06e45e5
8 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -110,7 +110,7 @@ def pytest_sessionstart(session):
len(_PRE_EXISTING_OBJECTS),
bucket_name,
)
except Exception: # pylint: disable=broad-except # noqa: BLE001
except Exception: # pylint: disable=broad-except
# MinIO may be unreachable (e.g. storage-less unit runs): disable cleanup.
_PRE_EXISTING_OBJECTS = None
logger.warning(
@@ -155,5 +155,5 @@ def pytest_sessionfinish(session, exitstatus): # pylint: disable=unused-argumen
deleted,
bucket_name,
)
except Exception: # pylint: disable=broad-except # noqa: BLE001
except Exception: # pylint: disable=broad-except
logger.warning("S3 test cleanup failed", exc_info=True)
@@ -21,7 +21,7 @@ def populate_attachments_on_all_documents(apps, schema_editor):
response = default_storage.connection.meta.client.get_object(
Bucket=default_storage.bucket_name, Key=f"{document.pk!s}/file"
)
except (FileNotFoundError, ClientError):
except FileNotFoundError, ClientError:
pass
else:
content = response["Body"].read().decode("utf-8")
+2 -2
View File
@@ -1064,7 +1064,7 @@ class Document(MP_Node, BaseModel):
if self._content is None and self.id:
try:
response = self.get_content_response()
except (FileNotFoundError, ClientError):
except FileNotFoundError, ClientError:
pass
else:
self._content = response["Body"].read().decode("utf-8")
@@ -2101,7 +2101,7 @@ class Invitation(BaseModel):
roles = self.document.accesses.filter(
models.Q(user=user) | models.Q(team__in=teams),
).values_list("role", flat=True)
except (self._meta.model.DoesNotExist, IndexError):
except self._meta.model.DoesNotExist, IndexError:
roles = []
is_admin_or_owner = bool(
+2 -2
View File
@@ -186,7 +186,7 @@ class BaseDocumentIndexer(ABC):
"""
# pylint: disable=too-many-arguments, too-many-positional-arguments
def search( # noqa : PLR0913
def search( # noqa : PLR0913, PLR0917
self,
q: str,
token: str,
@@ -248,7 +248,7 @@ class FindDocumentIndexer(BaseDocumentIndexer):
"""
# pylint: disable=too-many-arguments, too-many-positional-arguments
def search( # noqa : PLR0913
def search( # noqa : PLR0913, PLR0917
self,
q: str,
token: str,
@@ -46,7 +46,7 @@ def _process_row(row, job, counters):
for inactive_email in inactive_emails:
try:
validate_email(inactive_email)
except (ValidationError, ValueError):
except ValidationError, ValueError:
job.send_reconciliation_error_email(
recipient_email=active_email, other_email=inactive_email
)
@@ -42,7 +42,7 @@ pytestmark = pytest.mark.django_db
)
@pytest.mark.usefixtures("indexer_settings")
# pylint: disable=too-many-arguments, too-many-positional-arguments
def test_api_documents_search_success( # noqa : PLR0913
def test_api_documents_search_success( # noqa : PLR0913, PLR0917
mock_search_using_indexer,
mock_search_using_database,
activated_flags,
@@ -883,7 +883,7 @@ def test_models_documents_get_abilities_preset_role(django_assert_num_queries):
],
)
# pylint: disable=too-many-arguments, too-many-positional-arguments
def test_models_documents_get_abilities_children_destroy( # noqa: PLR0913
def test_models_documents_get_abilities_children_destroy( # noqa: PLR0913, PLR0917
is_authenticated,
is_creator,
role,
+1 -1
View File
@@ -46,7 +46,7 @@ def get_release():
with open(os.path.join(BASE_DIR, "pyproject.toml"), "rb") as f:
pyproject_data = tomllib.load(f)
return pyproject_data["project"]["version"]
except (FileNotFoundError, KeyError):
except FileNotFoundError, KeyError:
return "NA" # Default: not available