MCPcopy
hub / github.com/treeverse/dvc / _format

Function _format

dvc/compare.py:284–293  ·  view source on GitHub ↗
(_val)

Source from the content-addressed store, hash-verified

282 val: Any, precision: Optional[int] = None, round_digits: bool = False
283) -> str:
284 def _format(_val):
285 if isinstance(_val, float) and precision:
286 if round_digits:
287 return round(_val, precision)
288 return _normalize_float(_val, precision)
289 if isinstance(_val, abc.Mapping):
290 return {k: _format(v) for k, v in _val.items()}
291 if isinstance(_val, list):
292 return [_format(x) for x in _val]
293 return _val
294
295 return str(_format(val))
296

Callers 1

_format_fieldFunction · 0.85

Calls 2

_normalize_floatFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected