Skip to content
Snippets Groups Projects
Verified Commit 1180e8c4 authored by Tobias Hangleiter's avatar Tobias Hangleiter
Browse files

Use async save in doc

parent 779967cf
No related branches found
No related tags found
1 merge request!177IO: async datasaver
...@@ -400,10 +400,13 @@ class AsyncDatasaver: ...@@ -400,10 +400,13 @@ class AsyncDatasaver:
>>> datasaver.shutdown() >>> datasaver.shutdown()
The datasaver can also be used as a context manager, in which case The datasaver can also be used as a context manager, in which case
cleanup is automatically taken care of. cleanup is automatically taken care of. For syntactic sugar, calling
the datasaver has the same effect as
:meth:`AsyncDatasaver.save_async`.
>>> with AsyncDatasaver() as datasaver: >>> with AsyncDatasaver() as datasaver:
... datasaver.save_sync(tmpdir / 'foo.npz', data=data) ... datasaver(tmpdir / 'foo.npz', data=data/2)
... datasaver(tmpdir / 'bar.npz', data=2*data)
""" """
def __init__(self, pickle_lib: Literal['pickle', 'dill'] = 'pickle', compress: bool = False): def __init__(self, pickle_lib: Literal['pickle', 'dill'] = 'pickle', compress: bool = False):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment