Skip to content

Commit

Permalink
assume leaf fields are unique, do not require nested structure from u…
Browse files Browse the repository at this point in the history
…sers

ie use exit_code rather than execution_summary.exit_code
  • Loading branch information
asmacdo committed Jan 21, 2025
1 parent 39e0e0f commit efed3a6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/con_duct/suite/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,21 @@ def process_run_data(
return output_rows

Check warning on line 34 in src/con_duct/suite/ls.py

View check run for this annotation

Codecov / codecov/patch

src/con_duct/suite/ls.py#L30-L34

Added lines #L30 - L34 were not covered by tests


def _flatten_dict(d, parent_key="", sep="."):
"""Flatten a nested dictionary, creating keys as dot-separated paths."""
def _flatten_dict(d):
items = []

Check warning on line 38 in src/con_duct/suite/ls.py

View check run for this annotation

Codecov / codecov/patch

src/con_duct/suite/ls.py#L38

Added line #L38 was not covered by tests
for k, v in d.items():
new_key = f"{parent_key}{sep}{k}" if parent_key else k
if isinstance(v, dict):
items.extend(_flatten_dict(v, new_key, sep=sep).items())
items.extend(_flatten_dict(v).items())

Check warning on line 41 in src/con_duct/suite/ls.py

View check run for this annotation

Codecov / codecov/patch

src/con_duct/suite/ls.py#L41

Added line #L41 was not covered by tests
else:
items.append((new_key, v))
items.append((k, v))
return dict(items)

Check warning on line 44 in src/con_duct/suite/ls.py

View check run for this annotation

Codecov / codecov/patch

src/con_duct/suite/ls.py#L43-L44

Added lines #L43 - L44 were not covered by tests


def _restrict_row(field_list, row):
restricted = OrderedDict()

Check warning on line 48 in src/con_duct/suite/ls.py

View check run for this annotation

Codecov / codecov/patch

src/con_duct/suite/ls.py#L48

Added line #L48 was not covered by tests
for k, v in row.items():
# output_paths.prefix is the unique key
if k in field_list or k == "output_paths.prefix":
# prefix is the unique key
if k in field_list or k == "prefix":
restricted[k.split(".")[-1]] = v
return restricted

Check warning on line 53 in src/con_duct/suite/ls.py

View check run for this annotation

Codecov / codecov/patch

src/con_duct/suite/ls.py#L52-L53

Added lines #L52 - L53 were not covered by tests

Expand Down

0 comments on commit efed3a6

Please sign in to comment.