Skip to content

Commit

Permalink
ConditionSet: improve __repr__
Browse files Browse the repository at this point in the history
use repr of owner and add dict brackets to increase the number of
situations in which the repr can be used to recreate the original object
  • Loading branch information
kmantel committed Dec 14, 2023
1 parent 204fe9d commit 5fcb008
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/graph_scheduler/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,12 @@ def __contains__(self, item):
return item in self.conditions

def __repr__(self):
condition_str = '\n\t'.join([f'{owner}: {condition}' for owner, condition in self.conditions.items()])
condition_str = '\n\t'.join([f'{repr(owner)}: {condition}' for owner, condition in self.conditions.items()])
return '{0}({1}{2}{3})'.format(
self.__class__.__name__,
'\n\t' if len(condition_str) > 0 else '',
'{\n\t' if len(condition_str) > 0 else '',
condition_str,
'\n' if len(condition_str) > 0 else ''
'\n}' if len(condition_str) > 0 else '',
)

def __iter__(self):
Expand Down

0 comments on commit 5fcb008

Please sign in to comment.