Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Supervised MultiModal Integration Tool
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
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Baptiste Bauvin
Supervised MultiModal Integration Tool
Commits
43f370e2
Commit
43f370e2
authored
5 years ago
by
Baptiste Bauvin
Browse files
Options
Downloads
Patches
Plain Diff
FUsion effectuée avec trop de simplicité
parent
a5fb0429
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
multiview_platform/mono_multi_view_classifiers/utils/configuration.py
+37
-0
37 additions, 0 deletions
...atform/mono_multi_view_classifiers/utils/configuration.py
multiview_platform/tests/test_utils/test_configuration.py
+1
-1
1 addition, 1 deletion
multiview_platform/tests/test_utils/test_configuration.py
with
38 additions
and
1 deletion
multiview_platform/mono_multi_view_classifiers/utils/configuration.py
0 → 100644
+
37
−
0
View file @
43f370e2
import
configparser
import
builtins
from
distutils.util
import
strtobool
as
tobool
def
get_the_args
(
path_to_config_file
=
"
../config_files/config.ini
"
):
"""
This is the main function for extracting the args for a
'
.ini
'
file
"""
config_parser
=
configparser
.
ConfigParser
(
comment_prefixes
=
(
'
#
'
))
config_parser
.
read
(
path_to_config_file
)
config_dict
=
{}
for
section
in
config_parser
:
config_dict
[
section
]
=
{}
for
key
in
config_parser
[
section
]:
value
=
format_raw_arg
(
config_parser
[
section
][
key
])
config_dict
[
section
][
key
]
=
value
return
config_dict
def
format_raw_arg
(
raw_arg
):
"""
This function is used to convert the raw arg in a types value.
For example,
'
list_int ; 10 20
'
will be formatted in [10,20]
"""
function_name
,
raw_value
=
raw_arg
.
split
(
"
;
"
)
if
function_name
.
startswith
(
"
list
"
):
function_name
=
function_name
.
split
(
"
_
"
)[
1
]
raw_values
=
raw_value
.
split
(
"
"
)
value
=
[
getattr
(
builtins
,
function_name
)(
raw_value
)
if
function_name
!=
"
bool
"
else
bool
(
tobool
(
raw_value
))
for
raw_value
in
raw_values
]
else
:
if
raw_value
==
"
None
"
:
value
=
None
else
:
if
function_name
==
"
bool
"
:
value
=
bool
(
tobool
(
raw_value
))
else
:
value
=
getattr
(
builtins
,
function_name
)(
raw_value
)
return
value
This diff is collapsed.
Click to expand it.
multiview_platform/
T
ests/
T
est_utils/test_configuration.py
→
multiview_platform/
t
ests/
t
est_utils/test_configuration.py
+
1
−
1
View file @
43f370e2
...
@@ -3,7 +3,7 @@ import unittest
...
@@ -3,7 +3,7 @@ import unittest
import
numpy
as
np
import
numpy
as
np
from
..
.MonoMultiViewClassifiers.utils
import
configuration
from
multiview_platform
.MonoMultiViewClassifiers.utils
import
configuration
class
Test_get_the_args
(
unittest
.
TestCase
):
class
Test_get_the_args
(
unittest
.
TestCase
):
...
...
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