Skip to content

Commit

Permalink
Little fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
HarcicYang committed Aug 6, 2024
1 parent 60d603a commit e4df692
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Hyper/Segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def init(self, *args, **kwargs):
if i not in var.keys():
new_arg[i] = None
continue
try:
if not isinstance(var[i], anns[i]):
new_arg[i] = anns[i](var[i])
except TypeError:
else:
new_arg[i] = var[i]

for i in new_arg:
Expand All @@ -46,10 +46,14 @@ def init(self, *args, **kwargs):
def to_json(self) -> dict:
base = {"type": sg_type, "data": {}}
for i in anns:
try:
if not isinstance(getattr(self, i), anns[i]):
base["data"][i] = anns[i](getattr(self, i))
except TypeError:
else:
base["data"][i] = getattr(self, i)
# try:
# base["data"][i] = anns[i](getattr(self, i))
# except TypeError:
# base["data"][i] = getattr(self, i)
return base

cls.to_json = to_json
Expand Down

0 comments on commit e4df692

Please sign in to comment.