@@ -126,7 +126,7 @@ def get_ancestors(
126126 include_self (bool, optional): If True, include the term itself in the result. Defaults to False.
127127
128128 Returns:
129- set[str]: A list of ancestor term IDs.
129+ set[str]: A list of ancestor term IDs. None in case of having no ancestors.
130130
131131 Raises:
132132 KeyError: If the term_id is not found in the ontology.
@@ -161,7 +161,7 @@ def get_ancestors_with_distance(
161161 include_self (bool): Whether to include the term itself at distance 0.
162162
163163 Returns:
164- Iterator(tuple[Term, int]): Pairs of ancestor term objects and their distance (non- negative integer).
164+ Iterator(tuple[Term, int]): Pairs of ancestor term objects and their distance (negative integer).
165165
166166 Raises:
167167 KeyError: If the term is not found in the ontology.
@@ -171,7 +171,7 @@ def get_ancestors_with_distance(
171171 term = self .get_term (term_id )
172172 except KeyError :
173173 logger .exception (f"Term ID '{ term_id } ' not found in ontology." )
174- return iter ([] )
174+ return iter (() )
175175
176176 visited = set ()
177177 queue = deque ()
@@ -246,7 +246,7 @@ def get_descendants_with_distance(
246246 include_self (bool): Whether to include the term itself at distance 0.
247247
248248 Returns:
249- Iterator[tuple[Term, int]]: Generator of (descendant term, distance) pairs.
249+ Iterator[tuple[Term, int]]: Generator of (descendant term, distance) pairs. Distance in positive numbers.
250250
251251 Raises:
252252 KeyError: If the term ID is not found in the ontology.
@@ -255,7 +255,7 @@ def get_descendants_with_distance(
255255 term = self .get_term (term_id )
256256 except KeyError :
257257 logger .exception (f"Term ID '{ term_id } ' not found in ontology." )
258- return iter ([] )
258+ return iter (() )
259259
260260 visited = set ()
261261 queue = deque ()
0 commit comments