Skip to content

Commit

Permalink
Improve doc strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jul 4, 2023
1 parent c701030 commit aaf020f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions order/unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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:
Expand Down

0 comments on commit aaf020f

Please sign in to comment.