mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: autodoc: Update type annotations
This commit is contained in:
parent
56772395bb
commit
c7a63b455c
@ -849,7 +849,7 @@ class ModuleDocumenter(Documenter):
|
|||||||
if self.options.deprecated:
|
if self.options.deprecated:
|
||||||
self.add_line(' :deprecated:', sourcename)
|
self.add_line(' :deprecated:', sourcename)
|
||||||
|
|
||||||
def get_object_members(self, want_all: bool) -> Tuple[bool, List[Tuple[str, object]]]:
|
def get_object_members(self, want_all: bool) -> Tuple[bool, List[Tuple[str, Any]]]:
|
||||||
if want_all:
|
if want_all:
|
||||||
if (self.options.ignore_module_all or not
|
if (self.options.ignore_module_all or not
|
||||||
hasattr(self.object, '__all__')):
|
hasattr(self.object, '__all__')):
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
import importlib
|
import importlib
|
||||||
import traceback
|
import traceback
|
||||||
import warnings
|
import warnings
|
||||||
from collections import namedtuple
|
from typing import Any, Callable, Dict, List, Mapping, NamedTuple, Tuple
|
||||||
from typing import Any, Callable, Dict, List, Mapping, Tuple
|
|
||||||
|
|
||||||
from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
|
from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
|
||||||
|
from sphinx.pycode import ModuleAnalyzer
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.inspect import isclass, isenumclass, safe_getattr
|
from sphinx.util.inspect import isclass, isenumclass, safe_getattr
|
||||||
|
|
||||||
@ -122,11 +122,13 @@ def get_module_members(module: Any) -> List[Tuple[str, Any]]:
|
|||||||
return sorted(list(members.values()))
|
return sorted(list(members.values()))
|
||||||
|
|
||||||
|
|
||||||
Attribute = namedtuple('Attribute', ['name', 'directly_defined', 'value'])
|
Attribute = NamedTuple('Attribute', [('name', str),
|
||||||
|
('directly_defined', bool),
|
||||||
|
('value', Any)])
|
||||||
|
|
||||||
|
|
||||||
def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
|
def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
|
||||||
analyzer: Any = None) -> Dict[str, Attribute]:
|
analyzer: ModuleAnalyzer = None) -> Dict[str, Attribute]:
|
||||||
"""Get members and attributes of target object."""
|
"""Get members and attributes of target object."""
|
||||||
from sphinx.ext.autodoc import INSTANCEATTR
|
from sphinx.ext.autodoc import INSTANCEATTR
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user