Skip to content

Commit

Permalink
fix: update annotation parser
Browse files Browse the repository at this point in the history
  • Loading branch information
dandhlee committed Oct 29, 2023
1 parent cdb30f3 commit f0f2eae
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions docfx_yaml/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,17 +744,13 @@ def _extract_type_name(annotation: Any) -> str:
Returns:
The extracted type hint in human-readable string format.
"""
type_name = ""
# Extract names for simple types.
try:

annotation_dir = dir(annotation)
if '__args__' not in annotation:
return annotation.__name__
except AttributeError:
pass

# Try to extract names for more complicated types.
type_name = str(annotation)
if not annotation.__args__:
return type_name

# If ForwardRef references are found, recursively remove them.
prefix_to_remove_start = "[ForwardRef('"
Expand Down

0 comments on commit f0f2eae

Please sign in to comment.