Skip to content

Commit

Permalink
[Fix] assignment of split and when Instance properties to HDF5 …
Browse files Browse the repository at this point in the history
…groups
  • Loading branch information
g5t committed Nov 15, 2023
1 parent 711edcf commit 68d3cd6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mccode_antlr/io/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def _standard_read(typename, group, attrs, optional, required, **kwargs):
def _standard_save(typename, group, data, attrs, fields, **kwargs):
_write_header(group, typename)
for name in attrs:
if getattr(data, name):
if getattr(data, name) is not None:
group.attrs[name] = getattr(data, name)
for name in fields:
if getattr(data, name):
if getattr(data, name) is not None:
HDF5IO.save(group=group.create_group(name), data=getattr(data, name), **kwargs)


Expand Down Expand Up @@ -83,8 +83,8 @@ def save(group, data, **kwargs):
class InstanceIO:
from mccode_antlr.comp import Comp
from mccode_antlr.instr import Instance
attrs = ('name', 'removable', 'cpu', 'split', 'when', 'group')
names = ('orientation', 'parameters', 'extend', 'jump', 'metadata')
attrs = ('name', 'removable', 'cpu', 'group')
names = ('orientation', 'parameters', 'split', 'when', 'extend', 'jump', 'metadata')

@staticmethod
def load(group, instances: dict[str, Instance], components: dict[str, Comp], **kwargs) -> Instance:
Expand Down

0 comments on commit 68d3cd6

Please sign in to comment.