activity.collections.occasion
Classes
Abstract base class for generic types. |
Module Contents
- class activity.collections.occasion.OccasionCollection(session: sqlalchemy.orm.Session, **kwargs: Any)[source]
Bases:
onegov.core.collection.GenericCollection
[onegov.activity.models.Occasion
]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
- static to_half_open_interval(lower: int, upper: int) onegov.activity.types.BoundedIntegerRange [source]
Postgres coerces ranges internally to be half-open in an effort to canonize these ranges. This function does the same by taking a closed interval and turning it into a half-open interval of the NumericRange type.
- add(activity: onegov.activity.models.Activity, period: onegov.activity.models.Period, start: datetime.datetime, end: datetime.datetime, timezone: str, meeting_point: str | None = None, age: Sequence[int] | None = None, spots: Sequence[int] | None = None, note: str | None = None, cost: decimal.Decimal = Decimal(0), exclude_from_overlap_check: bool = False) onegov.activity.models.Occasion [source]
- add_date(occasion: onegov.activity.models.Occasion, start: datetime.datetime, end: datetime.datetime, timezone: str) onegov.activity.models.OccasionDate [source]