Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OBITools3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
23
Issues
23
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
159803b4
Commit
159803b4
authored
Jul 31, 2020
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export: now automatically sorts dictionary keys alphabetically for
tab/csv output
parent
7dcbc340
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
export.pyx
python/obitools3/commands/export.pyx
+1
-1
tab.pyx
python/obitools3/format/tab.pyx
+8
-3
No files found.
python/obitools3/commands/export.pyx
View file @
159803b4
...
...
@@ -89,7 +89,7 @@ def run(config):
if pb is not None:
pb(i, force=True)
print("", file=sys.stderr)
print("", file=sys.stderr)
# TODO save command in input dms?
...
...
python/obitools3/format/tab.pyx
View file @
159803b4
...
...
@@ -5,6 +5,7 @@ from obitools3.dms.view.view cimport Line
from obitools3.utils cimport bytes2str_object, str2bytes, tobytes
from obitools3.dms.column.column cimport Column_line, Column_multi_elts
import sys
cdef class TabFormat:
...
...
@@ -26,18 +27,22 @@ cdef class TabFormat:
if self.header and self.first_line:
if isinstance(data.view[k], Column_multi_elts):
for k2 in data.view[k].keys():
keys = data.view[k].keys()
keys.sort()
for k2 in keys:
line.append(tobytes(k)+b':'+tobytes(k2))
else:
line.append(tobytes(k))
else:
value = data[k]
if isinstance(data.view[k], Column_multi_elts):
keys = data.view[k].keys()
keys.sort()
if value is None: # all keys at None
for k2 in
data.view[k].keys()
: # TODO could be much more efficient
for k2 in
keys
: # TODO could be much more efficient
line.append(self.NAString)
else:
for k2 in
data.view[k].keys()
: # TODO could be much more efficient
for k2 in
keys
: # TODO could be much more efficient
if value[k2] is not None:
line.append(str2bytes(str(bytes2str_object(value[k2])))) # genius programming
else:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment