Skip to content
Snippets Groups Projects
Commit bd5776cd authored by Pardini, Lorenzo (lopa)'s avatar Pardini, Lorenzo (lopa)
Browse files

fixing converions of booleans

parent 79ef1b1a
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ from builtins import range ...@@ -8,7 +8,7 @@ from builtins import range
from builtins import object from builtins import object
import json import json
import numpy as np import numpy as np
import sys import sys, re
def numpyDtypeForDtypeStr(dtypeStr): def numpyDtypeForDtypeStr(dtypeStr):
"""returns the numpy dtype given the meta info dtype""" """returns the numpy dtype given the meta info dtype"""
...@@ -37,7 +37,7 @@ def valueForStrValue(strValue, dtypeStr): ...@@ -37,7 +37,7 @@ def valueForStrValue(strValue, dtypeStr):
elif dtypeStr[0] == "i": elif dtypeStr[0] == "i":
return int(strValue) return int(strValue)
elif dtypeStr[0] == "b": elif dtypeStr[0] == "b":
return (re.match("\s*(?:no?|\.?f(?:alse)?\.?|0)\s*$", strValue) is None) return (re.match("\s*(?:[nN][oO]?|\.?[fF](?:[aA][lL][sS][eE])?\.?|0)\s*$", strValue) is None)
elif dtypeStr[0] == "B": elif dtypeStr[0] == "B":
return strValue # assumed to be base64 encoded return strValue # assumed to be base64 encoded
elif dtypeStr[0] == "C": elif dtypeStr[0] == "C":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment