From a3442ae9c5940a330bfb2cf19070bc33d55d82d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Thu, 3 Aug 2023 13:59:07 +0200 Subject: [PATCH] fix mypy --- sphinx/ext/autodoc/preserve_defaults.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/ext/autodoc/preserve_defaults.py b/sphinx/ext/autodoc/preserve_defaults.py index 295c7f9468e..c633781085f 100644 --- a/sphinx/ext/autodoc/preserve_defaults.py +++ b/sphinx/ext/autodoc/preserve_defaults.py @@ -46,10 +46,10 @@ def get_arguments(obj: Any) -> ast.arguments | None: # subject is placed inside class or block. To read its docstring, # this adds if-block before the declaration. module = ast.parse('if True:\n' + source) - subject = module.body[0].body[0] + subject = module.body[0].body[0] # type: ignore[attr-defined] else: module = ast.parse(source) - subject = module.body[0] + subject = module.body[0] # type: ignore[attr-defined] except (OSError, TypeError): # failed to load source code return None except SyntaxError: @@ -67,7 +67,7 @@ def get_arguments(obj: Any) -> ast.arguments | None: # propagated). raise - def _get_arguments(x: ast.AST) -> ast.arguments | None: + def _get_arguments(x: Any) -> ast.arguments | None: if isinstance(x, (ast.AsyncFunctionDef, ast.FunctionDef, ast.Lambda)): return x.args if isinstance(x, (ast.Assign, ast.AnnAssign)):