forked from M-Labs/artiq
1
0
Fork 0

pyon: add bool support

This commit is contained in:
Sebastien Bourdeauducq 2014-10-25 17:06:44 +08:00
parent 6ac3c5d8ae
commit 489bcb3447
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,13 @@ def _encode_none(x):
return "None" return "None"
def _encode_bool(x):
if x:
return "True"
else:
return "False"
def _encode_number(x): def _encode_number(x):
return str(x) return str(x)
@ -50,6 +57,7 @@ def _encode_nparray(x):
_encode_map = { _encode_map = {
type(None): _encode_none, type(None): _encode_none,
bool: _encode_bool,
int: _encode_number, int: _encode_number,
float: _encode_number, float: _encode_number,
str: _encode_str, str: _encode_str,