Skip to content

Commit

Permalink
fix: rendering numbers in csv/tsv
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Dec 11, 2024
1 parent 628618f commit 9b7a24d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions trove/render/simple_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ def _row_values(self, osfmap_json: dict) -> list[str]:
]

def _row_field_value(self, osfmap_json: dict, field_path: Jsonpath) -> str:
return _MULTIVALUE_DELIMITER.join(
_rendered_values = [
_render_tabularly(_obj)
for _obj in _iter_values(osfmap_json, field_path)
)
]
if len(_rendered_values) == 1:
return _rendered_values[0] # preserve type for single numbers
# for multiple values, can only be a string
return _MULTIVALUE_DELIMITER.join(map(str, _rendered_values))


def _osfmap_jsonpath(iri_path: typing.Iterable[str]) -> Jsonpath:
Expand Down

0 comments on commit 9b7a24d

Please sign in to comment.