mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7680 from tk0miya/7676_validate_member_order
Fix #7676: autodoc: wrong value for :member-order: option is ignored silently
This commit is contained in:
commit
d5a3af4cbf
1
CHANGES
1
CHANGES
@ -98,6 +98,7 @@ Bugs fixed
|
|||||||
specified
|
specified
|
||||||
* #7650: autodoc: undecorated signature is shown for decorated functions
|
* #7650: autodoc: undecorated signature is shown for decorated functions
|
||||||
* #7676: autodoc: typo in the default value of autodoc_member_order
|
* #7676: autodoc: typo in the default value of autodoc_member_order
|
||||||
|
* #7676: autodoc: wrong value for :member-order: option is ignored silently
|
||||||
* #7551: autosummary: a nested class is indexed as non-nested class
|
* #7551: autosummary: a nested class is indexed as non-nested class
|
||||||
* #7661: autosummary: autosummary directive emits warnings twices if failed to
|
* #7661: autosummary: autosummary directive emits warnings twices if failed to
|
||||||
import the target module
|
import the target module
|
||||||
|
@ -15,7 +15,9 @@ import re
|
|||||||
import warnings
|
import warnings
|
||||||
from inspect import Parameter
|
from inspect import Parameter
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Sequence, Set, Tuple, Type, Union
|
from typing import (
|
||||||
|
Any, Callable, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Type, Union
|
||||||
|
)
|
||||||
|
|
||||||
from docutils.statemachine import StringList
|
from docutils.statemachine import StringList
|
||||||
|
|
||||||
@ -92,6 +94,16 @@ def inherited_members_option(arg: Any) -> Union[object, Set[str]]:
|
|||||||
return arg
|
return arg
|
||||||
|
|
||||||
|
|
||||||
|
def member_order_option(arg: Any) -> Optional[str]:
|
||||||
|
"""Used to convert the :members: option to auto directives."""
|
||||||
|
if arg is None:
|
||||||
|
return None
|
||||||
|
elif arg in ('alphabetical', 'bysource', 'groupwise'):
|
||||||
|
return arg
|
||||||
|
else:
|
||||||
|
raise ValueError(__('invalid value for member-order option: %s') % arg)
|
||||||
|
|
||||||
|
|
||||||
SUPPRESS = object()
|
SUPPRESS = object()
|
||||||
|
|
||||||
|
|
||||||
@ -826,7 +838,7 @@ class ModuleDocumenter(Documenter):
|
|||||||
'noindex': bool_option, 'inherited-members': inherited_members_option,
|
'noindex': bool_option, 'inherited-members': inherited_members_option,
|
||||||
'show-inheritance': bool_option, 'synopsis': identity,
|
'show-inheritance': bool_option, 'synopsis': identity,
|
||||||
'platform': identity, 'deprecated': bool_option,
|
'platform': identity, 'deprecated': bool_option,
|
||||||
'member-order': identity, 'exclude-members': members_set_option,
|
'member-order': member_order_option, 'exclude-members': members_set_option,
|
||||||
'private-members': bool_option, 'special-members': members_option,
|
'private-members': bool_option, 'special-members': members_option,
|
||||||
'imported-members': bool_option, 'ignore-module-all': bool_option
|
'imported-members': bool_option, 'ignore-module-all': bool_option
|
||||||
} # type: Dict[str, Callable]
|
} # type: Dict[str, Callable]
|
||||||
@ -1159,7 +1171,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
|
|||||||
option_spec = {
|
option_spec = {
|
||||||
'members': members_option, 'undoc-members': bool_option,
|
'members': members_option, 'undoc-members': bool_option,
|
||||||
'noindex': bool_option, 'inherited-members': inherited_members_option,
|
'noindex': bool_option, 'inherited-members': inherited_members_option,
|
||||||
'show-inheritance': bool_option, 'member-order': identity,
|
'show-inheritance': bool_option, 'member-order': member_order_option,
|
||||||
'exclude-members': members_set_option,
|
'exclude-members': members_set_option,
|
||||||
'private-members': bool_option, 'special-members': members_option,
|
'private-members': bool_option, 'special-members': members_option,
|
||||||
} # type: Dict[str, Callable]
|
} # type: Dict[str, Callable]
|
||||||
|
Loading…
Reference in New Issue
Block a user