Commit 8a8d1950 authored by Gilberto Astolfi's avatar Gilberto Astolfi
Browse files

Merge branch 'fix-config-boolean-parameter'

parents b45dc089 8e7b717d
......@@ -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
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment