Skip to content

Commit

Permalink
Black reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jessemortenson committed Oct 10, 2024
1 parent c4bc335 commit 05ed5f2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions openstates/importers/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ def limit_spec(self, spec: _JsonDict) -> _JsonDict:
# __icontains doesn't work for JSONField ArrayField
# so name follows "title" naming pattern
name = name.title()
pattern = '(' + '|'.join(org_name_prepositions) + ')'
name = re.sub(pattern, lambda match: match.group(0).lower(), name, flags=re.IGNORECASE)
pattern = "(" + "|".join(org_name_prepositions) + ")"
name = re.sub(
pattern, lambda match: match.group(0).lower(), name, flags=re.IGNORECASE
)
name = name.replace(" & ", " and ")

if chamber_classification:
return Q(**spec) & (
Q(name__iexact=name)
| Q(other_names__contains=[{"name": name}])
) & Q(parent__classification=chamber_classification)
return (
Q(**spec)
& (Q(name__iexact=name) | Q(other_names__contains=[{"name": name}]))
& Q(parent__classification=chamber_classification)
)
else:
return Q(**spec) & (
Q(name__iexact=name)
| Q(other_names__contains=[{"name": name}])
Q(name__iexact=name) | Q(other_names__contains=[{"name": name}])
)
return spec

0 comments on commit 05ed5f2

Please sign in to comment.