Skip to content
Snippets Groups Projects
Commit b4f20073 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

doc(apiutils): Added type hints and a comprehensive docstring to describe_diff function

parent eb79cfbd
Branches
Tags
2 merge requests!159Release 0.16.o,!154Added the possibility to use custom labels instead of 'old' and 'new'
Pipeline #56799 passed with warnings
......@@ -512,7 +512,36 @@ def merge_entities(entity_a: Entity,
return entity_a
def describe_diff(olddiff, newdiff, name=None, as_update=True):
def describe_diff(olddiff: dict[str, Any], newdiff: dict[str, Any],
name: str=None,
as_update=True,
label_old="old version",
label_new="new version"):
"""
Generate a textual description of the differences between two entities.
These can be generated using :func:`compare_entities` and used within this function like this:
`describe_diff(*compare_entities(...))`
Arguments:
----------
olddiff: dict[str, Any]
First element of the tuple output of :func:`compare_entities`.
This is referred to as the "old" version.
newdiff: dict[str, Any]
Second element of the tuple output of :func:`compare_entities`.
This is referred to as the "new" version.
name: str
Default None. Name of the entity that will be shown in the output text.
as_update: bool
Default True. Not used anymore.
"""
description = ""
for attr in list(set(list(olddiff.keys()) + list(newdiff.keys()))):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment