Skip to content

Commit ec206bc

Browse files
Merge pull request #90 from Stanford-NavLab/ashwin/navdata-jupyter-display
Added display in Jupyter notebook without print
2 parents 374e484 + 97e5024 commit ec206bc

4 files changed

Lines changed: 35 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ name: build
55

66
on:
77
push:
8-
branches: [ main ]
8+
branches:
9+
- main
10+
- v*.*.*
911
pull_request:
10-
branches: [ main ]
12+
branches:
13+
- main
14+
- v*.*.*
1115
workflow_dispatch:
1216

1317
jobs:

.github/workflows/pip-install.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: pip-install
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches:
6+
- main
7+
- v*.*.*
68
workflow_dispatch:
79

810

.github/workflows/pylint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: pylint
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches:
6+
- main
7+
- v*.*.*
68
workflow_dispatch:
79

810
jobs:

gnss_lib_py/parsers/navdata.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,14 @@ def __next__(self):
10511051
return x_curr
10521052

10531053
def __str__(self):
1054+
"""Creates string representation of NavData object
1055+
1056+
Returns
1057+
-------
1058+
str_out : str
1059+
String representation of Navdata object, based on equivalent
1060+
Pandas string
1061+
"""
10541062
str_out = str(self.pandas_df())
10551063
str_out = str_out.replace("DataFrame","NavData")
10561064
str_out = str_out.replace("Columns","Rows")
@@ -1060,6 +1068,21 @@ def __str__(self):
10601068
str_out)
10611069
return str_out
10621070

1071+
def __repr__(self): # pragma: no cover
1072+
"""Evaluated string representation of Navdata object
1073+
1074+
For NavData objects, this is similar to the str method and is
1075+
defined separately to avoid having to add a `print` method
1076+
before each display command in Jupyter notebooks
1077+
1078+
Returns
1079+
-------
1080+
rep_out : str
1081+
Evaluated string representation object
1082+
"""
1083+
rep_out = str(self)
1084+
return rep_out
1085+
10631086
def __len__(self):
10641087
"""Return length of class
10651088

0 commit comments

Comments
 (0)