|
91 | 91 |
|
92 | 92 |
|
93 | 93 | # Type annotation aliases |
94 | | -InputDate = Union[str, datetime.date, Parameter, PGNode, ProcessBuilderBase, None] |
| 94 | +InputDate = Union[str, datetime.date, Parameter, PGNode, ProcessBuilderBase, _FromNodeMixin, None] |
95 | 95 |
|
96 | 96 |
|
97 | 97 | class DataCube(_ProcessGraphAbstraction): |
@@ -165,8 +165,10 @@ def load_collection( |
165 | 165 | cls, |
166 | 166 | collection_id: Union[str, Parameter], |
167 | 167 | connection: Optional[Connection] = None, |
168 | | - spatial_extent: Union[dict, Parameter, shapely.geometry.base.BaseGeometry, str, pathlib.Path, None] = None, |
169 | | - temporal_extent: Union[Sequence[InputDate], Parameter, str, None] = None, |
| 168 | + spatial_extent: Union[ |
| 169 | + dict, Parameter, shapely.geometry.base.BaseGeometry, str, pathlib.Path, _FromNodeMixin, None |
| 170 | + ] = None, |
| 171 | + temporal_extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
170 | 172 | bands: Union[Iterable[str], Parameter, str, None] = None, |
171 | 173 | fetch_metadata: bool = True, |
172 | 174 | properties: Union[ |
@@ -480,22 +482,22 @@ def _get_temporal_extent( |
480 | 482 | *args, |
481 | 483 | start_date: InputDate = None, |
482 | 484 | end_date: InputDate = None, |
483 | | - extent: Union[Sequence[InputDate], Parameter, str, None] = None, |
484 | | - ) -> Union[List[Union[str, Parameter, PGNode, None]], Parameter]: |
| 485 | + extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
| 486 | + ) -> Union[List[Union[str, Parameter, PGNode, _FromNodeMixin, None]], Parameter, _FromNodeMixin]: |
485 | 487 | """Parameter aware temporal_extent normalizer""" |
486 | 488 | # TODO: move this outside of DataCube class |
487 | 489 | # TODO: return extent as tuple instead of list |
488 | | - if len(args) == 1 and isinstance(args[0], Parameter): |
| 490 | + if len(args) == 1 and isinstance(args[0], (Parameter, _FromNodeMixin)): |
489 | 491 | assert start_date is None and end_date is None and extent is None |
490 | 492 | return args[0] |
491 | | - elif len(args) == 0 and isinstance(extent, Parameter): |
| 493 | + elif len(args) == 0 and isinstance(extent, (Parameter, _FromNodeMixin)): |
492 | 494 | assert start_date is None and end_date is None |
493 | 495 | # TODO: warn about unexpected parameter schema |
494 | 496 | return extent |
495 | 497 | else: |
496 | 498 | def convertor(d: Any) -> Any: |
497 | 499 | # TODO: can this be generalized through _FromNodeMixin? |
498 | | - if isinstance(d, Parameter) or isinstance(d, PGNode): |
| 500 | + if isinstance(d, Parameter) or isinstance(d, _FromNodeMixin): |
499 | 501 | # TODO: warn about unexpected parameter schema |
500 | 502 | return d |
501 | 503 | elif isinstance(d, ProcessBuilderBase): |
@@ -531,7 +533,7 @@ def filter_temporal( |
531 | 533 | *args, |
532 | 534 | start_date: InputDate = None, |
533 | 535 | end_date: InputDate = None, |
534 | | - extent: Union[Sequence[InputDate], Parameter, str, None] = None, |
| 536 | + extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
535 | 537 | ) -> DataCube: |
536 | 538 | """ |
537 | 539 | Limit the DataCube to a certain date range, which can be specified in several ways: |
|
0 commit comments