mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable'
This commit is contained in:
commit
0417a084db
@ -268,6 +268,8 @@ def format_annotation(annotation):
|
||||
|
||||
Displaying complex types from ``typing`` relies on its private API.
|
||||
"""
|
||||
if typing and isinstance(annotation, typing.TypeVar):
|
||||
return annotation.__name__
|
||||
if not isinstance(annotation, type):
|
||||
return repr(annotation)
|
||||
|
||||
@ -277,9 +279,7 @@ def format_annotation(annotation):
|
||||
if annotation.__module__ == 'builtins':
|
||||
return annotation.__qualname__
|
||||
elif typing:
|
||||
if isinstance(annotation, typing.TypeVar):
|
||||
return annotation.__name__
|
||||
elif hasattr(typing, 'GenericMeta') and \
|
||||
if hasattr(typing, 'GenericMeta') and \
|
||||
isinstance(annotation, typing.GenericMeta):
|
||||
# In Python 3.5.2+, all arguments are stored in __args__,
|
||||
# whereas __parameters__ only contains generic parameters.
|
||||
|
Loading…
Reference in New Issue
Block a user