Skip to content
Snippets Groups Projects
Commit 23be8403 authored by Berk Onat's avatar Berk Onat
Browse files

Correct the order of items in the header dictionary assignment.

parent c69f5a2d
Branches
Tags
No related merge requests found
......@@ -938,11 +938,17 @@ class ParserBase(object):
else:
if headerList is not None:
if isinstance(headerList, (tuple, list)):
hlist.extend(headerList)
for hitem in headerList:
hlist.append(hitem)
elif isinstance(headerList, dict):
hlist.extend(headerList.keys())
# Making sure the keys will be copied in ordered as it is assigned
for hi in range(0, len(headerList.keys())):
for hitem, order in headerList.items():
if hi == order:
hlist.append(hitem)
elif isinstance(headerList, str):
hlist.extend(headerList.split())
for hitem in headerList.split():
hlist.append(hitem)
vlist.extend(line.split())
lcount += 1
# Reconvert to original
......@@ -969,8 +975,11 @@ class ParserBase(object):
anythingmatched = True
else:
if(header is not None and headersave is not None):
hlistc=0
# Saving keys with their orders in the list
for cName in hlist:
headersave.update({cName : None})
headersave.update({cName : int(hlistc)})
hlistc=+1
anythingmatched = True
if anythingmatched:
#print("PRINTING table_parser header:",headersave)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment