people.collections.people

Attributes

PersonT

Classes

BasePersonCollection

Abstract base class for generic types.

PersonCollection

Manages a list of people.

Module Contents

people.collections.people.PersonT[source]
class people.collections.people.BasePersonCollection(session: sqlalchemy.orm.Session, **kwargs: Any)[source]

Bases: onegov.core.collection.GenericCollection[PersonT]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
property model_class: type[PersonT][source]
Abstractmethod:

add(first_name: str, last_name: str, **optional: Any) PersonT[source]
by_id(id: uuid.UUID) PersonT | None[source]
class people.collections.people.PersonCollection(session: sqlalchemy.orm.Session, **kwargs: Any)[source]

Bases: BasePersonCollection[onegov.people.models.Person]

Manages a list of people.

Use it like this:

from onegov.people import PersonCollection
people = PersonCollection(session)
property model_class: type[onegov.people.models.Person][source]