Skip to content

Commit

Permalink
refactor: Match documented behavior for filtering (all members, list,…
Browse files Browse the repository at this point in the history
… none)
  • Loading branch information
pawamoy committed May 6, 2023
1 parent 54ccd5b commit c7f70c3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/mkdocstrings_handlers/python/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,21 @@ def do_filter_objects(
Returns:
A list of objects.
"""
if members_list is not None:
if not members_list:
return []
return [obj for obj in objects_dictionary.values() if obj.name in set(members_list)]
# no members
if members_list is False or members_list == []:
return []

objects = list(objects_dictionary.values())

# all members
if members_list is True:
return objects

# list of members
if members_list is not None:
return [obj for obj in objects if obj.name in set(members_list)]

# none, use filters and docstrings
if filters:
objects = [obj for obj in objects if _keep_object(obj.name, filters)]
if keep_no_docstrings:
Expand Down

0 comments on commit c7f70c3

Please sign in to comment.