Skip to content

Commit 802eefc

Browse files
committed
Fix Callable signature type hint incompatible with 3.10
1 parent a178970 commit 802eefc

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

climada/trajectories/interpolation.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,6 @@
3939
"exponential_interp_imp_mat",
4040
]
4141

42-
# Define a type alias for the expected signature of the metric interpolation functions
43-
# (e.g., linear_interp_arrays)
44-
MetricInterpFunc = Callable[Concatenate[np.ndarray, np.ndarray, ...], np.ndarray]
45-
46-
# Define a type alias for the expected signature of the matrix interpolation function
47-
# (e.g., linear_interp_imp_mat)
48-
MatrixInterpFunc = Callable[
49-
Concatenate[sparse.csr_matrix, sparse.csr_matrix, int, ...],
50-
List[sparse.csr_matrix],
51-
]
52-
5342

5443
def linear_interp_imp_mat(
5544
mat_start: sparse.csr_matrix,
@@ -283,29 +272,30 @@ class InterpolationStrategyBase(ABC):
283272
284273
Attributes
285274
----------
286-
exposure_interp : MatrixInterpFunc
275+
exposure_interp : Callable
287276
The function used to interpolate sparse impact matrices over the
288277
exposure dimension.
289278
Signature: (mat_start, mat_end, num_points, **kwargs) -> list[sparse.csr_matrix].
290-
hazard_interp : MetricInterpFunc
279+
hazard_interp : Callable
291280
The function used to interpolate NumPy arrays of metrics over the
292281
hazard dimension.
293282
Signature: (arr_start, arr_end, **kwargs) -> np.ndarray.
294-
vulnerability_interp : MetricInterpFunc
283+
vulnerability_interp : Callable
295284
The function used to interpolate NumPy arrays of metrics over the
296285
vulnerability dimension.
297286
Signature: (arr_start, arr_end, **kwargs) -> np.ndarray.
298287
"""
299288

300-
exposure_interp: MatrixInterpFunc
301-
hazard_interp: MetricInterpFunc
302-
vulnerability_interp: MetricInterpFunc
289+
exposure_interp: Callable
290+
hazard_interp: Callable
291+
vulnerability_interp: Callable
303292

304293
def interp_over_exposure_dim(
305294
self,
306295
imp_E0: sparse.csr_matrix,
307296
imp_E1: sparse.csr_matrix,
308297
interpolation_range: int,
298+
/,
309299
**kwargs: Optional[Dict[str, Any]],
310300
) -> List[sparse.csr_matrix]:
311301
"""
@@ -356,6 +346,7 @@ def interp_over_hazard_dim(
356346
self,
357347
metric_0: np.ndarray,
358348
metric_1: np.ndarray,
349+
/,
359350
**kwargs: Optional[Dict[str, Any]],
360351
) -> np.ndarray:
361352
"""
@@ -384,6 +375,7 @@ def interp_over_vulnerability_dim(
384375
self,
385376
metric_0: np.ndarray,
386377
metric_1: np.ndarray,
378+
/,
387379
**kwargs: Optional[Dict[str, Any]],
388380
) -> np.ndarray:
389381
"""

0 commit comments

Comments
 (0)