Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.2.2'
rev: 'v0.15.22'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --extend-exclude, TCH]
Expand Down
6 changes: 3 additions & 3 deletions cdk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
# Set the DC Environment early on. This is important to be able to conditionally
# change the stack configurations
dc_environment = app.node.try_get_context("dc-environment") or None
assert (
dc_environment in valid_environments
), f"context `dc-environment` must be one of {valid_environments}"
assert dc_environment in valid_environments, (
f"context `dc-environment` must be one of {valid_environments}"
)


YnrStack(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ dev = [
"pytest-cov==4.0.0",
"pytest-django==4.5.2",
"pytest-freezegun==0.4.2",
"pytest-ruff==0.2.1",
"ruff==0.2.2",
"pytest-ruff==0.5",
"ruff==0.15.22",
"watchdog==4.0.2",
"WebTest==3.0.0",
]
Expand Down
56 changes: 29 additions & 27 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ynr/apps/api/tests/test_api_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_all_parties_view(self):
},
{
"id": "PP53__1",
"text": "Labour Party " "Candidate",
"text": "Labour Party Candidate",
"register": "GB",
},
],
Expand Down
1 change: 0 additions & 1 deletion ynr/apps/auth_helpers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def user_in_group(user, group_name):


class GroupRequiredMixin(object):

"""A mixin that requires the user is a member of a particular group

You should set 'required_group_name' on the class that uses this
Expand Down
6 changes: 3 additions & 3 deletions ynr/apps/bulk_adding/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def total_form_count(self) -> int:
def get_form_kwargs(self, index):
kwargs = super().get_form_kwargs(index)
kwargs["party_choices"] = self.parties
kwargs[
"previous_party_affiliations_choices"
] = self.previous_party_affiliations_choices
kwargs["previous_party_affiliations_choices"] = (
self.previous_party_affiliations_choices
)
return kwargs

@property
Expand Down
30 changes: 15 additions & 15 deletions ynr/apps/bulk_adding/tests/test_bulk_add_by_party.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ def test_submit_name_and_social_media_links_for_area(self):
form[f"{ballot.pk}-0-person_identifiers_0_1"] = "homepage_url"
form[f"{ballot.pk}-0-person_identifiers_1_0"] = "pp@gmail.com"
form[f"{ballot.pk}-0-person_identifiers_1_1"] = "email"
form[
f"{ballot.pk}-0-person_identifiers_2_0"
] = "https://linkedin.com/in/pamphero"
form[f"{ballot.pk}-0-person_identifiers_2_0"] = (
"https://linkedin.com/in/pamphero"
)
form[f"{ballot.pk}-0-person_identifiers_2_1"] = "linkedin_url"

response = form.submit().follow()
Expand Down Expand Up @@ -305,22 +305,22 @@ def test_bulk_add_with_100_ballots(self):
form["source"] = "https://example.com/candidates/"
for ballot in ballots:
form[f"{ballot.pk}-0-name"] = f"Candidate {ballot.pk}"
form[
f"{ballot.pk}-0-biography"
] = f"Biography for Candidate {ballot.pk}"
form[f"{ballot.pk}-0-biography"] = (
f"Biography for Candidate {ballot.pk}"
)
form[f"{ballot.pk}-0-gender"] = "female"
form[f"{ballot.pk}-0-birth_date"] = "1990"
form[
f"{ballot.pk}-0-person_identifiers_0_0"
] = f"https://example.com/{ballot.pk}"
form[f"{ballot.pk}-0-person_identifiers_0_0"] = (
f"https://example.com/{ballot.pk}"
)
form[f"{ballot.pk}-0-person_identifiers_0_1"] = "homepage_url"
form[
f"{ballot.pk}-0-person_identifiers_1_0"
] = f"candidate{ballot.pk}@example.com"
form[f"{ballot.pk}-0-person_identifiers_1_0"] = (
f"candidate{ballot.pk}@example.com"
)
form[f"{ballot.pk}-0-person_identifiers_1_1"] = "email"
form[
f"{ballot.pk}-0-person_identifiers_2_0"
] = f"https://linkedin.com/in/candidate{ballot.pk}"
form[f"{ballot.pk}-0-person_identifiers_2_0"] = (
f"https://linkedin.com/in/candidate{ballot.pk}"
)
form[f"{ballot.pk}-0-person_identifiers_2_1"] = "linkedin_url"

# Submit the form
Expand Down
6 changes: 3 additions & 3 deletions ynr/apps/bulk_adding/views/sopns.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ def get_context_data(self, **kwargs):
)
if party_description:
form["description_id"] = party_description
form[
"party_description_text"
] = party_description.description
form["party_description_text"] = (
party_description.description
)

form["name"] = candidacy["name"]
form["party_id"] = party_obj.ec_id
Expand Down
16 changes: 8 additions & 8 deletions ynr/apps/cached_counts/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
class CompletenessFilter(django_filters.FilterSet):
def __init__(self, data=None, queryset=None, *, request=None, prefix=None):
for identifier in PersonIdentifierFields:
self.base_filters[
f"has_{identifier.name}"
] = django_filters.ChoiceFilter(
field_name=identifier.name,
method="filter_null_or_empty_str",
label=f"Has {identifier.value}",
choices=[("yes", "Yes"), ("no", "No")],
widget=forms.HiddenInput,
self.base_filters[f"has_{identifier.name}"] = (
django_filters.ChoiceFilter(
field_name=identifier.name,
method="filter_null_or_empty_str",
label=f"Has {identifier.value}",
choices=[("yes", "Yes"), ("no", "No")],
widget=forms.HiddenInput,
)
)

super().__init__(data, queryset, request=request, prefix=prefix)
Expand Down
Loading