Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
inovisao
pynovisao
Commits
8a8d1950
Commit
8a8d1950
authored
May 18, 2018
by
Gilberto Astolfi
Browse files
Merge branch 'fix-config-boolean-parameter'
parents
b45dc089
8e7b717d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
src/util/config.py
src/util/config.py
+3
-0
src/util/utils.py
src/util/utils.py
+11
-0
No files found.
src/util/config.py
View file @
8a8d1950
...
...
@@ -9,6 +9,7 @@
"""
from
x11_colors
import
X11Colors
from
utils
import
BooleanUtils
class
Config
(
object
):
"""Class used to store the configs of program. Extend and customize if needed."""
...
...
@@ -51,6 +52,8 @@ class Config(object):
"""
if
self
.
c_type
is
None
:
return
self
.
value
elif
self
.
c_type
is
bool
:
return
BooleanUtils
.
str_to_bool
(
self
.
value
)
elif
self
.
c_type
is
'color'
:
X11Colors
.
search_color
(
self
.
value
)
return
self
.
value
...
...
src/util/utils.py
View file @
8a8d1950
...
...
@@ -369,3 +369,14 @@ class MetricUtils(object):
if
(
h_e
!=
h_g
)
or
(
w_e
!=
w_g
):
raise
EvalSegErr
(
"DiffDim: Different dimensions of matrices!"
)
class
BooleanUtils
(
object
):
@
staticmethod
def
str_to_bool
(
s
):
if
s
==
'True'
:
return
True
elif
s
==
'False'
:
return
False
else
:
raise
ValueError
\ No newline at end of file
Write
Preview
Markdown
is supported
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