From c3aba7831b1d03bfc3baf4fbd367fef39a58c7a4 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Sun, 31 Mar 2024 12:26:51 +0200 Subject: [PATCH] updated function to list names of all vis com docs in database --- core/database/utils/list_names.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) mode change 100644 => 100755 core/database/utils/list_names.py diff --git a/core/database/utils/list_names.py b/core/database/utils/list_names.py old mode 100644 new mode 100755 index e9cd624..6184166 --- a/core/database/utils/list_names.py +++ b/core/database/utils/list_names.py @@ -1,3 +1,7 @@ +""" +Definition of function to list names +of all visual communication documents in database. +""" from __future__ import annotations from pymongo.collection import Collection @@ -5,14 +9,14 @@ from pymongo.collection import Collection def list_names( collection: Collection, - has_annotation: bool = True, + only_with_annotation: bool = True, ) -> list[str]: """List the names of entries that match the filters.""" assert isinstance(collection, Collection) - assert isinstance(has_annotation, bool) + assert isinstance(only_with_annotation, bool) # build query query = {} - if has_annotation: + if only_with_annotation: query['annotation'] = {'$ne': None} # execute query res_list = collection.find(