|
39 | 39 | from openeo.api.process import Parameter, schema_supports |
40 | 40 | from openeo.dates import get_temporal_extent |
41 | 41 | from openeo.internal.documentation import openeo_process |
42 | | -from openeo.internal.graph_building import PGNode, ReduceNode, _FromNodeMixin |
| 42 | +from openeo.internal.graph_building import ( |
| 43 | + FlatGraphableMixin, |
| 44 | + PGNode, |
| 45 | + ReduceNode, |
| 46 | + _FromNodeMixin, |
| 47 | +) |
43 | 48 | from openeo.internal.jupyter import in_jupyter_context |
44 | 49 | from openeo.internal.processes.builder import ( |
45 | 50 | ProcessBuilderBase, |
|
91 | 96 |
|
92 | 97 |
|
93 | 98 | # Type annotation aliases |
94 | | -InputDate = Union[str, datetime.date, Parameter, PGNode, ProcessBuilderBase, _FromNodeMixin, None] |
| 99 | +InputDate = Union[str, datetime.date, Parameter, PGNode, ProcessBuilderBase, FlatGraphableMixin, None] |
95 | 100 |
|
96 | 101 |
|
97 | 102 | class DataCube(_ProcessGraphAbstraction): |
@@ -166,9 +171,9 @@ def load_collection( |
166 | 171 | collection_id: Union[str, Parameter], |
167 | 172 | connection: Optional[Connection] = None, |
168 | 173 | spatial_extent: Union[ |
169 | | - dict, Parameter, shapely.geometry.base.BaseGeometry, str, pathlib.Path, _FromNodeMixin, None |
| 174 | + dict, Parameter, shapely.geometry.base.BaseGeometry, str, pathlib.Path, FlatGraphableMixin, None |
170 | 175 | ] = None, |
171 | | - temporal_extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
| 176 | + temporal_extent: Union[Sequence[InputDate], Parameter, str, FlatGraphableMixin, None] = None, |
172 | 177 | bands: Union[Iterable[str], Parameter, str, None] = None, |
173 | 178 | fetch_metadata: bool = True, |
174 | 179 | properties: Union[ |
@@ -482,22 +487,22 @@ def _get_temporal_extent( |
482 | 487 | *args, |
483 | 488 | start_date: InputDate = None, |
484 | 489 | end_date: InputDate = None, |
485 | | - extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
486 | | - ) -> Union[List[Union[str, Parameter, PGNode, _FromNodeMixin, None]], Parameter, _FromNodeMixin]: |
| 490 | + extent: Union[Sequence[InputDate], Parameter, str, FlatGraphableMixin, None] = None, |
| 491 | + ) -> Union[List[Union[str, Parameter, PGNode, FlatGraphableMixin, None]], Parameter, FlatGraphableMixin]: |
487 | 492 | """Parameter aware temporal_extent normalizer""" |
488 | 493 | # TODO: move this outside of DataCube class |
489 | 494 | # TODO: return extent as tuple instead of list |
490 | | - if len(args) == 1 and isinstance(args[0], (Parameter, _FromNodeMixin)): |
| 495 | + if len(args) == 1 and isinstance(args[0], (Parameter, FlatGraphableMixin)): |
491 | 496 | assert start_date is None and end_date is None and extent is None |
492 | 497 | return args[0] |
493 | | - elif len(args) == 0 and isinstance(extent, (Parameter, _FromNodeMixin)): |
| 498 | + elif len(args) == 0 and isinstance(extent, (Parameter, FlatGraphableMixin)): |
494 | 499 | assert start_date is None and end_date is None |
495 | 500 | # TODO: warn about unexpected parameter schema |
496 | 501 | return extent |
497 | 502 | else: |
498 | 503 | def convertor(d: Any) -> Any: |
499 | 504 | # TODO: can this be generalized through _FromNodeMixin? |
500 | | - if isinstance(d, Parameter) or isinstance(d, _FromNodeMixin): |
| 505 | + if isinstance(d, Parameter) or isinstance(d, FlatGraphableMixin): |
501 | 506 | # TODO: warn about unexpected parameter schema |
502 | 507 | return d |
503 | 508 | elif isinstance(d, ProcessBuilderBase): |
@@ -533,7 +538,7 @@ def filter_temporal( |
533 | 538 | *args, |
534 | 539 | start_date: InputDate = None, |
535 | 540 | end_date: InputDate = None, |
536 | | - extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
| 541 | + extent: Union[Sequence[InputDate], Parameter, str, FlatGraphableMixin, None] = None, |
537 | 542 | ) -> DataCube: |
538 | 543 | """ |
539 | 544 | Limit the DataCube to a certain date range, which can be specified in several ways: |
|
0 commit comments