From d4cae0936de716f66f6582e683b665dc298a949f Mon Sep 17 00:00:00 2001 From: fspreck <f.spreckelsen@indiscale.com> Date: Mon, 6 Dec 2021 16:30:33 +0100 Subject: [PATCH] DOC: Add docstring --- src/caosadvancedtools/crawler.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index ea7527bb..5d91d85c 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -66,10 +66,25 @@ def separated(text): return "-"*60 + "\n" + text -def apply_list_of_updates(to_be_updated, update_flags, +def apply_list_of_updates(to_be_updated, update_flags={}, update_cache=None, run_id=None): - """ - Updates the to_be_updated Container, i.e. pushes the changes to CaosDB + """Updates the `to_be_updated` Container, i.e., pushes the changes to CaosDB + after removing possible duplicates. If a chace is provided, uauthorized + updates can be cached for further authorization. + + Parameters: + ----------- + to_be_updated : db.Container + Container with the entities that will be updated. + update_flags : dict, optional + Dictionary of CaosDB server flags that will be used for the + update. Default is an empty dict. + update_cache : UpdateCache or None, optional + Cache in which the intended updates will be stored so they can be + authorized afterwards. Default is None. + run_id : String or None, optional + Id with which the pending updates are cached. Only meaningful if + `update_cache` is provided. Default is None. """ if len(to_be_updated) == 0: @@ -90,9 +105,10 @@ def apply_list_of_updates(to_be_updated, update_flags, baseurl = db.configuration.get_config()["Connection"]["url"] + def make_clickable(txt, id): + return "<a href='{}/Entity/{}'>{}</a>".format(baseurl, id, txt) + for el in to_be_updated: - def make_clickable(txt, id): - return "<a href='{}/Entity/{}'>{}</a>".format(baseurl, id, txt) info += str("\t" + make_clickable(el.name, el.id) if el.name is not None else "\t" + make_clickable(str(el.id), el.id)) -- GitLab