Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
python-common
Commits
23be8403
Commit
23be8403
authored
7 years ago
by
Berk Onat
Browse files
Options
Downloads
Patches
Plain Diff
Correct the order of items in the header dictionary assignment.
parent
c69f5a2d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/python/nomadcore/smart_parser/SmartParserCommon.py
+13
-4
13 additions, 4 deletions
common/python/nomadcore/smart_parser/SmartParserCommon.py
with
13 additions
and
4 deletions
common/python/nomadcore/smart_parser/SmartParserCommon.py
+
13
−
4
View file @
23be8403
...
...
@@ -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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment