Suggestion: rewrite the relevant function as
def shorten_mapping(obj: Union[dict, Mapping], max_keys: int) -> dict:
if len(obj) <= max_keys:
return obj
return {
**{k: obj[k] for k in itertools.islice(obj.keys(), max_keys)},
"...": "..."
}
The ordering is not preserved, but that's ok given the default size is 10.
For a developer reading logs, it is imperative to know whether truncation took place.
Thanks
Suggestion: rewrite the relevant function as
The ordering is not preserved, but that's ok given the default size is 10.
For a developer reading logs, it is imperative to know whether truncation took place.
Thanks