Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Christian Heinigk
dune-codegen
Commits
f17cb4bc
Commit
f17cb4bc
authored
7 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Enable type conversion of form options
parent
6f9e551b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/perftool/options.py
+6
-7
6 additions, 7 deletions
python/dune/perftool/options.py
with
6 additions
and
7 deletions
python/dune/perftool/options.py
+
6
−
7
View file @
f17cb4bc
...
...
@@ -123,21 +123,20 @@ def update_options_from_commandline(opt):
def
update_options_from_inifile
(
opt
):
"""
Return an options array object with updated values from an inifile
"""
if
opt
.
ini_file
:
def
parse_ini
(
section
):
def
parse_ini
(
section
,
opttype
):
def
_fix_types
(
k
,
v
):
if
hasattr
(
type
(
opt
)
,
k
)
and
getattr
(
type
(
opt
)
,
k
).
type
is
bool
:
if
hasattr
(
opt
type
,
k
)
and
getattr
(
opt
type
,
k
).
type
is
bool
:
return
bool
(
eval
(
v
))
if
hasattr
(
type
(
opt
)
,
k
):
return
getattr
(
type
(
opt
)
,
k
).
type
(
v
)
if
hasattr
(
opt
type
,
k
):
return
getattr
(
opt
type
,
k
).
type
(
v
)
return
v
ini
=
parse_ini_file
(
opt
.
ini_file
).
get
(
section
,
{})
return
{
k
:
_fix_types
(
k
,
v
)
for
k
,
v
in
ini
.
items
()}
opt
=
opt
.
copy
(
**
parse_ini
(
"
formcompiler
"
))
opt
=
opt
.
copy
(
**
parse_ini
(
"
formcompiler
"
,
PerftoolGlobalOptionsArray
))
# Also parse form-specific options
for
form
in
[
i
.
strip
()
for
i
in
opt
.
operators
.
split
(
"
,
"
)]:
_form_options
[
form
]
=
PerftoolFormOptionsArray
(
**
parse_ini
(
"
formcompiler.{}
"
.
format
(
form
)))
_form_options
[
form
]
=
PerftoolFormOptionsArray
(
**
parse_ini
(
"
formcompiler.{}
"
.
format
(
form
)
,
PerftoolFormOptionsArray
))
return
opt
...
...
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