We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea4ce11 commit c09716bCopy full SHA for c09716b
polygon/modelclass.py
@@ -2,16 +2,16 @@
2
import typing
3
from dataclasses import dataclass
4
5
-
6
_T = typing.TypeVar("_T")
7
8
9
def modelclass(cls: typing.Type[_T]) -> typing.Type[_T]:
10
cls = dataclass(cls)
+ type_hints = typing.get_type_hints(cls)
11
attributes = [
12
a
13
- for a in cls.__dict__["__annotations__"].keys()
14
- if not a.startswith("__") and not inspect.isroutine(a)
+ for a in type_hints.keys()
+ if not a.startswith("__") and not inspect.isroutine(getattr(cls, a, None))
15
]
16
17
def init(self, *args, **kwargs):
0 commit comments