|
24 | 24 | import copy |
25 | 25 | import logging |
26 | 26 | from itertools import repeat |
27 | | -from typing import Iterable, Optional |
| 27 | +from typing import Dict, Iterable, Optional, Union, overload |
28 | 28 |
|
29 | 29 | import matplotlib.pyplot as plt |
30 | 30 | import numpy as np |
@@ -173,7 +173,23 @@ def remove_func(self, haz_type=None, fun_id=None): |
173 | 173 | else: |
174 | 174 | self._data = dict() |
175 | 175 |
|
176 | | - def get_func(self, haz_type=None, fun_id=None): |
| 176 | + @overload |
| 177 | + def get_func(self, haz_type: str, fun_id: int) -> ImpactFunc: ... |
| 178 | + |
| 179 | + @overload |
| 180 | + def get_func(self, haz_type: str, fun_id: None = None) -> list[ImpactFunc]: ... |
| 181 | + |
| 182 | + @overload |
| 183 | + def get_func(self, haz_type: None, fun_id: int) -> list[ImpactFunc]: ... |
| 184 | + |
| 185 | + @overload |
| 186 | + def get_func( |
| 187 | + self, haz_type: None = None, fun_id: None = None |
| 188 | + ) -> Dict[str, Dict[int, ImpactFunc]]: ... |
| 189 | + |
| 190 | + def get_func( |
| 191 | + self, haz_type: Optional[str] = None, fun_id: Optional[int] = None |
| 192 | + ) -> Union[ImpactFunc, list[ImpactFunc], Dict[str, Dict[int, ImpactFunc]]]: |
177 | 193 | """Get ImpactFunc(s) of input hazard type and/or id. |
178 | 194 | If no input provided, all impact functions are returned. |
179 | 195 |
|
|
0 commit comments