Skip to content

Commit

Permalink
Update for fast action
Browse files Browse the repository at this point in the history
  • Loading branch information
davepeck committed Nov 29, 2023
1 parent 83e95ca commit ee0e279
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fec.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def search(
if related_name_sets
else frozenset([contact.first_name])
)
with sao.Session(engine) as session:
with sao.Session(engine) as session, session.begin():
if contact.zip5 is None:
contributions = Contribution.for_last_city_state_firsts(
session,
Expand Down
4 changes: 2 additions & 2 deletions server/data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def for_last_zip_firsts(
) -> t.Iterable[t.Self]:
"""Return a query for contributions matching the given criteria."""
statement = cls.for_last_zip_firsts_stmt(last_name, zip_code, first_names)
print(str(statement))
# print(str(statement))
return session.execute(statement).scalars()

@classmethod
Expand Down Expand Up @@ -308,7 +308,7 @@ def for_last_city_state_firsts(
statement = cls.for_last_city_state_firsts_stmt(
last_name, city, state, first_names
)
print(str(statement))
# print(str(statement))
return session.execute(statement).scalars()

@classmethod
Expand Down
8 changes: 8 additions & 0 deletions server/data/nicknames.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ def split_name(name: str) -> tuple[str, str]:
return last, first


class IGetRelatedNames(t.Protocol):
"""A protocol for getting related names."""

def get_related_names(self, name: str) -> t.Iterable[frozenset[str]]:
"""Get the sets of related names for a given name."""
...


class NicknamesManager:
"""
Tools for working with a 'messy' nicknames file.
Expand Down

0 comments on commit ee0e279

Please sign in to comment.