We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e4eeb55 commit 9bef014Copy full SHA for 9bef014
python/exacting/core.py
@@ -1,11 +1,8 @@
1
-import dataclasses
2
from typing import TYPE_CHECKING, Callable, Type, TypeVar
3
+import dataclasses
4
from dataclasses import asdict, dataclass, is_dataclass
5
6
-if TYPE_CHECKING:
7
- from dataclasses import _DataclassT
8
-
9
from .dc import get_etypes_for_dc
10
11
T = TypeVar("T", bound=Type)
@@ -71,11 +68,14 @@ def wrapper(t):
71
68
setattr(x, "__init__", init)
72
69
return x
73
70
74
- setattr(dataclasses, "dataclass", new)
+ return new
75
76
77
-_patch()
78
-exact = dataclasses.dataclass
+# sneaky trick
+if TYPE_CHECKING:
+ exact = dataclasses.dataclass
+else:
+ exact = _patch()
79
80
81
class Exact:
0 commit comments