Skip to content

Commit bf1fba7

Browse files
committed
[fix] GroupBase allows attrs field
1 parent d507aed commit bf1fba7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/oqd_dataschema/group.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@ def __init_subclass__(cls, **kwargs):
9696
super().__init_subclass__(**kwargs)
9797

9898
for k, v in cls.__annotations__.items():
99-
if k in ["class_", "attrs"]:
99+
if k == "class_":
100+
raise AttributeError("`class_` attribute should not be set manually.")
101+
102+
if k == "attrs" and v is not Attrs:
100103
raise AttributeError(
101-
"`class_` and `attrs` attribute should not be set manually."
104+
"`attrs` attribute must have type annotation of Attrs."
102105
)
103106

104-
if cls._is_classvar(v):
107+
if k == "attrs" or cls._is_classvar(v):
105108
continue
106109

107110
if not cls._is_groupfield_type(v):

0 commit comments

Comments
 (0)