Skip to content

Commit

Permalink
Fix a state dumping bug (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaloz authored Jun 6, 2024
1 parent 4c05caf commit 6b354cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libbs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.7.0"
__version__ = "1.7.1"

import logging
logging.getLogger("libbs").addHandler(logging.NullHandler())
Expand Down
10 changes: 7 additions & 3 deletions libbs/artifacts/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ def load(cls, fp, fmt=ArtifactFormat.TOML):

@classmethod
def dumps_many(cls, artifacts: List["Artifact"], key_attr=ADDR_ATTR, fmt=ArtifactFormat.TOML) -> str:
artifacts_dict = {
getattr(art, key_attr): art.__getstate__() for art in artifacts
}
artifacts_dict = {}
for art in artifacts:
k = getattr(art, key_attr)
if isinstance(k, int):
k = hex(k)

artifacts_dict[k] = art.__getstate__()

if fmt == ArtifactFormat.TOML:
return toml.dumps(artifacts_dict, encoder=TomlHexEncoder())
Expand Down

0 comments on commit 6b354cb

Please sign in to comment.