diff --git a/doc/source/examples/notebooks/example_4.pct.py b/doc/source/examples/notebooks/example_4.pct.py index 56bd6a00..7f875f56 100644 --- a/doc/source/examples/notebooks/example_4.pct.py +++ b/doc/source/examples/notebooks/example_4.pct.py @@ -1,7 +1,5 @@ # %% [markdown] -""" -# Example 4: A loss assessment including both damage states and loss functions. -""" +"""# Example 4: A loss assessment including both damage states and loss functions.""" # %% import tempfile @@ -14,7 +12,6 @@ from pelicun import assessment, file_io from pelicun.pelicun_warnings import PelicunWarning - temp_dir = tempfile.mkdtemp() sample_size = 10000 @@ -77,8 +74,9 @@ # Generate samples asmnt.demand.generate_sample({'SampleSize': sample_size}) + def add_more_edps() -> None: - """Adds SA_1.13 and residual drift to the demand sample.""" + """Add SA_1.13 and residual drift to the demand sample.""" # Add residual drift and Sa demand_sample = asmnt.demand.save_sample() @@ -107,6 +105,7 @@ def add_more_edps() -> None: asmnt.demand.load_sample(demand_sample_ext) + add_more_edps() # @@ -117,9 +116,7 @@ def add_more_edps() -> None: asmnt.stories = 1 # Load component definitions -cmp_marginals = pd.read_csv( - 'example_4/CMP_marginals.csv', index_col=0 -) +cmp_marginals = pd.read_csv('example_4/CMP_marginals.csv', index_col=0) cmp_marginals['Blocks'] = cmp_marginals['Blocks'] asmnt.asset.load_cmp_model({'marginals': cmp_marginals}) diff --git a/pelicun/model/damage_model.py b/pelicun/model/damage_model.py index afeada00..8977df1d 100644 --- a/pelicun/model/damage_model.py +++ b/pelicun/model/damage_model.py @@ -1362,7 +1362,7 @@ def parse_scaling_specification(scaling_specification: dict) -> dict: # noqa: C """ # if there are contents, ensure they are valid. # See docstring for an example of what is expected. - parsed_scaling_specification = defaultdict(dict) + parsed_scaling_specification: dict = defaultdict(dict) # validate contents for key, value in scaling_specification.items(): # loop through limit states diff --git a/pelicun/tests/basic/test_damage_model.py b/pelicun/tests/basic/test_damage_model.py index eb079a15..51d57676 100644 --- a/pelicun/tests/basic/test_damage_model.py +++ b/pelicun/tests/basic/test_damage_model.py @@ -591,6 +591,8 @@ def test__create_dmg_RVs(self, assessment_instance: Assessment) -> None: for rv_name, rv in capacity_rv_reg.RV.items(): uniform_sample = rv._uni_sample sample = rv.sample + assert uniform_sample is not None + assert sample is not None for i in range(len(operation_list)): if rv_name == 'FRG-cmp.A-1-2-3-1-1': theta = 1.20 * 30.0