diff --git a/ruff.toml b/ruff.toml index 5491cfc..6baf6d9 100644 --- a/ruff.toml +++ b/ruff.toml @@ -46,7 +46,6 @@ lint.extend-ignore = [ # "E501", # line too long "E741", # Ambiguous variable name - # "F841", # Local variable `...` is assigned to but never used "FURB113", # Use `x.extend(...)` instead of repeatedly calling `x.append()` # "N801", # Class name should use CapWords convention diff --git a/src/abilian/sbe/apps/documents/models.py b/src/abilian/sbe/apps/documents/models.py index 42937f9..ee2c646 100644 --- a/src/abilian/sbe/apps/documents/models.py +++ b/src/abilian/sbe/apps/documents/models.py @@ -766,7 +766,7 @@ def _trigger_conversion_tasks(session: Session) -> None: document_queue = _get_documents_queue() while document_queue: - doc, task_id = document_queue.pop() + doc, _task_id = document_queue.pop() if doc.id and isinstance(doc.id, int): logger.debug( "_trigger_conversion_tasks() doc.id={doc_id}", diff --git a/src/abilian/sbe/apps/documents/tasks.py b/src/abilian/sbe/apps/documents/tasks.py index d71a699..fce2cb8 100644 --- a/src/abilian/sbe/apps/documents/tasks.py +++ b/src/abilian/sbe/apps/documents/tasks.py @@ -68,7 +68,7 @@ def process_document(document_id: int) -> None: document_id=document_id, ) - with get_document(document_id) as (session, document): + with get_document(document_id) as (_session, document): if document is None: return @@ -98,7 +98,7 @@ def _run_antivirus(document: Document) -> bool | None: @dramatiq.actor def antivirus_scan(document_id): """Return antivirus.scan() result.""" - with get_document(document_id) as (session, document): + with get_document(document_id) as (_session, document): if document is None: return None return _run_antivirus(document) @@ -108,7 +108,7 @@ def antivirus_scan(document_id): def preview_document(document_id: int) -> None: """Compute the document preview images with its default preview size.""" - with get_document(document_id) as (session, document): + with get_document(document_id) as (_session, document): logger.debug( "preview_document() document_id={document_id} document={document}", document_id=document_id, @@ -150,7 +150,7 @@ def convert_document_content(document_id: int) -> None: document_id=document_id, ) - with get_document(document_id) as (session, doc): + with get_document(document_id) as (_session, doc): if doc is None: # deleted after task queued, but before task run return diff --git a/src/abilian/sbe/apps/documents/webdav/views.py b/src/abilian/sbe/apps/documents/webdav/views.py index 7ffae6d..dcc5ff4 100644 --- a/src/abilian/sbe/apps/documents/webdav/views.py +++ b/src/abilian/sbe/apps/documents/webdav/views.py @@ -145,7 +145,7 @@ def mkcol(path): if parent_folder is None: return "Parent collection doesn't exist.", HTTP_CONFLICT, {} - new_folder = parent_folder.create_subfolder(name=name) + parent_folder.create_subfolder(name=name) db.session.commit() return "", HTTP_CREATED, {} @@ -231,7 +231,7 @@ def propfind(path): print(request.data) try: - propfind = Propfind(request.data) + Propfind(request.data) except XMLSyntaxError: return "Malformed XML document.", HTTP_BAD_REQUEST, {} diff --git a/src/abilian/sbe/apps/forum/tasks.py b/src/abilian/sbe/apps/forum/tasks.py index f7ef9b9..81c26c9 100644 --- a/src/abilian/sbe/apps/forum/tasks.py +++ b/src/abilian/sbe/apps/forum/tasks.py @@ -183,7 +183,7 @@ def extract_email_destination(address: str) -> tuple[str, ...]: address = m.group(1) local_part = address.rsplit("@", 1)[0] name, ident = local_part.rsplit("+", 1) - uid, digest = ident.rsplit("-", 1) + uid, _digest = ident.rsplit("-", 1) signed_local_part = build_local_part(name, uid) if local_part != signed_local_part: diff --git a/src/abilian/sbe/apps/social/views/invites.py b/src/abilian/sbe/apps/social/views/invites.py index 39042cc..ac00e18 100644 --- a/src/abilian/sbe/apps/social/views/invites.py +++ b/src/abilian/sbe/apps/social/views/invites.py @@ -42,12 +42,12 @@ def invite_post(): emails = [email.strip() for email in emails] # FIXME: what do we do with this ? - message = request.form.get("message", "") + _message = request.form.get("message", "") with mail.connect() as conn: for email in emails: # FIXME: what do we do with this ? - invite = Invite(sender=current_user, email=email) + _invite = Invite(sender=current_user, email=email) # subject = _(u"%s would like to invite you to the %s community") # % (current_user.name, "Yaka") diff --git a/src/abilian/sbe/apps/social/views/users.py b/src/abilian/sbe/apps/social/views/users.py index 16b3919..0f5d685 100644 --- a/src/abilian/sbe/apps/social/views/users.py +++ b/src/abilian/sbe/apps/social/views/users.py @@ -129,8 +129,8 @@ def users_dt_json(): cell1 = f'
{name}
' cell2 = age(user.created_at) cell3 = age(user.last_active) + _cell4 = "" # TODO: follow / unfollow? - cell4 = "" # TODO: follow / unfollow? data.append([cell0, cell1, cell2, cell3]) result = { diff --git a/src/abilian/services/auth/views.py b/src/abilian/services/auth/views.py index 4b58759..eb19624 100644 --- a/src/abilian/services/auth/views.py +++ b/src/abilian/services/auth/views.py @@ -207,7 +207,7 @@ def forgotten_pw(new_user: bool = False) -> str | Response | tuple[str, int]: @route("/reset_password/") def reset_password(token: str) -> str | Response: - expired, invalid, user = reset_password_token_status(token) + expired, invalid, _user = reset_password_token_status(token) if invalid: flash(_("Invalid reset password token."), "error") elif expired: @@ -330,7 +330,7 @@ def get_token_status( try: data = serializer.loads(token, max_age=max_age) except SignatureExpired: - d, data = serializer.loads_unsafe(token) + _d, data = serializer.loads_unsafe(token) expired = True except BadSignature: invalid = True @@ -400,7 +400,7 @@ def check_for_redirect(target: str) -> str: # exceptions may happen if route is not found for example with contextlib.suppress(Exception): - endpoint, ignored = ctx.url_adapter.match(url.path, "GET") + endpoint, _ignored = ctx.url_adapter.match(url.path, "GET") if "." in endpoint and endpoint.rsplit(".", 1)[0] == "login": # don't redirect to any login view after successful login return "" diff --git a/src/abilian/services/conversion/handlers.py b/src/abilian/services/conversion/handlers.py index 11e6ad1..b510c42 100644 --- a/src/abilian/services/conversion/handlers.py +++ b/src/abilian/services/conversion/handlers.py @@ -324,7 +324,7 @@ def unoconv_version(self): cmd = [self.unoconv, "--version"] process = subprocess.Popen(cmd, stdout=subprocess.PIPE) - out, err = process.communicate() + out, _err = process.communicate() return out def convert(self, blob, **kw): diff --git a/src/abilian/web/filters.py b/src/abilian/web/filters.py index c86424d..8ff304e 100644 --- a/src/abilian/web/filters.py +++ b/src/abilian/web/filters.py @@ -147,8 +147,8 @@ def age( delta = dt - now if date_threshold is not None: - dy, dw, dd = dt_cal = dt.isocalendar() - ny, nw, nd = now_cal = now.isocalendar() + dy, _dw, _dd = dt_cal = dt.isocalendar() + ny, _nw, _nd = now_cal = now.isocalendar() if dt_cal != now_cal: # not same day diff --git a/src/abilian/web/forms/fields.py b/src/abilian/web/forms/fields.py index 7f45fb1..b9e75b1 100644 --- a/src/abilian/web/forms/fields.py +++ b/src/abilian/web/forms/fields.py @@ -552,7 +552,7 @@ def _get_pk_from_identity(obj): SQLAlchemy >= 1.2.""" from sqlalchemy.orm.util import identity_key - cls, key = identity_key(instance=obj)[0:2] + _cls, key = identity_key(instance=obj)[0:2] return ":".join(str(x) for x in key) def _get_data(self):