@@ -119,7 +119,7 @@ def clear(self):
119119 """Reinitialize attributes."""
120120 self ._data = dict () # {hazard_type : {id:ImpactFunc}}
121121
122- def append (self , func ):
122+ def append (self , func : ImpactFunc ):
123123 """Append a ImpactFunc. Overwrite existing if same id and haz_type.
124124
125125 Parameters
@@ -141,7 +141,7 @@ def append(self, func):
141141 self ._data [func .haz_type ] = dict ()
142142 self ._data [func .haz_type ][func .id ] = func
143143
144- def remove_func (self , haz_type = None , fun_id = None ):
144+ def remove_func (self , haz_type : str = None , fun_id : str | int = None ):
145145 """Remove impact function(s) with provided hazard type and/or id.
146146 If no input provided, all impact functions are removed.
147147
@@ -225,7 +225,7 @@ def get_func(
225225 else :
226226 return self ._data
227227
228- def get_hazard_types (self , fun_id = None ) :
228+ def get_hazard_types (self , fun_id : str | int ) -> list [ str ] :
229229 """Get impact functions hazard types contained for the id provided.
230230 Return all hazard types if no input id.
231231
@@ -247,7 +247,7 @@ def get_hazard_types(self, fun_id=None):
247247 haz_types .append (vul_haz )
248248 return haz_types
249249
250- def get_ids (self , haz_type = None ):
250+ def get_ids (self , haz_type : str = None ) -> list [ int | str ] :
251251 """Get impact functions ids contained for the hazard type provided.
252252 Return all ids for each hazard type if no input hazard type.
253253
@@ -272,7 +272,7 @@ def get_ids(self, haz_type=None):
272272 except KeyError :
273273 return list ()
274274
275- def size (self , haz_type = None , fun_id = None ):
275+ def size (self , haz_type : str = None , fun_id : str | int = None ) -> int :
276276 """Get number of impact functions contained with input hazard type and
277277 /or id. If no input provided, get total number of impact functions.
278278
@@ -316,7 +316,7 @@ def check(self):
316316 )
317317 vul .check ()
318318
319- def extend (self , impact_funcs ):
319+ def extend (self , impact_funcs : ImpactFuncSet ):
320320 """Append impact functions of input ImpactFuncSet to current
321321 ImpactFuncSet. Overwrite ImpactFunc if same id and haz_type.
322322
@@ -339,7 +339,7 @@ def extend(self, impact_funcs):
339339 for _ , vul in vul_dict .items ():
340340 self .append (vul )
341341
342- def plot (self , haz_type = None , fun_id = None , axis = None , ** kwargs ):
342+ def plot (self , haz_type : str = None , fun_id : str | int = None , axis = None , ** kwargs ):
343343 """Plot impact functions of selected hazard (all if not provided) and
344344 selected function id (all if not provided).
345345
0 commit comments