You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the definition for sources, my understanding is that the docstring always seems to indicate that a file or file-like object is required. This can be seen in either in __init__:
Is this intended? Is string parsing officially supported but the docstring is out of date, or is this something that is more private API-esque?
The use case
I want to be able to allow folks to define OFFXML strings when creating an OpenFE FF settings object and not having to wrap it into a file-like object after the fact would make life a lot easier.
The text was updated successfully, but these errors were encountered:
As a passer-by, that docstring could use a heavy dose of whitespace 😅
Is this intended?
Hard to ascribe intent, but this is something that's been in the API/functionality since the beginning and is heavily baked into the test suite (look at several hundred lines in openff/toolkit/_tests/test_forcefield.py). I can't imagine it going away soon
Yeah, at this point I think the docstring is wrong. I consider the ability of this methods to load OFFXML strings to be de facto in the public API so in my mind this a stable feature with deficient documentation. Feel free to continue using it this way.
Overview
Looking at the definition for
sources
, my understanding is that the docstring always seems to indicate that a file or file-like object is required. This can be seen in either in__init__
:openff-toolkit/openff/toolkit/typing/engines/smirnoff/forcefield.py
Lines 241 to 248 in 9934858
parse_sources
:openff-toolkit/openff/toolkit/typing/engines/smirnoff/forcefield.py
Lines 772 to 779 in 9934858
parse_smirnoff_from_source
:openff-toolkit/openff/toolkit/typing/engines/smirnoff/forcefield.py
Lines 985 to 989 in 9934858
However, looking a bit further below, it looks like we can indeed parse an FFXML as a string directly:
openff-toolkit/openff/toolkit/typing/engines/smirnoff/forcefield.py
Line 1038 in 9934858
The question
Is this intended? Is string parsing officially supported but the docstring is out of date, or is this something that is more private API-esque?
The use case
I want to be able to allow folks to define OFFXML strings when creating an OpenFE FF settings object and not having to wrap it into a file-like object after the fact would make life a lot easier.
The text was updated successfully, but these errors were encountered: