From 94f45e19d140d4478de45605c2a9ecb9aa2c0c57 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 17 Jul 2025 22:11:18 +0200 Subject: [PATCH] Use `in` and `or` instead of multiple `if`'s --- src/zarr/core/dtype/npy/common.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/zarr/core/dtype/npy/common.py b/src/zarr/core/dtype/npy/common.py index 264561f25c..67644449a0 100644 --- a/src/zarr/core/dtype/npy/common.py +++ b/src/zarr/core/dtype/npy/common.py @@ -384,9 +384,7 @@ def check_json_float_v2(data: JSON) -> TypeGuard[JSONFloatV2]: Bool True if the data is a float, False otherwise. """ - if data == "NaN" or data == "Infinity" or data == "-Infinity": - return True - return isinstance(data, float | int) + return data in ("NaN", "Infinity", "-Infinity") or isinstance(data, float | int) def check_json_float_v3(data: JSON) -> TypeGuard[JSONFloatV3]: