From 00138affdde8205a348be40636452f3305fd124f Mon Sep 17 00:00:00 2001 From: jmoore Date: Wed, 13 Apr 2022 12:47:39 +0200 Subject: [PATCH] Relax version detection Some writers (like for the DANDI project) have stored the versions as floating point values (e.g. `0.2`). Though this won't be long-term sustainable, relaxing the version identification at this point seems unproblematic. --- ome_zarr/format.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ome_zarr/format.py b/ome_zarr/format.py index d42fccdb..a2c9ce14 100644 --- a/ome_zarr/format.py +++ b/ome_zarr/format.py @@ -12,6 +12,11 @@ def format_from_version(version: str) -> "Format": for fmt in format_implementations(): + + # Support floating-point versions like `0.2` + if isinstance(version, float): + version = str(version) + if fmt.version == version: return fmt raise ValueError(f"Version {version} not recognized")