Skip to content

Commit 3e5b664

Browse files
committed
chore: update error comments
1 parent a46f838 commit 3e5b664

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

pandas/_typing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383

8484
# numpy compatible types
8585
NumpyValueArrayLike: TypeAlias = ScalarLike_co | npt.ArrayLike
86-
# Name "npt._ArrayLikeInt_co" is not defined [name-defined]
8786
NumpySorter: TypeAlias = npt._ArrayLikeInt_co | None
8887

8988

pandas/core/arrays/_mixins.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def view(self, dtype: Dtype | None = None) -> ArrayLike:
151151

152152
td64_values = arr.view(dtype)
153153
return TimedeltaArray._simple_new(td64_values, dtype=dtype)
154+
# error: Argument "dtype" to "view" of "ndarray" has incompatible type
155+
# "ExtensionDtype | dtype[Any]"; expected "dtype[Any] | _HasDType[dtype[Any]]"
154156
return arr.view(dtype=dtype) # type: ignore[arg-type]
155157

156158
def take(

pandas/core/arrays/datetimes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,10 @@ def _add_offset(self, offset: BaseOffset) -> Self:
804804
try:
805805
res_values = offset._apply_array(values._ndarray)
806806
if res_values.dtype.kind == "i":
807+
# error: Argument 1 to "view" of "ndarray" has
808+
# incompatible type
809+
# "dtype[datetime64[date | int | None]] | DatetimeTZDtype";
810+
# expected "dtype[Any] | _HasDType[dtype[Any]]" [arg-type]
807811
res_values = res_values.view(values.dtype) # type: ignore[arg-type]
808812
except NotImplementedError:
809813
if get_option("performance_warnings"):

pandas/core/nanops.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,6 @@ def _mask_datetimelike_result(
651651
# we need to apply the mask
652652
result = result.astype("i8").view(orig_values.dtype)
653653
axis_mask = mask.any(axis=axis)
654-
# error: Unsupported target for indexed assignment ("Union[ndarray[Any, Any],
655-
# datetime64, timedelta64]")
656654
result[axis_mask] = iNaT
657655
else:
658656
if mask.any():

pandas/core/reshape/merge.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,8 @@ def _maybe_coerce_merge_keys(self) -> None:
17461746

17471747
mask = ~np.isnan(lk)
17481748
match = lk == casted
1749+
# error: Item "ExtensionArray" of
1750+
# "ExtensionArray | Any" has no attribute "all"
17491751
if not match[mask].all(): # type: ignore[union-attr]
17501752
warnings.warn(
17511753
"You are merging on int and float "
@@ -1766,6 +1768,8 @@ def _maybe_coerce_merge_keys(self) -> None:
17661768

17671769
mask = ~np.isnan(rk)
17681770
match = rk == casted
1771+
# error: Item "ExtensionArray" of
1772+
# "ExtensionArray | Any" has no attribute "all"
17691773
if not match[mask].all(): # type: ignore[union-attr]
17701774
warnings.warn(
17711775
"You are merging on int and float "

pandas/io/pytables.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3301,17 +3301,15 @@ def write_array(
33013301
# store as UTC
33023302
# with a zone
33033303

3304-
# error: Item "ExtensionArray" of "Union[Any, ExtensionArray]" has no
3305-
# attribute "asi8"
3304+
# error: "ExtensionArray" has no attribute "asi8"
33063305
self._handle.create_array(
33073306
self.group,
33083307
key,
33093308
value.asi8, # type: ignore[attr-defined]
33103309
)
33113310

33123311
node = getattr(self.group, key)
3313-
# error: Item "ExtensionArray" of "Union[Any, ExtensionArray]" has no
3314-
# attribute "tz"
3312+
# error: "ExtensionArray" has no attribute "tz"
33153313
node._v_attrs.tz = _get_tz(value.tz) # type: ignore[attr-defined]
33163314
node._v_attrs.value_type = f"datetime64[{value.dtype.unit}]"
33173315
elif lib.is_np_dtype(value.dtype, "m"):
@@ -5195,7 +5193,6 @@ def _maybe_convert_for_string_atom(
51955193
columns: list[str],
51965194
):
51975195
if isinstance(bvalues.dtype, StringDtype):
5198-
# "ndarray[Any, Any]" has no attribute "to_numpy"
51995196
bvalues = bvalues.to_numpy()
52005197
if bvalues.dtype != object:
52015198
return bvalues

0 commit comments

Comments
 (0)