Source code for election_day.collections.lists

from onegov.election_day.models import List


from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from sqlalchemy.orm import Query, Session
    from uuid import UUID


[docs] class ListCollection: def __init__(self, session: 'Session'):
[docs] self.session = session
[docs] def query(self) -> 'Query[List]': return self.session.query(List)
[docs] def by_id(self, id: 'UUID') -> List | None: return self.query().filter(List.id == id).first()