[records] early return if we got an int
This commit is contained in:
parent
9cfcad9acd
commit
966e350f66
1 changed files with 4 additions and 0 deletions
|
|
@ -173,6 +173,8 @@ class GENERATIONS(Int2Record):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_data(cls: type[Self], data: NDArray[numpy.integer] | Sequence[int] | int) -> None:
|
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:
|
if not isinstance(data, Sized) or len(data) != 1:
|
||||||
raise KlamathError(f'Expected exactly one integer, got {data}')
|
raise KlamathError(f'Expected exactly one integer, got {data}')
|
||||||
|
|
||||||
|
|
@ -270,6 +272,8 @@ class FORMAT(Int2Record):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_data(cls: type[Self], data: NDArray[numpy.integer] | Sequence[int] | int) -> None:
|
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:
|
if not isinstance(data, Sized) or len(data) != 1:
|
||||||
raise KlamathError(f'Expected exactly one integer, got {data}')
|
raise KlamathError(f'Expected exactly one integer, got {data}')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue