8000 edit docstrings · rjgildea/zarr-python@36797a6 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 36797a6

Browse files
committed
edit docstrings
1 parent 83abd0d commit 36797a6

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

zarr/storage.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ class DictStore(MutableMapping):
440440
441441
Notes
442442
-----
443-
This class should be safe to read or write in multiple threads.
443+
Safe to write in multiple threads.
444444
445445
"""
446446

@@ -647,10 +647,10 @@ class DirectoryStore(MutableMapping):
647647
-----
648648
Atomic writes are used, which means that data are first written to a
649649
temporary file, then moved into place when the write is successfully
650-
completed.
650+
completed. Files are only held open while they are being read or written and are
651+
closed immediately afterwards, so there is no need to manually close any files.
651652
652-
Files are only held open while they are being read or written and are closed
653-
immediately afterwards, so there is no need to manually close any files.
653+
Safe to write in multiple threads or processes.
654654
655655
"""
656656

@@ -901,6 +901,8 @@ class NestedDirectoryStore(DirectoryStore):
901901
files for multidimensional arrays will be organised into a directory
902902
hierarchy, thus reducing the number of files in any one directory.
903903
904+
Safe to write in multiple threads or processes.
905+
904906
"""
905907

906908
def __init__(self, path):
@@ -1030,6 +1032,8 @@ class also supports the context manager protocol, which ensures the ``close()``
10301032
Alternatively, use a :class:`DirectoryStore` when writing the data, then
10311033
manually Zip the directory and use the Zip file for subsequent reads.
10321034
1035+
Safe to write in multiple threads but not in multiple processes.
1036+
10331037
"""
10341038

10351039
def __init__(self, path, compression=zipfile.ZIP_STORED, allowZip64=True, mode='a'):
@@ -1310,6 +1314,10 @@ class DBMStore(MutableMapping):
13101314
corresponding open function, e.g., `dbm.gnu.open` to use the GNU DBM
13111315
library.
13121316
1317+
Safe to write in multiple threads. May be safe to write in multiple processes,
1318+
depending on which DBM implementation is being used, although this has not been
1319+
tested.
1320+
13131321
"""
13141322

13151323
def __init__(self, path, flag='c', mode=0o666, open=None, write_lock=True,
@@ -1322,6 +1330,7 @@ def __init__(self, path, flag='c', mode=0o666, open=None, write_lock=True,
13221330
import dbm
13231331
open = dbm.open
13241332
path = os.path.abspath(path)
1333+
# noinspection PyArgumentList
13251334
self.db = open(path, flag, mode, **open_kwargs)
13261335
self.path = path
13271336
self.flag = flag
@@ -1471,6 +1480,14 @@ class LMDBStore(MutableMapping):
14711480
... z[...] = 42
14721481
... # no need to call store.close()
14731482
1483+
Notes
1484+
-----
1485+
By default writes are not immediately flushed to disk to increase performance. You
1486+
can ensure data are flushed to disk by calling the ``flush()`` or ``close()`` methods.
1487+
1488+
Should be safe to write in multiple threads or processes due to the synchronization
1489+
support within LMDB, although writing from multiple processes has not been tested.
1490+
14741491
"""
14751492

14761493
def __init__(self, path, buffers=True, **kwargs):

0 commit comments

Comments
 (0)
0