Commit 942d8b0e by Tianqi Chen

[ATTR] More robust attr parsing (#33)

parent d781a57f
...@@ -202,8 +202,6 @@ class Tuple { ...@@ -202,8 +202,6 @@ class Tuple {
if (it != begin) os << ','; if (it != begin) os << ',';
os << *it; os << *it;
} }
// python style tuple
if (t.ndim() == 1) os << ',';
os << ']'; os << ']';
return os; return os;
} }
......
...@@ -94,7 +94,17 @@ class AttrDict(object): ...@@ -94,7 +94,17 @@ class AttrDict(object):
value : bool value : bool
The result value The result value
""" """
return self[key] != "False" lowercase = self[key].lower()
if lowercase == "1":
return True
elif lowercase == "0":
return False
elif lowercase == "true":
return True
elif lowercase == "false":
return False
else:
raise ValueError("Wrong bool format for key %s" % key)
def __repr__(self): def __repr__(self):
return str({k : self[k] for k in self.keys()}) return str({k : self[k] for k in self.keys()})
......
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