Skip to content

Commit

Permalink
join process_sections and transform_summary into a single function
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed Aug 4, 2023
1 parent b07a9e6 commit be02db9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions ceos_alos2/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def transform_label_info(section):
return Group(path=None, url=None, data={}, attrs=attrs)


def process_sections(sections):
def transform_summary(summary):
transformers = {
"odi": transform_ordering_info,
"scs": transform_scene_spec,
Expand All @@ -218,12 +218,9 @@ def process_sections(sections):
"lbi": transform_label_info,
}

return apply_to_items(transformers, sections)


def transform_summary(summary):
return pipe(
summary,
curry(apply_to_items, transformers),
curry(rename, translations=section_names),
curry(Group, "summary", None, attrs={}),
)
Expand All @@ -239,6 +236,5 @@ def open_summary(mapper, path):
) from e

raw_summary = parse_summary(bytes_.decode())
processed = process_sections(raw_summary)

return transform_summary(processed)
return transform_summary(raw_summary)

0 comments on commit be02db9

Please sign in to comment.