Skip to content

Commit 2c192d4

Browse files
committed
fix broken code examples
1 parent e38c508 commit 2c192d4

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

src/zarr/core/array.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4014,7 +4014,7 @@ def blocks(self) -> BlockIndex:
40144014
def resize(self, new_shape: ShapeLike) -> None:
40154015
"""
40164016
Change the shape of the array by growing or shrinking one or more
4017-
dimensions.
4017+
dimensions. This is an in-place operation that modifies the array.
40184018
40194019
Parameters
40204020
----------
@@ -4032,20 +4032,20 @@ def resize(self, new_shape: ShapeLike) -> None:
40324032
40334033
Examples
40344034
--------
4035-
>>> import zarr
4036-
>>> z = zarr.zeros(shape=(10000, 10000),
4037-
>>> chunk_shape=(1000, 1000),
4038-
>>> dtype="i4",)
4039-
>>> z.shape
4040-
(10000, 10000)
4041-
>>> z = z.resize(20000, 1000)
4042-
>>> z.shape
4043-
(20000, 1000)
4044-
>>> z2 = z.resize(50, 50)
4045-
>>> z.shape
4046-
(20000, 1000)
4047-
>>> z2.shape
4048-
(50, 50)
4035+
```python
4036+
import zarr
4037+
z = zarr.zeros(shape=(10000, 10000),
4038+
chunk_shape=(1000, 1000),
4039+
dtype="int32",)
4040+
z.shape
4041+
#> (10000, 10000)
4042+
z.resize((20000, 1000))
4043+
z.shape
4044+
#> (20000, 1000)
4045+
z.resize((50, 50))
4046+
z.shape
4047+
#>(50, 50)
4048+
```
40494049
"""
40504050
sync(self._async_array.resize(new_shape))
40514051

src/zarr/core/attributes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ def put(self, d: dict[str, JSON]) -> None:
4343
Equivalent to the following pseudo-code, but performed atomically.
4444
4545
```python
46-
>>> attrs = {"a": 1, "b": 2}
47-
>>> attrs.clear()
48-
>>> attrs.update({"a": 3", "c": 4})
49-
>>> attrs
50-
{'a': 3, 'c': 4}
46+
attrs = {"a": 1, "b": 2}
47+
attrs.clear()
48+
attrs.update({"a": "3", "c": 4})
49+
print(attrs)
50+
#> {'a': '3', 'c': 4}
5151
```
5252
"""
5353
self._obj.metadata.attributes.clear()

src/zarr/core/dtype/npy/string.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class FixedLengthUTF32JSON_V3(NamedConfig[Literal["fixed_length_utf32"], LengthB
9999
"name": "fixed_length_utf32",
100100
"configuration": {
101101
"length_bytes": 12
102+
}
102103
}
103104
```
104105
"""

src/zarr/core/dtype/npy/structured.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class StructuredJSON_V3(
7474
"name": "structured",
7575
"configuration": {
7676
"fields": [
77-
["f0", "int32],
77+
["f0", "int32"],
7878
["f1", "float64"],
7979
]
8080
}

0 commit comments

Comments
 (0)