Skip to content

Commit f1a8999

Browse files
authored
CLN: unnecessary arg, declarations (#43684)
1 parent 0c3314d commit f1a8999

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

pandas/_libs/index_class_helper.pxi.in

-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ cdef class {{name}}Engine(IndexEngine):
4949
# Returns ndarray[bool] or int
5050
cdef:
5151
ndarray[uint8_t, ndim=1, cast=True] indexer
52-
ndarray[intp_t, ndim=1] found
5352
ndarray[{{dtype}}_t, ndim=1] values
54-
int count = 0
5553

5654
self._check_type(val)
5755

pandas/core/algorithms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def unique(values):
422422
"""
423423
values = _ensure_arraylike(values)
424424

425-
if is_extension_array_dtype(values):
425+
if is_extension_array_dtype(values.dtype):
426426
# Dispatch to extension dtype's unique.
427427
return values.unique()
428428

pandas/core/internals/managers.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
type_t,
2727
)
2828
from pandas.errors import PerformanceWarning
29+
from pandas.util._decorators import cache_readonly
2930
from pandas.util._validators import validate_bool_kwarg
3031

3132
from pandas.core.dtypes.cast import infer_dtype_from_scalar
@@ -1706,7 +1707,7 @@ def unpickle_block(values, mgr_locs, ndim: int) -> Block:
17061707
def _post_setstate(self):
17071708
pass
17081709

1709-
@property
1710+
@cache_readonly
17101711
def _block(self) -> Block:
17111712
return self.blocks[0]
17121713

@@ -1729,7 +1730,7 @@ def getitem_mgr(self, indexer) -> SingleBlockManager:
17291730
raise ValueError("dimension-expanding indexing not allowed")
17301731

17311732
bp = BlockPlacement(slice(0, len(array)))
1732-
block = blk.make_block_same_class(array, placement=bp)
1733+
block = type(blk)(array, placement=bp, ndim=1)
17331734

17341735
new_idx = self.index[indexer]
17351736
return type(self)(block, new_idx)
@@ -1926,7 +1927,7 @@ def _form_blocks(arrays: list[ArrayLike], consolidate: bool) -> list[Block]:
19261927
tuples = list(enumerate(arrays))
19271928

19281929
if not consolidate:
1929-
nbs = _tuples_to_blocks_no_consolidate(tuples, dtype=None)
1930+
nbs = _tuples_to_blocks_no_consolidate(tuples)
19301931
return nbs
19311932

19321933
# group by dtype
@@ -1966,17 +1967,8 @@ def _form_blocks(arrays: list[ArrayLike], consolidate: bool) -> list[Block]:
19661967
return nbs
19671968

19681969

1969-
def _tuples_to_blocks_no_consolidate(tuples, dtype: DtypeObj | None) -> list[Block]:
1970+
def _tuples_to_blocks_no_consolidate(tuples) -> list[Block]:
19701971
# tuples produced within _form_blocks are of the form (placement, array)
1971-
if dtype is not None:
1972-
return [
1973-
new_block(
1974-
ensure_block_shape(x[1].astype(dtype, copy=False), ndim=2),
1975-
placement=x[0],
1976-
ndim=2,
1977-
)
1978-
for x in tuples
1979-
]
19801972
return [
19811973
new_block(ensure_block_shape(x[1], ndim=2), placement=x[0], ndim=2)
19821974
for x in tuples

0 commit comments

Comments
 (0)