Skip to content

Commit

Permalink
Add __repr__ to data types of Record, Enum and IList
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinitto committed Feb 27, 2023
1 parent 739d37e commit 3bfc61e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions funml/data/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ def __str__(self):
"""Generates a readable presentation of the enum."""
return f"<{self.name}: {self.value}>"

def __repr__(self):
return f"<{self.name}: {self.value}>"


def _get_enum_captured_value(instance: Enum):
"""Gets the captured value for a given enum instance"""
Expand Down
4 changes: 4 additions & 0 deletions funml/data/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ def __str__(self):
map_to_str = imap(str)
return f"[{', '.join(map_to_str(self))}]"

def __repr__(self):
map_to_str = imap(str)
return f"IList({', '.join(map_to_str(self))})"


Q = TypeVar("Q")

Expand Down
3 changes: 3 additions & 0 deletions funml/data/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ def __str__(self):
"""A readable representation of this type."""
return f"{self.__attrs}"

def __repr__(self):
return f"{self.__class__.__name__}{self.__attrs}"

def __iter__(self):
return ((k, v) for k, v in self.__attrs.items())

Expand Down

0 comments on commit 3bfc61e

Please sign in to comment.