From aeed42456a174cb818b8790fffb524bae3aaf5c3 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Wed, 10 Jan 2024 15:52:28 +1300 Subject: [PATCH] export: columns are now in alphabetical order when exporting to tab format --- python/obitools3/format/tab.pyx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python/obitools3/format/tab.pyx b/python/obitools3/format/tab.pyx index d05b4c9..7af45df 100755 --- a/python/obitools3/format/tab.pyx +++ b/python/obitools3/format/tab.pyx @@ -23,16 +23,17 @@ cdef class TabFormat: @cython.boundscheck(False) def __call__(self, object data): - cdef set ktags + cdef object ktags cdef list tags = [key for key in data] line = [] - - if self.tags is not None and self.tags: - ktags = self.tags + if self.tags != None and self.tags: + ktags = list(self.tags) else: - ktags = set(tags) - + ktags = list(set(tags)) + + ktags.sort() + if self.header and self.first_line: for k in ktags: if k in tags: