From aaf020f08a8c7c47d480db6ce3105f452edec88a Mon Sep 17 00:00:00 2001 From: Marcel R Date: Tue, 4 Jul 2023 14:24:17 +0200 Subject: [PATCH] Improve doc strings. --- order/unique.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/order/unique.py b/order/unique.py index afd971d..7dbd32c 100644 --- a/order/unique.py +++ b/order/unique.py @@ -854,7 +854,8 @@ def get(self, obj, default=_no_default): def has(self, obj, deep=True): """ Checks if the :py:attr:`{plural}` index contains an *obj* which might be a *name*, - *id*, or an instance. If *deep* is *True*, the lookup is recursive. + *id*, or an instance. If *deep* is *True*, the lookup is recursive through + potentially nested child {plural}. """ return getattr(self, "get_" + singular)( obj, @@ -868,8 +869,8 @@ def get(self, obj, deep=True, default=_no_default): """ get_{singular}(obj, deep=True, default=no_default) Returns a child {singular} given by *obj*, which might be a *name*, *id*, or an instance from the :py:attr:`{plural}` index. If *deep* is *True*, the lookup is - recursive. When no {singular} is found, *default* is returned when set. Otherwise, - an error is raised. + recursive through potentially nested child {plural}. When no {singular} is found, + *default* is returned when set. Otherwise, an error is raised. """ indexes = [getattr(self, plural)] while len(indexes) > 0: @@ -1131,7 +1132,8 @@ def get(self, obj, default=_no_default): # noqa: F811 def has(self, obj, deep=True): """ Checks if the :py:attr:`parent_{plural}` index contains an *obj*, which might be - a *name*, *id*, or an instance. If *deep* is *True*, the lookup is recursive. + a *name*, *id*, or an instance. If *deep* is *True*, the lookup is recursive + through potentially nested parent {plural}. """ return getattr(self, "get_parent_" + singular)( obj, @@ -1145,8 +1147,9 @@ def get(self, obj, deep=True, default=_no_default): """ get_parent_{singular}(obj, deep=True, default=no_default) Returns a parent {singular} given by *obj*, which might be a *name*, *id*, or an instance from the :py:attr:`parent_{plural}` index. If *deep* is *True*, the - lookup is recursive. When no {singular} is found, *default* is returned when - set. Otherwise, an error is raised. + lookup is recursive through potentially nested parent {plural}. When no + {singular} is found, *default* is returned when set. Otherwise, an error is + raised. """ indexes = [getattr(self, "parent_" + plural)] while len(indexes) > 0: