Open jteijema opened 1 year ago
Interesting question. It would be easier if the state class had an open and close method similar to Python's open
. We have .close()
, but .open()
might be useful as well.
For your application, did you try:
You can copy how the entrypoint does it, indeed using _iter_states
. If we actually use _iter_states
in one of the examples, we should make it public though. Also, I guess the docstring of the various plot functions could be improved, to say (generator of) asreview.state.SQLiteState
instead of (list of) asreview.state.SQLiteState
.
The example for the new multiple plots code is as follows:
However, how would one do this dynamically? open_state() method is returning a '_GeneratorContextManager' object, which implies that it is intended to be used as a context manager with the with statement. However, I can't dynamically open a cascading with statement, and I can't store the state for later using:
Any advise for this implementation? I think I cannot manually manage the lifetime of the state objects and they must be used within a with block, and thus I am forced to call plot_recall separately.