@@ -383,6 +383,9 @@ def __init__(self, output_file_path, logger_name=None):
383
383
384
384
with open (self .output_file_path , encoding = 'utf-8' ) as f :
385
385
self ._lines = list (f .readlines ())
386
+
387
+ self .is_ags_clgs_style_output = '***AGS/CLGS STYLE OUTPUT***' in [_l .strip () for _l in self ._lines ]
388
+
386
389
self ._lines_by_category = self ._get_lines_by_category ()
387
390
388
391
# TODO generic-er result value map
@@ -394,15 +397,16 @@ def __init__(self, output_file_path, logger_name=None):
394
397
395
398
self .result [category ] = {}
396
399
category_lines = self ._lines_by_category .get (category , [])
400
+ search_lines = category_lines if not self .is_ags_clgs_style_output else self ._lines
397
401
398
402
for field in fields :
399
403
if isinstance (field , _EqualSignDelimitedField ):
400
404
self .result [category ][field .field_name ] = self ._get_equal_sign_delimited_field (
401
- field .field_name , search_lines = category_lines
405
+ field .field_name , search_lines = search_lines
402
406
)
403
407
elif isinstance (field , _UnlabeledStringField ):
404
408
self .result [category ][field .field_name ] = self ._get_unlabeled_string_field (
405
- field .field_name , field .marker_prefixes , search_lines = category_lines
409
+ field .field_name , field .marker_prefixes , search_lines = search_lines
406
410
)
407
411
else :
408
412
is_string_field = isinstance (field , _StringValueField )
@@ -412,7 +416,7 @@ def __init__(self, output_file_path, logger_name=None):
412
416
field_name ,
413
417
is_string_value_field = is_string_field ,
414
418
min_indentation_spaces = indent ,
415
- search_lines = category_lines ,
419
+ search_lines = search_lines ,
416
420
)
417
421
418
422
try :
@@ -465,6 +469,12 @@ def _get_lines_by_category(self) -> dict[str, list[str]]:
465
469
for line in self ._lines :
466
470
467
471
def get_header_content (h_ : str ) -> str :
472
+ """
473
+ TODO adjust this to also work with AGS/CLGS-style headers like '### Cost Results ###'
474
+ For now, AGS-style results are parsed from all lines according to the categories defined in
475
+ _RESULT_FIELDS_BY_CATEGORY.
476
+ """
477
+
468
478
if h_ == 'Simulation Metadata' :
469
479
return h_
470
480
return f'***{ h_ } ***'
0 commit comments