mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Disallow untyped definitions (#12637)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
parent
c8c7fee4e5
commit
f8e9669f8b
@ -208,6 +208,7 @@ exclude = [
|
||||
]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_untyped_defs = true
|
||||
python_version = "3.10"
|
||||
show_column_numbers = true
|
||||
show_error_context = true
|
||||
@ -276,6 +277,12 @@ module = [
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = [
|
||||
"tests.*",
|
||||
]
|
||||
disallow_untyped_defs = false
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
minversion = "6.0"
|
||||
addopts = [
|
||||
|
@ -124,7 +124,7 @@ if TYPE_CHECKING:
|
||||
def __getitem__(self, key: Literal["todo"]) -> TodoDomain: ... # NoQA: E704
|
||||
@overload
|
||||
def __getitem__(self, key: str) -> Domain: ... # NoQA: E704
|
||||
def __getitem__(self, key): raise NotImplementedError # NoQA: E704
|
||||
def __getitem__(self, _key: str) -> Domain: raise NotImplementedError # NoQA: E704
|
||||
def __setitem__( # NoQA: E301,E704
|
||||
self, key: str, value: Domain,
|
||||
) -> NoReturn: raise NotImplementedError
|
||||
|
@ -1381,7 +1381,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
|
||||
if len(sig.parameters) == 0:
|
||||
return None
|
||||
|
||||
def dummy(): # NoQA: ANN202
|
||||
def dummy(): # type: ignore[no-untyped-def] # NoQA: ANN202
|
||||
pass
|
||||
|
||||
params = list(sig.parameters.values())
|
||||
@ -2277,7 +2277,7 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type:
|
||||
if len(sig.parameters) == 1:
|
||||
return None
|
||||
|
||||
def dummy(): # NoQA: ANN202
|
||||
def dummy(): # type: ignore[no-untyped-def] # NoQA: ANN202
|
||||
pass
|
||||
|
||||
params = list(sig.parameters.values())
|
||||
|
@ -487,7 +487,7 @@ class IndexBuilder:
|
||||
self._index_entries[docname] = sorted(_index_entries)
|
||||
|
||||
def _word_collector(self, doctree: nodes.document) -> WordStore:
|
||||
def _visit_nodes(node):
|
||||
def _visit_nodes(node: nodes.Node) -> None:
|
||||
if isinstance(node, nodes.comment):
|
||||
return
|
||||
elif isinstance(node, nodes.raw):
|
||||
|
@ -246,7 +246,7 @@ def run_compile() -> None:
|
||||
_write_pr_body_line(f'* {locale}: {err_count} error{s}')
|
||||
|
||||
|
||||
def _get_logger():
|
||||
def _get_logger() -> logging.Logger:
|
||||
log = logging.getLogger('babel')
|
||||
log.setLevel(logging.INFO)
|
||||
handler = logging.StreamHandler()
|
||||
|
Loading…
Reference in New Issue
Block a user