Skip to content

Commit f929a1a

Browse files
committed
[#35] Add str and repr functions to Trace
1 parent 7d8dadb commit f929a1a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mappymatch/constructs/trace.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ def __add__(self, other: Trace) -> Trace:
4040
def __len__(self):
4141
return len(self._frame)
4242

43+
def __str__(self):
44+
output_lines = ['Mappymatch Trace object', f'coords_list: {self.coords_list if hasattr(self, "coords_list") else None}', f'frame: {self._frame if hasattr(self, "_frame") else None}']
45+
return '\n'.join(output_lines)
46+
47+
def __repr__(self):
48+
return self.__str__()
49+
4350
@property
4451
def index(self) -> pd.Index:
4552
return self._frame.index

0 commit comments

Comments
 (0)