Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProtoModel.parse_raw should try everything if encoding==None #113

Open
mattwelborn opened this issue Aug 15, 2019 · 0 comments
Open

ProtoModel.parse_raw should try everything if encoding==None #113

mattwelborn opened this issue Aug 15, 2019 · 0 comments

Comments

@mattwelborn
Copy link
Collaborator

mattwelborn commented Aug 15, 2019

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.

@mattwelborn mattwelborn changed the title ProtoModel.parse_raw should try everything if encoding=None ProtoModel.parse_raw should try everything if encoding==None Aug 15, 2019
@anabiman anabiman mentioned this issue Mar 8, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant