Skip to content

Commit

Permalink
Config Print Fix
Browse files Browse the repository at this point in the history
removed aliases in YAML dump which prevented the overloaded __repr__ class from printing pretty. Same change to the YAML save handler on file write (#34)

Signed-off-by: Nicholas Cilfone <nicholas.cilfone@fmr.com>
  • Loading branch information
ncilfone authored Dec 3, 2020
1 parent 627db44 commit 3d1c8ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spock/backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def __init__(self, **kwargs):
super(Spockspace, self).__init__(**kwargs)

def __repr__(self):
# Remove aliases in YAML dump
yaml.Dumper.ignore_aliases = lambda *args: True
return yaml.dump(self.__dict__, default_flow_style=False)


Expand Down
2 changes: 2 additions & 0 deletions spock/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def save(self, out_dict, path):
*Returns*:
"""
# Remove aliases in YAML dump
yaml.Dumper.ignore_aliases = lambda *args: True
yaml.dump(out_dict, path, default_flow_style=False)


Expand Down

0 comments on commit 3d1c8ea

Please sign in to comment.