Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Track Analyzer
track-analyzer
Commits
4d2a5702
Commit
4d2a5702
authored
Jan 19, 2022
by
amichaut
Browse files
improvement of load_dict to support badly formatted csv config file
parent
3d718867
Changes
1
Hide whitespace changes
Inline
Side-by-side
track_analyzer/prepare.py
View file @
4d2a5702
...
...
@@ -337,6 +337,10 @@ def load_dict(filename):
else
:
try
:
mydict
[
rows
[
0
]]
=
eval
(
rows
[
1
])
# if needs conversion
try
:
mydict
[
rows
[
0
]]
=
eval
(
eval
(
rows
[
1
]))
# if double string
except
:
pass
except
:
mydict
[
rows
[
0
]]
=
rows
[
1
]
# if string
elif
len
(
rows
)
>
2
:
# if line splitted because of comma, try to concatenate line
...
...
@@ -344,11 +348,16 @@ def load_dict(filename):
for
i
in
range
(
1
,
len
(
rows
)
-
1
):
val
+=
rows
[
i
]
+
','
val
+=
rows
[
len
(
rows
)
-
1
]
if
val
==
''
:
mydict
[
rows
[
0
]]
=
None
else
:
try
:
mydict
[
rows
[
0
]]
=
eval
(
val
)
# if needs conversion
try
:
mydict
[
rows
[
0
]]
=
eval
(
eval
(
val
))
# if double string
except
:
pass
except
:
mydict
[
rows
[
0
]]
=
val
# if string
return
mydict
...
...
Write
Preview
Supports
Markdown
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