Skip to content
Snippets Groups Projects

Add list_element_children function

Merged Eva Bardou requested to merge add-list-element-children into master
2 files
+ 271
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 66
0
@@ -716,3 +716,69 @@ class ElementsWorker(BaseWorker):
)
return transcriptions
def list_element_children(
self,
element,
best_class=None,
folder=None,
name=None,
recursive=None,
type=None,
with_best_classes=None,
with_corpus=None,
with_has_children=None,
with_zone=None,
worker_version=None,
):
"""
List children of an element
"""
assert element and isinstance(
element, Element
), "element shouldn't be null and should be of type Element"
query_params = {}
if best_class is not None:
assert isinstance(best_class, str) or isinstance(
best_class, bool
), "best_class should be of type str or bool"
query_params["best_class"] = best_class
if folder is not None:
assert isinstance(folder, bool), "folder should be of type bool"
query_params["folder"] = folder
if name:
assert isinstance(name, str), "name should be of type str"
query_params["name"] = name
if recursive is not None:
assert isinstance(recursive, bool), "recursive should be of type bool"
query_params["recursive"] = recursive
if type:
assert isinstance(type, str), "type should be of type str"
query_params["type"] = type
if with_best_classes is not None:
assert isinstance(
with_best_classes, bool
), "with_best_classes should be of type bool"
query_params["with_best_classes"] = with_best_classes
if with_corpus is not None:
assert isinstance(with_corpus, bool), "with_corpus should be of type bool"
query_params["with_corpus"] = with_corpus
if with_has_children is not None:
assert isinstance(
with_has_children, bool
), "with_has_children should be of type bool"
query_params["with_has_children"] = with_has_children
if with_zone is not None:
assert isinstance(with_zone, bool), "with_zone should be of type bool"
query_params["with_zone"] = with_zone
if worker_version:
assert isinstance(
worker_version, str
), "worker_version should be of type str"
query_params["worker_version"] = worker_version
children = self.api_client.paginate(
"ListElementChildren", id=element.id, **query_params
)
return children
Loading