Use typing.get_type_hints instead of __annotations__ (#919)
This commit is contained in:
parent
1a254aca8e
commit
d5977ffce4
@ -15,6 +15,7 @@ from typing import (
|
|||||||
Type,
|
Type,
|
||||||
Union,
|
Union,
|
||||||
_GenericAlias, # type: ignore
|
_GenericAlias, # type: ignore
|
||||||
|
get_type_hints,
|
||||||
)
|
)
|
||||||
|
|
||||||
from plotly.graph_objects import Figure
|
from plotly.graph_objects import Figure
|
||||||
@ -807,8 +808,9 @@ class ComputedVar(property, Var):
|
|||||||
Returns:
|
Returns:
|
||||||
The type of the var.
|
The type of the var.
|
||||||
"""
|
"""
|
||||||
if "return" in self.fget.__annotations__:
|
hints = get_type_hints(self.fget)
|
||||||
return self.fget.__annotations__["return"]
|
if "return" in hints:
|
||||||
|
return hints["return"]
|
||||||
return Any
|
return Any
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user