File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/mkdocstrings_handlers/python/_internal Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,15 @@ def _sort_key_source(item: CollectorItem) -> float:
6262 return item .lineno if item .lineno is not None else float ("inf" )
6363
6464
65- def _sort__all__ (item : CollectorItem ) -> float : # noqa: ARG001
66- raise ValueError ("Not implemented in public version of mkdocstrings-python" )
65+ def _sort__all__ (item : CollectorItem ) -> float :
66+ if item .parent .exports is not None :
67+ try :
68+ return item .parent .exports .index (item .name )
69+ except ValueError :
70+ # If the item is not in `__all__`, it will go to the end of the list.
71+ return float ("inf" )
72+ # No exports declared, refuse to sort (try other methods or return members as they are).
73+ raise ValueError (f"Parent object { item .parent .path } doesn't declare exports" )
6774
6875
6976Order = Literal ["__all__" , "alphabetical" , "source" ]
You can’t perform that action at this time.
0 commit comments