Skip to content

Commit

Permalink
fix a unit test and some ruff formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zsarnoczay committed Feb 4, 2025
1 parent 7a74144 commit 372e1de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 0 additions & 5 deletions pelicun/assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
'3_excessiveRID': {'DS1': 'irreparable_DS1'},
'4_irreparable': {'DS1': 'ALL_NA'},
'5_irreparable': {'DS1': 'collapse_DS0'},

},
# TODO(AZ): expand with ground failure logic
'Hazus Earthquake': {
Expand Down Expand Up @@ -985,9 +984,7 @@ def calculate_damage( # noqa: C901
component_db = []

if component_database_path is not None:

if 'CustomDLDataFolder' in component_database_path:

if custom_model_dir is None:
msg = (
'`custom_model_dir` needs to be specified '
Expand Down Expand Up @@ -1506,9 +1503,7 @@ def load_consequence_info(
conseq_df = pd.DataFrame()

if consequence_database_path is not None:

if 'CustomDLDataFolder' in consequence_database_path:

if custom_model_dir is None:
msg = (
'When `consequence_database_path` includes CustomDLDataFolder, '
Expand Down
5 changes: 5 additions & 0 deletions pelicun/tests/basic/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,11 @@ def test_parse_units() -> None:
'lbf': 4.4482179868,
'kip': 4448.2179868,
'kips': 4448.2179868,
'Npm': 1.0,
'kNpm': 1000.0,
'lbpft': 14.5939,
'kippft': 14593.9,
'kipspft': 14593.9,
'Pa': 1.0,
'kPa': 1000.0,
'MPa': 1000000.0,
Expand Down
9 changes: 6 additions & 3 deletions pelicun/tools/DL_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,12 @@ def _parse_config_file( # noqa: C901

# Ensure `DL/Damage/CollapseFragility` contains all required keys.
if is_specified(config, 'DL/Damage/CollapseFragility'):
if is_unspecified(config,'DL/Damage/CollapseFragility/CapacityDistribution'):
config['DL']['Damage']['CollapseFragility']['CapacityDistribution'] = 'deterministic'
if is_unspecified(
config, 'DL/Damage/CollapseFragility/CapacityDistribution'
):
config['DL']['Damage']['CollapseFragility']['CapacityDistribution'] = (
'deterministic'
)
config['DL']['Damage']['CollapseFragility']['Theta_1'] = 'N/A'

for thing in ('CapacityDistribution', 'CapacityMedian', 'Theta_1'):
Expand All @@ -850,7 +854,6 @@ def _parse_config_file( # noqa: C901
f' in the configuration file.'
)
raise PelicunInvalidConfigError(msg)


# Ensure `DL/Damage/IrreparableDamage` contains all required keys.
if is_specified(config, 'DL/Damage/IrreparableDamage'):
Expand Down

0 comments on commit 372e1de

Please sign in to comment.