Skip to content

Commit

Permalink
chore(backend): make ruff 0.8.0 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Nov 25, 2024
1 parent 994108e commit a2b43e4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
1 change: 0 additions & 1 deletion backend/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ select = [
"W605", # invalid escape sequence
]
ignore = [
"ANN101", # this is deprecated and annotating self is unnecessary
"D203", # we prefer blank-line-before-class (D211) for black compat
"D213", # we prefer multi-line-summary-first-line (D212)
"COM812", # ignore due to conflict with formatter
Expand Down
2 changes: 1 addition & 1 deletion backend/timed/employment/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def calculate_worktime(
# converting workdays as db expects 1 (Sunday) to 7 (Saturday)
workdays_db = [
# special case for Sunday
int(day) == 7 and 1 or int(day) + 1 # noqa: PLR2004
(int(day) == 7 and 1) or int(day) + 1 # noqa: PLR2004
for day in self.location.workdays
]
holidays = PublicHoliday.objects.filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ def test_notify_reviewers_with_cc_and_message(mailoutbox, cc, message):
assert len(mailoutbox) == 1
mail = mailoutbox[0]
assert mail.to == [reviewer_work.email]
url = (
"http://localhost:4200/analysis?fromDate=2017-07-01&"
"toDate=2017-07-31&reviewer=%d&editable=1"
) % reviewer_work.id
url = f"http://localhost:4200/analysis?fromDate=2017-07-01&toDate=2017-07-31&reviewer={reviewer_work.id}&editable=1"
assert url in mail.body
assert message in mail.body
assert mail.cc[0] == cc
Expand All @@ -85,10 +82,7 @@ def test_notify_reviewers(mailoutbox):
assert len(mailoutbox) == 1
mail = mailoutbox[0]
assert mail.to == [reviewer_work.email]
url = (
"http://localhost:4200/analysis?fromDate=2017-07-01&"
"toDate=2017-07-31&reviewer=%d&editable=1"
) % reviewer_work.id
url = f"http://localhost:4200/analysis?fromDate=2017-07-01&toDate=2017-07-31&reviewer={reviewer_work.id}&editable=1"
assert url in mail.body
assert Notification.objects.count() == 1

Expand Down Expand Up @@ -118,8 +112,5 @@ def test_notify_reviewers_reviewer_hierarchy(mailoutbox):
assert len(mailoutbox) == 1
mail = mailoutbox[0]
assert mail.to == [task_reviewer.email]
url = (
"http://localhost:4200/analysis?fromDate=2017-07-01&"
"toDate=2017-07-31&reviewer=%d&editable=1"
) % task_reviewer.id
url = f"http://localhost:4200/analysis?fromDate=2017-07-01&toDate=2017-07-31&reviewer={task_reviewer.id}&editable=1"
assert url in mail.body
2 changes: 1 addition & 1 deletion backend/timed/reports/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from . import filters

if TYPE_CHECKING:
from typing import Iterable
from collections.abc import Iterable

from ezodf.document import FlatXMLDocument, PackagedDocument

Expand Down
2 changes: 1 addition & 1 deletion backend/timed/tracking/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def bulk(self, request):
_("Reviewer filter needs to be set to verifying user")
)

fields["verified_by"] = verified and user or None
fields["verified_by"] = (verified and user) or None

if fields.get("review") or any(queryset.values_list("review", flat=True)):
raise exceptions.ParseError(
Expand Down

0 comments on commit a2b43e4

Please sign in to comment.