View source on GitHub
|
Resolves date parameters in specs based on a model's time coordinates.
schema.processors.model_processor.DatedSpecResolver(
spec: schema.processors.model_processor.DatedSpec,
time_coordinates: tc.TimeCoordinates
)
Attributes | |
|---|---|
time_coordinates
|
|
Methods
collapse_to_date_interval_proto
collapse_to_date_interval_proto() -> date_interval_pb2.DateInterval
Collapses the given spec into a DateInterval proto.
If the spec's date range is unbounded, then the DateInterval proto will have the semantic "All", and we resolve it by consulting the time coordinates of the model bound to this resolver.
Note that the exclusive end date semantic will be preserved in the returned proto.
| Returns | |
|---|---|
A DateInterval proto the represents the date interval specified by the
spec.
|
resolve_to_bool_selected_times
resolve_to_bool_selected_times() -> (list[bool] | None)
Resolves the given spec into a list of booleans indicating selected times.
| Returns | |
|---|---|
| A list of booleans indicating selected times, or None (semantic "All") if the bound spec is also None. |
resolve_to_date_interval_open_end
resolve_to_date_interval_open_end() -> tuple[datetime.date, datetime.date]
Resolves given spec into an open-ended [start, end) date interval.
resolve_to_date_interval_proto
resolve_to_date_interval_proto() -> date_interval_pb2.DateInterval
Resolves the given spec into a fully specified DateInterval proto.
If either start_date or end_date is None in the bound spec, then we
resolve it by consulting the time coordinates of the model bound to this
resolver. They are resolved to the first and last time coordinates (plus
interval length), respectively.
Note that the exclusive end date semantic will be preserved in the returned proto.
| Returns | |
|---|---|
A resolved DateInterval proto the represents the date interval specified
by the bound spec.
|
resolve_to_enumerated_selected_times
resolve_to_enumerated_selected_times() -> (list[str] | None)
Resolves the given spec into an enumerated list of time coordinates.
| Returns | |
|---|---|
| An enumerated list of time coordinates, or None (semantic "All") if the bound spec is also None. |
to_closed_date_interval_tuple
to_closed_date_interval_tuple() -> tuple[str | None, str | None]
Transforms given spec into a closed [start, end] date interval tuple.
For each of the bookends in the tuple, None value indicates a time
coordinate default (first or last time coordinate, respectively).
| Returns | |
|---|---|
A closed [start, end] date interval tuple.
|
transform_to_date_interval_protos
transform_to_date_interval_protos() -> list[date_interval_pb2.DateInterval]
Transforms the given spec into DateInterval protos.
If the spec's date range is unbounded, then the DateInterval proto will have the semantic "All", and we resolve it by consulting the time coordinates of the model bound to this resolver.
Note that the exclusive end date semantic will be preserved in the returned proto.
| Returns | |
|---|---|
A list of DateInterval protos the represents the date intervals
specified by the spec.
|
View source on GitHub