Skip to content

Commit

Permalink
fix: Fix casing of deprecated, only set metadata when annotated ele…
Browse files Browse the repository at this point in the history
…ment is known
  • Loading branch information
tiangolo authored Oct 5, 2023
1 parent f08dc85 commit 98f3c2c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/griffe_typingdoc/_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def _set_metadata_warns(metadata: dict[str, Any], data: ExprCall) -> None:
_set_metadata_map = {
"typing.Doc": _set_metadata_doc,
"typing_extensions.Doc": _set_metadata_doc,
"typing.Deprecated": _set_metadata_deprecated,
"typing_extensions.Deprecated": _set_metadata_deprecated,
"typing.deprecated": _set_metadata_deprecated,
"typing_extensions.deprecated": _set_metadata_deprecated,
"typing.Name": _set_metadata_name,
"typing_extensions.Name": _set_metadata_name,
"typing.Raises": _set_metadata_raises,
Expand All @@ -77,7 +77,8 @@ def _set_metadata_warns(metadata: dict[str, Any], data: ExprCall) -> None:


def _set_metadata(metadata: dict[str, Any], data: ExprCall) -> None:
_set_metadata_map[data.function.canonical_path](metadata, data)
if data.function.canonical_path in _set_metadata_map:
_set_metadata_map[data.function.canonical_path](metadata, data)


def _metadata(annotation: str | Expr | None) -> dict[str, Any]:
Expand Down

0 comments on commit 98f3c2c

Please sign in to comment.