Skip to content

Commit

Permalink
Merge pull request #2365 from midichef/xport_v2
Browse files Browse the repository at this point in the history
[sas-] make XptSheet rows be list instead of tuple
  • Loading branch information
anjakefala committed May 24, 2024
2 parents d5ca442 + fdb0509 commit a9980b3
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mapbox-vector-tile # mbtiles
pypng # png
fonttools # ttf/otf
sas7bdat # sas7bdat (SAS)
xport # xpt (SAS)
xport==2.0.2 # xpt (SAS)
PyYAML>=5.1 # yaml/yml
dpkt # pcap
dnslib # pcap
Expand Down
Binary file added sample_data/brakes.xpt
Binary file not shown.
129 changes: 129 additions & 0 deletions tests/golden/load-xpt.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
MACHINE BRAKE
1.00 322.00
1.00 322.00
1.00 322.02
1.00 321.99
1.00 322.01
1.00 322.00
1.00 322.01
1.00 321.98
1.00 322.00
1.00 322.00
1.00 321.98
1.00 321.98
1.00 322.00
1.00 322.00
1.00 322.00
1.00 322.00
2.00 322.01
2.00 322.03
2.00 322.01
2.00 322.03
2.00 322.01
2.00 322.03
2.00 322.02
2.00 322.01
2.00 322.02
2.00 321.99
2.00 322.02
2.00 322.02
2.00 322.02
2.00 322.01
2.00 322.01
2.00 322.00
3.00 321.99
3.00 321.99
3.00 322.00
3.00 321.98
3.00 322.02
3.00 321.98
3.00 322.00
3.00 322.00
3.00 322.00
3.00 322.02
3.00 322.00
3.00 322.01
3.00 321.99
3.00 321.99
3.00 321.99
3.00 322.00
4.00 321.99
4.00 322.00
4.00 322.01
4.00 322.00
4.00 321.99
4.00 322.00
4.00 322.00
4.00 321.99
4.00 322.00
4.00 322.00
4.00 321.99
4.00 322.00
4.00 321.99
4.00 321.99
4.00 321.98
4.00 322.00
5.00 321.99
5.00 322.00
5.00 322.00
5.00 322.01
5.00 322.02
5.00 321.99
5.00 322.01
5.00 322.02
5.00 322.00
5.00 322.01
5.00 322.01
5.00 322.00
5.00 322.00
5.00 321.99
5.00 322.01
5.00 322.00
6.00 322.00
6.00 321.98
6.00 322.00
6.00 322.00
6.00 322.02
6.00 322.00
6.00 322.01
6.00 322.01
6.00 322.00
6.00 322.01
6.00 322.00
6.00 322.01
6.00 322.01
6.00 322.00
6.00 322.00
6.00 322.00
7.00 322.01
7.00 322.02
7.00 322.01
7.00 322.00
7.00 322.01
7.00 322.02
7.00 322.01
7.00 322.00
7.00 322.00
7.00 322.01
7.00 322.00
7.00 321.99
7.00 322.01
7.00 322.01
7.00 322.00
7.00 322.01
8.00 321.99
8.00 321.99
8.00 321.99
8.00 322.01
8.00 321.99
8.00 322.00
8.00 322.00
8.00 322.00
8.00 322.00
8.00 322.00
8.00 321.99
8.00 322.00
8.00 322.00
8.00 321.98
8.00 321.99
8.00 322.00
2 changes: 2 additions & 0 deletions tests/load-xpt.vdj
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!vd -p
{"sheet": null, "col": null, "row": null, "longname": "open-file", "input": "sample_data/brakes.xpt", "keystrokes": "o", "comment": null}
4 changes: 3 additions & 1 deletion visidata/loaders/sas.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def iterload(self):
for i, var in enumerate(self.rdr._variables):
self.addColumn(ColumnItem(var.name, i, type=float if var.numeric else str))

yield from self.rdr
# a visidata row must not be a tuple, so convert each tuple to a list
for t in self.rdr:
yield list(t)


class SasSheet(Sheet):
Expand Down

0 comments on commit a9980b3

Please sign in to comment.