|
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[ |
@@ -505,22 +507,22 @@ def _get_temporal_extent( |
505 | 507 | *args, |
506 | 508 | start_date: InputDate = None, |
507 | 509 | end_date: InputDate = None, |
508 | | - extent: Union[Sequence[InputDate], Parameter, str, None] = None, |
509 | | - ) -> Union[List[Union[str, Parameter, PGNode, None]], Parameter]: |
| 510 | + extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
| 511 | + ) -> Union[List[Union[str, Parameter, PGNode, _FromNodeMixin, None]], Parameter, _FromNodeMixin]: |
510 | 512 | """Parameter aware temporal_extent normalizer""" |
511 | 513 | # TODO: move this outside of DataCube class |
512 | 514 | # TODO: return extent as tuple instead of list |
513 | | - if len(args) == 1 and isinstance(args[0], Parameter): |
| 515 | + if len(args) == 1 and isinstance(args[0], (Parameter, _FromNodeMixin)): |
514 | 516 | assert start_date is None and end_date is None and extent is None |
515 | 517 | return args[0] |
516 | | - elif len(args) == 0 and isinstance(extent, Parameter): |
| 518 | + elif len(args) == 0 and isinstance(extent, (Parameter, _FromNodeMixin)): |
517 | 519 | assert start_date is None and end_date is None |
518 | 520 | # TODO: warn about unexpected parameter schema |
519 | 521 | return extent |
520 | 522 | else: |
521 | 523 | def convertor(d: Any) -> Any: |
522 | 524 | # TODO: can this be generalized through _FromNodeMixin? |
523 | | - if isinstance(d, Parameter) or isinstance(d, PGNode): |
| 525 | + if isinstance(d, Parameter) or isinstance(d, _FromNodeMixin): |
524 | 526 | # TODO: warn about unexpected parameter schema |
525 | 527 | return d |
526 | 528 | elif isinstance(d, ProcessBuilderBase): |
@@ -556,7 +558,7 @@ def filter_temporal( |
556 | 558 | *args, |
557 | 559 | start_date: InputDate = None, |
558 | 560 | end_date: InputDate = None, |
559 | | - extent: Union[Sequence[InputDate], Parameter, str, None] = None, |
| 561 | + extent: Union[Sequence[InputDate], Parameter, str, _FromNodeMixin, None] = None, |
560 | 562 | ) -> DataCube: |
561 | 563 | """ |
562 | 564 | Limit the DataCube to a certain date range, which can be specified in several ways: |
|
0 commit comments