7
7
8
8
This source code is licensed under the MIT license, see the LICENSE file in the root directory of this source tree.
9
9
"""
10
+ from __future__ import annotations
11
+
10
12
from functools import partial
11
13
from itertools import product
12
- from typing import Any , Callable , Dict , Generator , Iterable , List , Literal , Tuple , Union
14
+ from typing import Any , Callable , Generator , Iterable , Literal , Union
13
15
14
16
import numpy as np
15
17
import tdigest as td
@@ -34,7 +36,7 @@ def __init__(
34
36
self ,
35
37
in_feature : FeaturesSpecification ,
36
38
out_feature : FeaturesSpecification ,
37
- mode : Union [ Literal ["standard" , "timewise" , "monthly" , "total" ], Callable ] = "standard" ,
39
+ mode : Literal ["standard" , "timewise" , "monthly" , "total" ] | Callable = "standard" ,
38
40
pixelwise : bool = False ,
39
41
filternan : bool = False ,
40
42
):
@@ -119,8 +121,8 @@ def _is_output_ftype(feature_type: FeatureType, mode: ModeTypes, pixelwise: bool
119
121
120
122
121
123
def _looper (
122
- in_feature : List [FeatureSpec ], out_feature : List [FeatureSpec ], eopatch : EOPatch
123
- ) -> Generator [Tuple [FeatureSpec , FeatureSpec , np .ndarray ], None , None ]:
124
+ in_feature : list [FeatureSpec ], out_feature : list [FeatureSpec ], eopatch : EOPatch
125
+ ) -> Generator [tuple [FeatureSpec , FeatureSpec , np .ndarray ], None , None ]:
124
126
for in_feature_ , out_feature_ in zip (in_feature , out_feature ):
125
127
shape = np .array (eopatch [in_feature_ ].shape )
126
128
yield in_feature_ , out_feature_ , shape
@@ -182,7 +184,7 @@ def _process_total(input_array: np.ndarray, filternan: bool, **_: Any) -> np.nda
182
184
return _get_tdigest (input_array , filternan )
183
185
184
186
185
- _processing_function : Dict [str , Callable ] = {
187
+ _processing_function : dict [str , Callable ] = {
186
188
"standard" : _process_standard ,
187
189
"timewise" : _process_timewise ,
188
190
"monthly" : _process_monthly ,
0 commit comments