QCElemental
QCElemental copied to clipboard
ProtoModel.parse_raw should try everything if encoding==None
Currently, when encoding==None
, the encoding is determined to be JSON if the datatype is str and MsgPack if the datatype is bytes. This issue proposes to just try all of the parsers for datatypes supported by QCElemental, e.g.:
data = None
for parser in [yaml_parser, msgpack_parser, json_parser]:
try:
data = parser(blob)
break
except ParserError:
pass
else:
raise TypeError("Cannot parse blob")
Additionally, if parse_file
cannot determine datatype, it should call parse_raw
with encoding=None
rather than raising.
This issue blocks MolSSI/QCEngine#136.