Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 8, 2024
1 parent f3f0c9c commit c6b88ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/sphinx_autodoc_typehints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,15 @@ def _get_formatted_annotation(annotation):
return annotation if not isinstance(formatted_name, str) else TypeVar(formatted_name)

if app.config.typehints_use_signature_return:
sph_signature = sph_signature.replace(return_annotation=_get_formatted_annotation(sph_signature.return_annotation))
sph_signature = sph_signature.replace(
return_annotation=_get_formatted_annotation(sph_signature.return_annotation)
)

if app.config.typehints_use_signature:
parameters = [param.replace(annotation=_get_formatted_annotation(param.annotation)) for param in sph_signature.parameters.values()]
parameters = [
param.replace(annotation=_get_formatted_annotation(param.annotation))
for param in sph_signature.parameters.values()
]
else:
parameters = [param.replace(annotation=inspect.Parameter.empty) for param in sph_signature.parameters.values()]

Expand Down
1 change: 1 addition & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,7 @@ def has_doctest1() -> None:

Unformatted = TypeVar("Unformatted")


@warns("cannot cache unpickable configuration value: 'typehints_formatter'")
@expected(
"""
Expand Down

0 comments on commit c6b88ed

Please sign in to comment.