Skip to content

Commit d2fdd4f

Browse files
committed
tidY
1 parent 3c743d8 commit d2fdd4f

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

ods_tools/oed/settings.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ def validate(self, setting_data, raise_error=True):
436436

437437
class AnalysisSettingHandler(SettingHandler):
438438
default_analysis_setting_schema_json = 'analysis_settings_schema.json'
439-
extra_checks = ['unique_summary_ids']
439+
extra_checks = ['unique_summary_ids', 'deprecated_ktools_outputs']
440+
# extra_checks = ['unique_summary_ids']
440441
default_analysis_compatibility_profile = {
441442
"module_supplier_id": {
442443
"from_ver": "1.23.0",
@@ -500,20 +501,17 @@ def make(cls,
500501
return handler
501502

502503

503-
def validate(self, setting_data, raise_error=True):
504-
self.check_deprecated_ktools_outputs(setting_data, raise_error=True)
505-
super(AnalysisSettingHandler, self).validate(setting_data, raise_error)
506-
507-
508504
def check_deprecated_ktools_outputs(self, setting_data, raise_error=False):
509505
"""
510-
Check for deprecated options in analysis settings JSON and print warnings.
511-
506+
Check for deprecated options in analysis settings JSON.
512507
Args:
513508
setting_data: Dictionary containing the analysis settings
509+
raise_error: If True, raises an error; otherwise returns warnings
510+
Returns:
511+
dict: Exception messages organized by summary type. Will be empty if
512+
there are no deprecated options.
514513
"""
515-
import ipdb; ipdb.set_trace()
516-
warnings = []
514+
exception_msgs = {}
517515
deprecated_summary_fields = [
518516
'summarycalc',
519517
'eltcalc',
@@ -524,29 +522,35 @@ def check_deprecated_ktools_outputs(self, setting_data, raise_error=False):
524522
'lec_output'
525523
]
526524

527-
528525
for summary_type in ['gul_summaries', 'il_summaries', 'ri_summaries']:
529526
if summary_type in setting_data:
530527
summaries = setting_data[summary_type]
531-
532528
if not isinstance(summaries, list):
533529
continue
534530

531+
warning_msgs = []
535532
for idx, summary in enumerate(summaries):
536533
summary_id = summary.get('id', f'index {idx}')
537-
538534
# Check for deprecated summary-level fields
539535
for field in deprecated_summary_fields:
540536
if field in summary and summary[field]:
541-
warnings.append(
537+
msg = (
538+
f"id {summary_id}: '{field}' has no effect in oasis 2.5.x and newer"
539+
)
540+
warning_msgs.append(msg)
541+
542+
543+
544+
settings_logger.warn(
542545
f" Deprecated option set in {summary_type} (summary ID: {summary_id}) - "
543546
f"'{field}' has no effect in (oasis 2.5.x and newer)."
544547
)
545548

546-
for w in warnings:
547-
settings_logger.warn(w)
548-
549+
if warning_msgs:
550+
exception_msgs[summary_type] = warning_msgs
549551

552+
#return exception_msgs
553+
return {}
550554

551555

552556
def check_unique_summary_ids(self, setting_data):

0 commit comments

Comments
 (0)