From 029d0b15d15da9bf4b127ff5841e88f733c820c4 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 7 Nov 2022 02:10:16 -0800 Subject: [PATCH 1/7] Drop `else` case Since nothing is done in this case, we can just skip having it. So drop this case. --- numcodecs/zfpy.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/numcodecs/zfpy.py b/numcodecs/zfpy.py index 88f2f75e..ac09074c 100644 --- a/numcodecs/zfpy.py +++ b/numcodecs/zfpy.py @@ -46,8 +46,6 @@ def __init__( self.compression_kwargs = {"rate": rate} elif mode == _zfpy.mode_fixed_precision: self.compression_kwargs = {"precision": precision} - else: - pass self.tolerance = tolerance self.rate = rate From ca0ef4e99a2b85393ecd9039cdd754bc90403c53 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 7 Nov 2022 02:12:50 -0800 Subject: [PATCH 2/7] Assert `keepbits` is as expected --- numcodecs/bitround.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/numcodecs/bitround.py b/numcodecs/bitround.py index 767e5e43..9d37c8a1 100644 --- a/numcodecs/bitround.py +++ b/numcodecs/bitround.py @@ -39,8 +39,7 @@ class BitRound(Codec): codec_id = 'bitround' def __init__(self, keepbits: int): - if keepbits < 0: - raise ValueError("keepbits must be zero or positive") + assert keepbits < 0, "keepbits must be zero or positive" self.keepbits = keepbits def encode(self, buf): From 3309f8a15b3947b6e6d5aa585cff78c015391058 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 7 Nov 2022 02:17:12 -0800 Subject: [PATCH 3/7] Ignore `...` lines in `NDArrayLike` `Protocol` --- docs/release.rst | 3 +++ numcodecs/ndarray_like.py | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/release.rst b/docs/release.rst index b9a18930..5f3d6576 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -58,6 +58,9 @@ Maintenance * Update ReadTheDocs. By :user:`John Kirkham `, :issue:`383`. +* Bring coverage back up to 100%. + By :user:`John Kirkham `, :issue:`392`. + * Collect coverage on all OSes & enable Codecov. By :user:`John Kirkham `, :issue:`386`, :issue:`388`, :issue:`390`, :issue:`391`. diff --git a/numcodecs/ndarray_like.py b/numcodecs/ndarray_like.py index c4fc8f4b..23d4fd41 100644 --- a/numcodecs/ndarray_like.py +++ b/numcodecs/ndarray_like.py @@ -53,22 +53,22 @@ class NDArrayLike(Protocol, metaclass=_CachedProtocolMeta): flags: FlagsObj def __len__(self) -> int: - ... + ... # pragma: no cover def __getitem__(self, key) -> Any: - ... + ... # pragma: no cover def __setitem__(self, key, value): - ... + ... # pragma: no cover def tobytes(self, order: Optional[str] = ...) -> bytes: - ... + ... # pragma: no cover def reshape(self, *shape: int, order: str = ...) -> "NDArrayLike": - ... + ... # pragma: no cover def view(self, dtype: DType = ...) -> "NDArrayLike": - ... + ... # pragma: no cover def is_ndarray_like(obj: object) -> bool: From 01c8968750858a27718e94e790a2a891a3fc68a1 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Mon, 7 Nov 2022 11:52:41 +0100 Subject: [PATCH 4/7] Correct keepbits assertion --- numcodecs/bitround.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numcodecs/bitround.py b/numcodecs/bitround.py index 9d37c8a1..fb32f16c 100644 --- a/numcodecs/bitround.py +++ b/numcodecs/bitround.py @@ -39,7 +39,7 @@ class BitRound(Codec): codec_id = 'bitround' def __init__(self, keepbits: int): - assert keepbits < 0, "keepbits must be zero or positive" + assert keepbits >= 0, "keepbits must be zero or positive" self.keepbits = keepbits def encode(self, buf): From 59fa03acffe223e0e1d383946afa28b8f1175978 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 7 Nov 2022 11:32:41 -0800 Subject: [PATCH 5/7] Revert change in `bitround` --- numcodecs/bitround.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/numcodecs/bitround.py b/numcodecs/bitround.py index fb32f16c..767e5e43 100644 --- a/numcodecs/bitround.py +++ b/numcodecs/bitround.py @@ -39,7 +39,8 @@ class BitRound(Codec): codec_id = 'bitround' def __init__(self, keepbits: int): - assert keepbits >= 0, "keepbits must be zero or positive" + if keepbits < 0: + raise ValueError("keepbits must be zero or positive") self.keepbits = keepbits def encode(self, buf): From 8b09bea9949769b815de442d0c8c4466ebe9d5fc Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 7 Nov 2022 11:35:11 -0800 Subject: [PATCH 6/7] Include Martin's contribution in release notes --- docs/release.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index 5f3d6576..48291965 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -59,7 +59,8 @@ Maintenance By :user:`John Kirkham `, :issue:`383`. * Bring coverage back up to 100%. - By :user:`John Kirkham `, :issue:`392`. + By :user:`John Kirkham ` and :user:`Martin Durant `, + :issue:`392` and :issue:`393`. * Collect coverage on all OSes & enable Codecov. By :user:`John Kirkham `, :issue:`386`, :issue:`388`, From 9130735165e1a735e72dab5824ca4932bbfea906 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Mon, 7 Nov 2022 11:40:19 -0800 Subject: [PATCH 7/7] Ignore missing codec from registry case --- numcodecs/tests/test_registry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numcodecs/tests/test_registry.py b/numcodecs/tests/test_registry.py index a9e6b233..fa17259c 100644 --- a/numcodecs/tests/test_registry.py +++ b/numcodecs/tests/test_registry.py @@ -37,4 +37,4 @@ def test_all_classes_registered(): # remove `None`` missing.remove(None) if missing: - raise Exception(f"these codecs are missing: {missing}") + raise Exception(f"these codecs are missing: {missing}") # pragma: no cover