Skip to content

Commit bb28d1d

Browse files
committed
fix docstrings
1 parent c1991e4 commit bb28d1d

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

src/zarr/abc/numcodec.py

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,64 @@ class Numcodec(Protocol):
77
"""
88
A protocol that models the ``numcodecs.abc.Codec`` interface.
99
10-
This protocol should be considered experimental; expect the typing for `buf`, and `out` to become stricter.
10+
This protocol should be considered experimental. Expect the type annotations for ``buf`` and
11+
``out`` to narrow in the future.
1112
"""
1213

1314
codec_id: str
1415

15-
def encode(self, buf: Any) -> Any: ...
16-
"""Encode data in `buf`.
16+
def encode(self, buf: Any) -> Any:
17+
"""Encode data from ``buf``.
1718
1819
Parameters
1920
----------
20-
buf
21-
Data to be encoded. May be any object supporting the new-style
22-
buffer protocol.
21+
buf : Any
22+
Data to be encoded.
2323
2424
Returns
2525
-------
26-
enc
27-
Encoded data. May be any object supporting the new-style buffer
28-
protocol.
26+
enc: Any
27+
Encoded data.
2928
"""
29+
...
3030

31-
def decode(self, buf: Any, out: Any | None = None) -> Any: ...
31+
def decode(self, buf: Any, out: Any | None = None) -> Any:
3232
"""
33-
Decode data in `buf`.
33+
Decode data in ``buf``.
3434
3535
Parameters
3636
----------
3737
buf : Any
38-
Encoded data. May be any object supporting the new-style buffer
39-
protocol.
38+
Encoded data.
4039
out : Any
41-
Writeable buffer to store decoded data. N.B. if provided, this buffer must
40+
Writeable buffer to store decoded data. If provided, this buffer must
4241
be exactly the right size to store the decoded data.
4342
4443
Returns
4544
-------
4645
dec : Any
47-
Decoded data. May be any object supporting the new-style
48-
buffer protocol.
46+
Decoded data.
4947
"""
48+
...
5049

51-
def get_config(self) -> Any: ...
50+
def get_config(self) -> Any:
5251
"""
53-
Return a dictionary holding configuration parameters for this
54-
codec. Must include an 'id' field with the codec identifier. All
55-
values must be compatible with JSON encoding.
52+
Return a JSON-serializable configuration dictionary for this
53+
codec. Must include an ``'id'`` field with the codec identifier.
5654
"""
55+
...
5756

5857
@classmethod
59-
def from_config(cls, config: Any) -> Self: ...
58+
def from_config(cls, config: Any) -> Self:
6059
"""
61-
Instantiate codec from a configuration object.
60+
Instantiate a codec from a configuration dictionary.
61+
62+
Parameters
63+
----------
64+
config : Any
65+
A configuration dictionary for this codec.
6266
"""
67+
...
6368

6469

6570
def _is_numcodec_cls(obj: object) -> TypeGuard[type[Numcodec]]:

0 commit comments

Comments
 (0)