Skip to content

Commit

Permalink
docstring and matching cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
slevang committed Nov 29, 2024
1 parent 72d8987 commit 4f2521a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions numcodecs/pcodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ class PCodec(Codec):
Configures whether Pcodec should try to infer the best "mode" or
structure of the data (e.g. approximate multiples of 0.1) to improve
compression ratio, or skip this step and just use the numbers as-is
(Classic mode).
(Classic mode). Note that the "try*" specs are not currently supported.
delta_spec : {"auto", "none", "try_consecutive", "try_lookback"}
Configures the delta encoding strategy. By default, uses "auto" which
will try to infer the best encoding order.
paging_spec : {"equal_pages_up_to"}
Configures the paging strategy. Only "equal_pages_up_to" is currently
supported.
delta_encoding_order : int or None
Explicit delta encoding level from 0-7. Only valid if delta_spec is
"try_consecutive" or None.
"try_consecutive" or "auto" (to support backwards compatibility with
older versions of this codec).
equal_pages_up_to : int
Divide the chunk into equal pages of up to this many numbers.
"""
Expand All @@ -47,6 +51,7 @@ class PCodec(Codec):
def __init__(
self,
level: int = 8,
*,
mode_spec: Literal["auto", "classic"] = "auto",
delta_spec: Literal["auto", "none", "try_consecutive", "try_lookback"] = "auto",
paging_spec: Literal["equal_pages_up_to"] = "equal_pages_up_to",
Expand Down Expand Up @@ -83,7 +88,7 @@ def _get_chunk_config(self):
)
else:
match self.delta_spec:
case "auto" | None:
case "auto":
delta_spec = DeltaSpec.auto()
case "none":
delta_spec = DeltaSpec.none()
Expand All @@ -95,7 +100,7 @@ def _get_chunk_config(self):
raise ValueError(f"delta_spec {self.delta_spec} is not supported")

Check warning on line 100 in numcodecs/pcodec.py

View check run for this annotation

Codecov / codecov/patch

numcodecs/pcodec.py#L90-L100

Added lines #L90 - L100 were not covered by tests

match self.paging_spec:
case "equal_pages_up_to" | None:
case "equal_pages_up_to":
paging_spec = PagingSpec.equal_pages_up_to(self.equal_pages_up_to)
case _:
raise ValueError(f"paging_spec {self.paging_spec} is not supported")

Check warning on line 106 in numcodecs/pcodec.py

View check run for this annotation

Codecov / codecov/patch

numcodecs/pcodec.py#L102-L106

Added lines #L102 - L106 were not covered by tests
Expand Down

0 comments on commit 4f2521a

Please sign in to comment.