Skip to content

Commit

Permalink
Fix 'enos info' by serializing more Enoslib objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jonglezb committed Apr 26, 2023
1 parent 18d4e31 commit 3a77f94
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enos/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,16 @@ def info(**kwargs):
import pickle

def json_encoder(o):
'Render pathlib.Path with str'
# Render pathlib.Path with str
if isinstance(o, Path):
return str(o.resolve())
else:
# Specific serializing method for some Enoslib objects
if hasattr(o, "to_dict"):
return o.to_dict()
if hasattr(o, "__dict__"):
return o.__dict__
if hasattr(o, "__iter__"):
return sorted(list(o))

# Get parameters
output_type = kwargs.get('--out', 'json')
Expand Down

0 comments on commit 3a77f94

Please sign in to comment.