From b4ac87cb96cb5186a53228809a33b45d88332fa3 Mon Sep 17 00:00:00 2001 From: Benjamin Gaidioz Date: Fri, 22 May 2026 17:56:09 +0200 Subject: [PATCH] Silence pandas-stubs call-overload error in null normalization helpers The where(..., None) pattern in _normalize_pandas_dataframe_nulls and _normalize_pandas_series_nulls is supported at runtime but rejected by pandas-stubs 2.3.3.260113, which no longer lists None in the `other` overload for DataFrame.where / Series.where. This triggers [call-overload] plus a cascading [no-any-return] error and breaks `uv run mypy .` on PR #271's branch. Suppress both errors inline with a short comment explaining the pandas-stubs gap. The PR #278 attempt traded one stricter-stubs error (replace's mapping type) for the same kind of error on where, so this keeps the existing helper structure and just lands the type ignore. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/mxcp/sdk/validator/converters.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mxcp/sdk/validator/converters.py b/src/mxcp/sdk/validator/converters.py index 5408c064..670f97ec 100644 --- a/src/mxcp/sdk/validator/converters.py +++ b/src/mxcp/sdk/validator/converters.py @@ -23,12 +23,14 @@ class TypeConverter: @staticmethod def _normalize_pandas_dataframe_nulls(value: pd.DataFrame) -> pd.DataFrame: """Convert pandas null sentinels into Python None for output handling.""" - return value.astype(object).where(value.notna(), None) + # pandas-stubs rejects None as the `other` arg of where(), but it is supported at runtime. + return value.astype(object).where(value.notna(), None) # type: ignore[call-overload,no-any-return] @staticmethod def _normalize_pandas_series_nulls(value: pd.Series) -> pd.Series: """Convert pandas null sentinels into Python None for output handling.""" - return value.astype(object).where(value.notna(), None) + # pandas-stubs rejects None as the `other` arg of where(), but it is supported at runtime. + return value.astype(object).where(value.notna(), None) # type: ignore[call-overload,no-any-return] @staticmethod def python_type_to_schema_type(python_type: str) -> str: