Skip to content

Commit

Permalink
fix: add __str__ and __repr__ methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelm committed Feb 14, 2022
1 parent 4024d50 commit 6797801
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions broadworks_ocip/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,16 @@ def to_dict(self) -> Dict[str, Any]:
elements[elem.name] = value
return elements

def __repr__(self) -> str:
"""Convert object to string representation of itself."""
dict_form = self.to_dict()
bits = [f"{key}={repr(dict_form[key])}" for key in dict_form.keys()]
return f"{self.__class__.__name__}({', '.join(bits)})"

def __str__(self) -> str:
"""Convert object to string representation of itself."""
return repr(self)


class OCICommand(OCIType):
"""
Expand Down

0 comments on commit 6797801

Please sign in to comment.