Skip to content

Commit

Permalink
jz - add docstring to _handle_operation_list in damage_model
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyan1214 committed Nov 26, 2024
1 parent 1cefb1c commit 48366de
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pelicun/model/damage_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,23 @@ def _handle_operation( # noqa: PLR6301
def _handle_operation_list(
self, initial_value: float, operations: list[tuple[str, float]]
) -> np.ndarray:
"""
Apply a list of operations to an initial value and return the results as a numpy array.
Parameters.
----------
initial_value : float
The initial value to which the operations will be applied.
operations : list of tuple
A list of operations where each operation is represented as a tuple.
The first element of the tuple is a string representing the operation type,
and the second element is a float representing the value to be used in the operation.
Returns
-------
np.ndarray
An array of results after applying each operation to the initial value.
"""
if len(operations) == 1:
return np.array(
[
Expand Down

0 comments on commit 48366de

Please sign in to comment.