4141try :
4242 import zarr # noqa: F401
4343
44- if Version (version ('zarr' )) < Version ("3.0.0" ): # pragma: no cover
44+ if Version (version ('zarr' )) < Version ("3.0.0" ):
4545 raise ImportError ("zarr 3.0.0 or later is required to use the numcodecs zarr integration." )
46- except ImportError as e : # pragma: no cover
46+ except ImportError as e :
4747 raise ImportError (
4848 "zarr 3.0.0 or later is required to use the numcodecs zarr integration."
4949 ) from e
@@ -67,22 +67,20 @@ def _from_zarr_dtype(dtype: Any) -> np.dtype:
6767 """
6868 if Version (version ('zarr' )) >= Version ("3.1.0" ):
6969 return dtype .to_native_dtype ()
70- return dtype # pragma: no cover
70+ return dtype
7171
7272
7373def _to_zarr_dtype (dtype : np .dtype ) -> Any :
7474 if Version (version ('zarr' )) >= Version ("3.1.0" ):
7575 from zarr .dtype import parse_data_type
7676
7777 return parse_data_type (dtype , zarr_format = 3 )
78- return dtype # pragma: no cover
78+ return dtype
7979
8080
8181def _expect_name_prefix (codec_name : str ) -> str :
8282 if not codec_name .startswith (CODEC_PREFIX ):
83- raise ValueError (
84- f"Expected name to start with '{ CODEC_PREFIX } '. Got { codec_name } instead."
85- ) # pragma: no cover
83+ raise ValueError (f"Expected name to start with '{ CODEC_PREFIX } '. Got { codec_name } instead." )
8684 return codec_name .removeprefix (CODEC_PREFIX )
8785
8886
@@ -91,7 +89,7 @@ def _parse_codec_configuration(data: dict[str, JSON]) -> dict[str, JSON]:
9189 if not parsed_name .startswith (CODEC_PREFIX ):
9290 raise ValueError (
9391 f"Expected name to start with '{ CODEC_PREFIX } '. Got { parsed_name } instead."
94- ) # pragma: no cover
92+ )
9593 id = _expect_name_prefix (parsed_name )
9694 return {"id" : id , ** parsed_configuration }
9795
@@ -117,15 +115,15 @@ def __init__(self, **codec_config: JSON) -> None:
117115 if not self .codec_name :
118116 raise ValueError (
119117 "The codec name needs to be supplied through the `codec_name` attribute."
120- ) # pragma: no cover
118+ )
121119 unprefixed_codec_name = _expect_name_prefix (self .codec_name )
122120
123121 if "id" not in codec_config :
124122 codec_config = {"id" : unprefixed_codec_name , ** codec_config }
125123 elif codec_config ["id" ] != unprefixed_codec_name :
126124 raise ValueError (
127125 f"Codec id does not match { unprefixed_codec_name } . Got: { codec_config ['id' ]} ."
128- ) # pragma: no cover
126+ )
129127
130128 object .__setattr__ (self , "codec_config" , codec_config )
131129 warn (
@@ -310,16 +308,15 @@ def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
310308
311309 def evolve_from_array_spec (self , array_spec : ArraySpec ) -> AsType :
312310 if self .codec_config .get ("decode_dtype" ) is None :
313- # TODO: remove these coverage exemptions the correct way, i.e. with tests
314- dtype = _from_zarr_dtype (array_spec .dtype ) # pragma: no cover
315- return AsType (** {** self .codec_config , "decode_dtype" : str (dtype )}) # pragma: no cover
311+ dtype = _from_zarr_dtype (array_spec .dtype )
312+ return AsType (** {** self .codec_config , "decode_dtype" : str (dtype )})
316313 return self
317314
318315
319316# bytes-to-bytes checksum codecs
320317class _NumcodecsChecksumCodec (_NumcodecsBytesBytesCodec ):
321318 def compute_encoded_size (self , input_byte_length : int , chunk_spec : ArraySpec ) -> int :
322- return input_byte_length + 4 # pragma: no cover
319+ return input_byte_length + 4
323320
324321
325322class CRC32 (_NumcodecsChecksumCodec , codec_name = "crc32" ):
0 commit comments