Skip to content

Commit

Permalink
fix: error due to using bytes instead of str in __str__
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin1887 committed Jul 30, 2024
1 parent 3045f32 commit 85ea338
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lab/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ def __init__(self, filename=None):
dict.__init__(self)

def __str__(self):
return self.to_bytes().decode()

def to_bytes(self):
return json.dumps(
self, default=self.default, option=json.OPT_INDENT_2 | json.OPT_SORT_KEYS
)
Expand All @@ -298,7 +301,7 @@ def write(self):
self.path.parent.mkdir(parents=True, exist_ok=True)
open_func = lzma.open if self.path.suffix == ".xz" else open
with open_func(self.path, "wb") as f:
f.write(self.__str__())
f.write(self.to_bytes())


class RunFilter:
Expand Down

0 comments on commit 85ea338

Please sign in to comment.