Skip to content

Commit e424a96

Browse files
committed
Fix type-hints
1 parent 658c4d5 commit e424a96

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

pandas/compat/numpy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
r".*In the future `np\.long` will be defined as.*",
3737
FutureWarning,
3838
)
39-
np_long = np.long # type: ignore[attr-defined]
40-
np_ulong = np.ulong # type: ignore[attr-defined]
39+
np_long = np.long
40+
np_ulong = np.ulong
4141
except AttributeError:
4242
np_long = np.int_
4343
np_ulong = np.uint

pandas/core/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ def asarray_tuplesafe(values: Iterable, dtype: NpDtype | None = None) -> ArrayLi
246246
with warnings.catch_warnings():
247247
# Can remove warning filter once NumPy 1.24 is min version
248248
if not np_version_gte1p24:
249-
warnings.simplefilter("ignore", np.VisibleDeprecationWarning)
249+
# np.VisibleDeprecationWarning only in np.exceptions in 2.0
250+
warnings.simplefilter("ignore", np.VisibleDeprecationWarning) # type: ignore[attr-defined]
250251
result = np.asarray(values, dtype=dtype)
251252
except ValueError:
252253
# Using try/except since it's more performant than checking is_list_like

pandas/core/internals/managers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,12 @@ def setitem(self, indexer, value) -> Self:
572572
0, blk_loc, values
573573
)
574574
# first block equals values
575-
self.blocks[0].setitem((indexer[0], np.arange(len(blk_loc))), value)
575+
col_indexer: slice | np.ndarray
576+
if isinstance(indexer[1], slice) and indexer[1] == slice(None):
577+
col_indexer = slice(None)
578+
else:
579+
col_indexer = np.arange(len(blk_loc))
580+
self.blocks[0].setitem((indexer[0], col_indexer), value)
576581
return self
577582
# No need to split if we either set all columns or on a single block
578583
# manager

pandas/tests/extension/date/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(
113113

114114
# error: "object_" object is not iterable
115115
obj = np.char.split(dates, sep="-")
116-
for (i,), (y, m, d) in np.ndenumerate(obj): # type: ignore[misc]
116+
for (i,), (y, m, d) in np.ndenumerate(obj):
117117
self._year[i] = int(y)
118118
self._month[i] = int(m)
119119
self._day[i] = int(d)

0 commit comments

Comments
 (0)