Skip to content

Commit

Permalink
refact: unused variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Nov 5, 2024
1 parent 832eaf1 commit 27f22cf
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/sbe/apps/documents/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
8 changes: 4 additions & 4 deletions src/abilian/sbe/apps/documents/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/abilian/sbe/apps/documents/webdav/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, {}

Expand Down Expand Up @@ -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, {}

Expand Down
2 changes: 1 addition & 1 deletion src/abilian/sbe/apps/forum/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/abilian/sbe/apps/social/views/invites.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/sbe/apps/social/views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def users_dt_json():
cell1 = f'<div class="info"><a href="{user_url}">{name}</a></div>'
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 = {
Expand Down
6 changes: 3 additions & 3 deletions src/abilian/services/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def forgotten_pw(new_user: bool = False) -> str | Response | tuple[str, int]:

@route("/reset_password/<token>")
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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ""
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/services/conversion/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/abilian/web/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/abilian/web/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 27f22cf

Please sign in to comment.