Skip to content

Commit

Permalink
Apply the ruff FURB rule
Browse files Browse the repository at this point in the history
  • Loading branch information
swrichards committed Feb 18, 2025
1 parent 55d46f8 commit 2b43792
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 43 deletions.
7 changes: 1 addition & 6 deletions src/open_inwoner/accounts/tests/test_profile_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,12 +880,7 @@ def assertDataDisplays(self, response):
s = elem.text.strip()
texts.add(s)

missing = list()
for s in self.expected_strings:
if s not in texts:
missing.append(s)

if missing:
if missing := [s for s in self.expected_strings if s not in texts]:
f = ", ".join(f"'{s}'" for s in missing)
self.fail(f"missing display of values: {f}")

Expand Down
20 changes: 10 additions & 10 deletions src/open_inwoner/cms/cases/views/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,11 @@ def get_submissions(self) -> list[SubmissionWithApiGroup]:
for task in concurrent.futures.as_completed(futures):
try:
group_for_task = all_api_groups[futures.index(task)]
for row in task.result():
subs_with_api_group.append(
SubmissionWithApiGroup(
submission=row, api_group=group_for_task
)
)
subs_with_api_group.extend(
SubmissionWithApiGroup(submission=row, api_group=group_for_task)
for row in task.result()
)

except BaseException:
logger.exception("Error fetching and pre-processing cases")

Expand Down Expand Up @@ -177,10 +176,11 @@ def get_cases(self) -> list[ZaakWithApiGroup]:
):
group_for_task = all_api_groups[futures.index(task)]
try:
for row in task.result():
cases_with_api_group.append(
ZaakWithApiGroup(zaak=row, api_group=group_for_task)
)
cases_with_api_group.extend(
ZaakWithApiGroup(zaak=row, api_group=group_for_task)
for row in task.result()
)

except BaseException:
logger.exception(
"Error while fetching and pre-processing cases for API group %s",
Expand Down
6 changes: 3 additions & 3 deletions src/open_inwoner/plans/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def get_available_contacts_for_filtering(self, plans):
"""
Return all available contacts for filtering for all the plans.
"""
user_contacts_qs = []
for plan in plans:
user_contacts_qs.append(plan.get_other_users(user=self.request.user))
user_contacts_qs = (
plan.get_other_users(user=self.request.user) for plan in plans
)

available_contacts = User.objects.none()
for qs in user_contacts_qs:
Expand Down
10 changes: 5 additions & 5 deletions src/open_inwoner/questionnaire/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
content = [c.content for c in tree]
root_title = tree.first().title

steps = []
for i in range(len(answers)):
steps.append(
{"question": questions[i], "answer": answers[i], "content": content[i]}
)
steps = [
{"question": questions[i], "answer": answer, "content": content[i]}
for i, answer in enumerate(answers)
]

last_step = tree.last()

context["root_title"] = root_title
Expand Down
6 changes: 1 addition & 5 deletions src/open_inwoner/ssd/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ def get_yearly_report_dates() -> list[tuple[date, str]]:
if today < available_from:
dates.pop(0)

choices = []
for report_date in dates:
choices.append((report_date.date(), str(report_date.year)))

return choices
return [(report_date.date(), str(report_date.year)) for report_date in dates]


#
Expand Down
21 changes: 7 additions & 14 deletions src/open_inwoner/ssd/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,13 @@ def get_jaaropgaven(response: requests.Response) -> list[dict] | None:
except AttributeError:
return None

jaaropgaven = []
for specificatie in specificatien:
jaaropgaven.append(
{
return [{
"client": client,
"inhoudingsplichtige": inhoudingsplichtige,
"specificatie": specificatie,
}
)
return jaaropgaven
} for specificatie in specificatien]




def get_uitkeringen(response: requests.Response) -> list[dict] | None:
Expand All @@ -114,14 +111,10 @@ def get_uitkeringen(response: requests.Response) -> list[dict] | None:
except AttributeError:
return None

uitkeringen = []
for historie in dossierhistorien:
uitkeringen.append(
{
return [
{
"uitkeringsinstantie": uitkeringsinstantie,
"client": client,
"dossierhistorie": historie,
"details": historie.componenthistorie,
}
)
return uitkeringen
} for historie in dossierhistorien]

0 comments on commit 2b43792

Please sign in to comment.