Skip to content

Commit ab363c7

Browse files
daiyippyglove authors
authored andcommitted
Enable dataclasses_transform (PEP 681) on pg.ObjectMeta for better static typing support.
PiperOrigin-RevId: 791418828
1 parent c080ff4 commit ab363c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pyglove/core/symbolic/object.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828
from pyglove.core.symbolic import flags
2929

3030

31+
if sys.version_info >= (3, 11):
32+
_dataclass_transform = typing.dataclass_transform
33+
else:
34+
def _dataclass_transform():
35+
return lambda cls: cls
36+
37+
38+
@_dataclass_transform()
3139
class ObjectMeta(abc.ABCMeta):
3240
"""Meta class for pg.Object."""
3341

0 commit comments

Comments
 (0)