Skip to content

Commit

Permalink
[#35] Add str and repr functions to Trace
Browse files Browse the repository at this point in the history
  • Loading branch information
machallboyd committed May 31, 2022
1 parent 7d8dadb commit f929a1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mappymatch/constructs/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ def __add__(self, other: Trace) -> Trace:
def __len__(self):
return len(self._frame)

def __str__(self):
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}']
return '\n'.join(output_lines)

def __repr__(self):
return self.__str__()

@property
def index(self) -> pd.Index:
return self._frame.index
Expand Down

0 comments on commit f929a1a

Please sign in to comment.