From 966e350f663a4b6f5ba73e70778407adc432f623 Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 9 Mar 2026 01:00:48 -0700 Subject: [PATCH] [records] early return if we got an int --- klamath/records.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/klamath/records.py b/klamath/records.py index d5ac938..b05bb04 100644 --- a/klamath/records.py +++ b/klamath/records.py @@ -173,6 +173,8 @@ class GENERATIONS(Int2Record): @classmethod def check_data(cls: type[Self], data: NDArray[numpy.integer] | Sequence[int] | int) -> None: + if isinstance(data, (int, numpy.integer)): + return if not isinstance(data, Sized) or len(data) != 1: raise KlamathError(f'Expected exactly one integer, got {data}') @@ -270,6 +272,8 @@ class FORMAT(Int2Record): @classmethod def check_data(cls: type[Self], data: NDArray[numpy.integer] | Sequence[int] | int) -> None: + if isinstance(data, (int, numpy.integer)): + return if not isinstance(data, Sized) or len(data) != 1: raise KlamathError(f'Expected exactly one integer, got {data}')