Skip to content

Commit 83a6418

Browse files
committed
style: fix pre-commit issues
1 parent c84fe50 commit 83a6418

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

docs/user-guide/storage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ Zarr data (metadata and chunks) to a dictionary.:
102102
Memory-Mapped Store
103103
~~~~~~~~~~~~~~~~~~~~
104104

105-
For performance optimization when working with uncompressed data, you can create a memory-mapped store by subclassing :class:`zarr.storage.LocalStore`.
106-
Memory mapping allows direct access to portions of chunk data without loading entire chunks into memory, which can be beneficial when you need to
105+
For performance optimization when working with uncompressed data, you can create a memory-mapped store by subclassing :class:`zarr.storage.LocalStore`.
106+
Memory mapping allows direct access to portions of chunk data without loading entire chunks into memory, which can be beneficial when you need to
107107
read small slices from large chunks.:
108108

109109
>>> import mmap
@@ -119,7 +119,7 @@ read small slices from large chunks.:
119119
>>> z = zarr.open_array(store=store)
120120

121121
For example, if you have an array with large 1000x1000 chunks and frequently need to access small 100x100 sections,
122-
memory mapping can provide efficient access by mapping only the needed portions into memory
122+
memory mapping can provide efficient access by mapping only the needed portions into memory,
123123
rather than loading entire chunks.:
124124

125125
>>> # Create an array with large chunks

tests/test_store/test_mmap.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
22

3+
import mmap
34
from typing import TYPE_CHECKING
45

5-
import mmap
66
import pytest
77

88
import zarr
@@ -15,7 +15,7 @@
1515

1616

1717
class MemoryMappedDirectoryStore(LocalStore):
18-
def _fromfile(self, fn):
18+
def _fromfile(self, fn: str) -> memoryview:
1919
with open(fn, "rb") as fh:
2020
return memoryview(mmap.mmap(fh.fileno(), 0, prot=mmap.PROT_READ))
2121

@@ -64,22 +64,20 @@ def test_creates_new_directory(self, tmp_path: pathlib.Path):
6464
async def test_mmap_slice_reads(self, store: MemoryMappedDirectoryStore) -> None:
6565
"""Test reading slices with memory mapping"""
6666
# Create array with large chunks
67-
z = zarr.create_array(store=store, shape=(2000, 2000), chunks=(1000, 1000),
68-
dtype='float64')
67+
z = zarr.create_array(store=store, shape=(2000, 2000), chunks=(1000, 1000), dtype="float64")
6968
# Write test data
70-
data = zarr.full(shape=(2000, 2000), chunks=(1000, 1000), fill_value=42.0,
71-
dtype='float64')
69+
data = zarr.full(shape=(2000, 2000), chunks=(1000, 1000), fill_value=42.0, dtype="float64")
7270
z[:] = data[:]
73-
71+
7472
# Test reading various slices
7573
slices = [
7674
# Within single chunk
7775
(slice(100, 200), slice(100, 200)),
7876
# Across chunk boundaries
7977
(slice(900, 1100), slice(900, 1100)),
8078
# Full chunk
81-
(slice(0, 1000), slice(0, 1000))
79+
(slice(0, 1000), slice(0, 1000)),
8280
]
83-
81+
8482
for test_slice in slices:
8583
assert (z[test_slice] == data[test_slice]).all()

0 commit comments

Comments
 (0)