diff --git a/pandas/core/dtypes/dtypes.py b/pandas/core/dtypes/dtypes.py index ac46580a8cf30..96b0aa16940a6 100644 --- a/pandas/core/dtypes/dtypes.py +++ b/pandas/core/dtypes/dtypes.py @@ -2131,10 +2131,10 @@ def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None: stacklevel=find_stack_level(), ) np_dtypes = (x.subtype if isinstance(x, SparseDtype) else x for x in dtypes) - # error: Argument 1 to "np_find_common_type" has incompatible type - # "*Generator[Any | dtype[Any] | ExtensionDtype, None, None]"; + # error: Argument 1 to "np_find_common_type" has incompatible type + # "*Generator[Any | dtype[Any] | ExtensionDtype, None, None]"; # expected "dtype[Any]" [arg-type] - return SparseDtype(np_find_common_type(*np_dtypes), fill_value=fill_value) # type: ignore [arg-type] + return SparseDtype(np_find_common_type(*np_dtypes), fill_value=fill_value) # type: ignore [arg-type] @register_extension_dtype diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 08bd3cde60806..975e7ad135ba7 100644 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -914,7 +914,9 @@ def __setitem__(self, key, value) -> None: indexer = self._get_setitem_indexer(key) self._has_valid_setitem_indexer(key) - iloc = self if self.name == "iloc" else self.obj.iloc + iloc: _iLocIndexer = ( + cast("_iLocIndexer", self) if self.name == "iloc" else self.obj.iloc + ) iloc._setitem_with_indexer(indexer, value, self.name) def _validate_key(self, key, axis: AxisInt) -> None: diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py index 1c35eacf55c03..d6154e2352c63 100644 --- a/pandas/core/nanops.py +++ b/pandas/core/nanops.py @@ -726,7 +726,9 @@ def nanmean( @bottleneck_switch() -def nanmedian(values: np.ndarray, *, axis: AxisInt | None = None, skipna: bool = True, mask=None) -> float | np.ndarray: +def nanmedian( + values: np.ndarray, *, axis: AxisInt | None = None, skipna: bool = True, mask=None +) -> float | np.ndarray: """ Parameters ---------- diff --git a/pandas/io/common.py b/pandas/io/common.py index 78fcdf8ff14b4..de70ed91c7dd4 100644 --- a/pandas/io/common.py +++ b/pandas/io/common.py @@ -910,12 +910,14 @@ def get_handle( or not hasattr(handle, "seekable") ): handle = _IOWrapper(handle) + # error: Value of type variable "_BufferT_co" of "TextIOWrapper" cannot + # be "_IOWrapper | BaseBuffer" [type-var] handle = TextIOWrapper( - handle, + handle, # type: ignore[type-var] encoding=ioargs.encoding, errors=errors, newline="", - ) + ) # type: ignore[arg-type] handles.append(handle) # only marked as wrapped when the caller provided a handle is_wrapped = not ( diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 7a2796281cf5b..3fbd4c6f6e26a 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -1038,9 +1038,9 @@ def __call__(self, *args, **kwargs): label_name = label_kw or y data.name = label_name else: - # error: Argument 1 to "len" has incompatible type "Any | bool"; + # error: Argument 1 to "len" has incompatible type "Any | bool"; # expected "Sized" [arg-type] - match = is_list_like(label_kw) and len(label_kw) == len(y) # type: ignore[arg-type] + match = is_list_like(label_kw) and len(label_kw) == len(y) # type: ignore[arg-type] if label_kw and not match: raise ValueError( "label should be list-like and same length as y" diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index c28a33069d23f..beca8dea9407d 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -237,14 +237,17 @@ def types_table_metadata(dialect: str): "types", metadata, Column("TextCol", TEXT), - Column("DateCol", date_type), + # error: Cannot infer type argument 1 of "Column" + Column("DateCol", date_type), # type: ignore[misc] Column("IntDateCol", Integer), Column("IntDateOnlyCol", Integer), Column("FloatCol", Float), Column("IntCol", Integer), - Column("BoolCol", bool_type), + # error: Cannot infer type argument 1 of "Column" + Column("BoolCol", bool_type), # type: ignore[misc] Column("IntColWithNull", Integer), - Column("BoolColWithNull", bool_type), + # error: Cannot infer type argument 1 of "Column" + Column("BoolColWithNull", bool_type), # type: ignore[misc] ) return types