Skip to content

Commit 465276c

Browse files
committed
address comments from copilot
Signed-off-by: Nitish Bharambe <[email protected]>
1 parent 5ffca6b commit 465276c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/power_grid_model_io/converters/pgm_json_converter.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
from power_grid_model_io.data_types import ExtraInfo, StructuredData
2222
from power_grid_model_io.utils.dict import merge_dicts
2323

24+
_NAN_FUNC = {
25+
np.dtype("f8"): lambda x: np.all(np.isnan(x)),
26+
np.dtype("i4"): lambda x: np.all(x == np.iinfo(np.dtype("i4")).min),
27+
np.dtype("i1"): lambda x: np.all(x == np.iinfo(np.dtype("i1")).min),
28+
}
29+
2430

2531
class PgmJsonConverter(BaseConverter[StructuredData]):
2632
"""
@@ -306,9 +312,4 @@ def _is_nan(data: np.ndarray) -> bool:
306312
True when all the data points are invalid
307313
False otherwise
308314
"""
309-
nan_func = {
310-
np.dtype("f8"): lambda x: np.all(np.isnan(x)),
311-
np.dtype("i4"): lambda x: np.all(x == np.iinfo(np.dtype("i4")).min),
312-
np.dtype("i1"): lambda x: np.all(x == np.iinfo(np.dtype("i1")).min),
313-
}
314-
return bool(nan_func[data.dtype](data))
315+
return bool(_NAN_FUNC[data.dtype](data))

0 commit comments

Comments
 (0)