From 1180e8c4cbb6ad0d096eaf636b8f07e44e5a4934 Mon Sep 17 00:00:00 2001 From: Tobias Hangleiter <tobias.hangleiter@rwth-aachen.de> Date: Fri, 11 Apr 2025 18:21:02 +0200 Subject: [PATCH] Use async save in doc --- qutil/io.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qutil/io.py b/qutil/io.py index 6dad2a0..41ce07e 100644 --- a/qutil/io.py +++ b/qutil/io.py @@ -400,10 +400,13 @@ class AsyncDatasaver: >>> datasaver.shutdown() 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: - ... 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): -- GitLab