mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7679 from tk0miya/7676_autodoc_member_order_alphabetical
Fix #7676: autodoc: typo in the default value of autodoc_member_order
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -93,6 +93,7 @@ Bugs fixed
|
|||||||
* #7629: autodoc: autofunction emits an unfriendly warning if an invalid object
|
* #7629: autodoc: autofunction emits an unfriendly warning if an invalid object
|
||||||
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
|
||||||
* #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
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ from docutils.statemachine import StringList
|
|||||||
|
|
||||||
import sphinx
|
import sphinx
|
||||||
from sphinx.application import Sphinx
|
from sphinx.application import Sphinx
|
||||||
from sphinx.config import ENUM
|
from sphinx.config import Config, ENUM
|
||||||
from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning
|
from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning
|
||||||
from sphinx.environment import BuildEnvironment
|
from sphinx.environment import BuildEnvironment
|
||||||
from sphinx.ext.autodoc.importer import import_object, get_module_members, get_object_members
|
from sphinx.ext.autodoc.importer import import_object, get_module_members, get_object_members
|
||||||
@@ -1754,6 +1754,14 @@ def autodoc_attrgetter(app: Sphinx, obj: Any, name: str, *defargs: Any) -> Any:
|
|||||||
return safe_getattr(obj, name, *defargs)
|
return safe_getattr(obj, name, *defargs)
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_autodoc_member_order(app: Sphinx, config: Config) -> None:
|
||||||
|
if config.autodoc_member_order == 'alphabetic':
|
||||||
|
# RemovedInSphinx50Warning
|
||||||
|
logger.warning(__('autodoc_member_order now accepts "alphabetical" '
|
||||||
|
'instead of "alphabetic". Please update your setting.'))
|
||||||
|
config.autodoc_member_order = 'alphabetical' # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def setup(app: Sphinx) -> Dict[str, Any]:
|
def setup(app: Sphinx) -> Dict[str, Any]:
|
||||||
app.add_autodocumenter(ModuleDocumenter)
|
app.add_autodocumenter(ModuleDocumenter)
|
||||||
app.add_autodocumenter(ClassDocumenter)
|
app.add_autodocumenter(ClassDocumenter)
|
||||||
@@ -1769,7 +1777,8 @@ def setup(app: Sphinx) -> Dict[str, Any]:
|
|||||||
app.add_autodocumenter(SlotsAttributeDocumenter)
|
app.add_autodocumenter(SlotsAttributeDocumenter)
|
||||||
|
|
||||||
app.add_config_value('autoclass_content', 'class', True, ENUM('both', 'class', 'init'))
|
app.add_config_value('autoclass_content', 'class', True, ENUM('both', 'class', 'init'))
|
||||||
app.add_config_value('autodoc_member_order', 'alphabetic', True)
|
app.add_config_value('autodoc_member_order', 'alphabetical', True,
|
||||||
|
ENUM('alphabetic', 'alphabetical', 'bysource', 'groupwise'))
|
||||||
app.add_config_value('autodoc_default_options', {}, True)
|
app.add_config_value('autodoc_default_options', {}, True)
|
||||||
app.add_config_value('autodoc_docstring_signature', True, True)
|
app.add_config_value('autodoc_docstring_signature', True, True)
|
||||||
app.add_config_value('autodoc_mock_imports', [], True)
|
app.add_config_value('autodoc_mock_imports', [], True)
|
||||||
@@ -1782,6 +1791,8 @@ def setup(app: Sphinx) -> Dict[str, Any]:
|
|||||||
app.add_event('autodoc-process-signature')
|
app.add_event('autodoc-process-signature')
|
||||||
app.add_event('autodoc-skip-member')
|
app.add_event('autodoc-skip-member')
|
||||||
|
|
||||||
|
app.connect('config-inited', migrate_autodoc_member_order)
|
||||||
|
|
||||||
app.setup_extension('sphinx.ext.autodoc.type_comment')
|
app.setup_extension('sphinx.ext.autodoc.type_comment')
|
||||||
app.setup_extension('sphinx.ext.autodoc.typehints')
|
app.setup_extension('sphinx.ext.autodoc.typehints')
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def make_directive_bridge(env):
|
|||||||
platform = '',
|
platform = '',
|
||||||
deprecated = False,
|
deprecated = False,
|
||||||
members = [],
|
members = [],
|
||||||
member_order = 'alphabetic',
|
member_order = 'alphabetical',
|
||||||
exclude_members = set(),
|
exclude_members = set(),
|
||||||
ignore_module_all = False,
|
ignore_module_all = False,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user