Skip to content

Commit

Permalink
fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
picnixz committed Aug 3, 2023
1 parent 6d6c7c3 commit a3442ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sphinx/ext/autodoc/preserve_defaults.py
Expand Up @@ -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:
Expand All @@ -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)):
Expand Down

0 comments on commit a3442ae

Please sign in to comment.