@@ -233,7 +233,7 @@ def make_block_same_class(
233
233
values ,
234
234
placement : BlockPlacement | None = None ,
235
235
refs : BlockValuesRefs | None = None ,
236
- ) -> Block :
236
+ ) -> Self :
237
237
"""Wrap given values in a block of same type as self."""
238
238
# Pre-2.0 we called ensure_wrapped_if_datetimelike because fastparquet
239
239
# relied on it, as of 2.0 the caller is responsible for this.
@@ -503,6 +503,7 @@ def convert(
503
503
# ---------------------------------------------------------------------
504
504
# Array-Like Methods
505
505
506
+ @final
506
507
@cache_readonly
507
508
def dtype (self ) -> DtypeObj :
508
509
return self .values .dtype
@@ -559,7 +560,7 @@ def to_native_types(self, na_rep: str = "nan", quoting=None, **kwargs) -> Block:
559
560
return self .make_block (result )
560
561
561
562
@final
562
- def copy (self , deep : bool = True ) -> Block :
563
+ def copy (self , deep : bool = True ) -> Self :
563
564
"""copy constructor"""
564
565
values = self .values
565
566
refs : BlockValuesRefs | None
@@ -1499,7 +1500,8 @@ def quantile(
1499
1500
result = ensure_block_shape (result , ndim = 2 )
1500
1501
return new_block_2d (result , placement = self ._mgr_locs )
1501
1502
1502
- def round (self , decimals : int , using_cow : bool = False ) -> Block :
1503
+ @final
1504
+ def round (self , decimals : int , using_cow : bool = False ) -> Self :
1503
1505
"""
1504
1506
Rounds the values.
1505
1507
If the block is not of an integer or float dtype, nothing happens.
@@ -1765,9 +1767,7 @@ def putmask(self, mask, new, using_cow: bool = False) -> list[Block]:
1765
1767
1766
1768
if using_cow and self .refs .has_reference ():
1767
1769
values = values .copy ()
1768
- self = self .make_block_same_class ( # type: ignore[assignment]
1769
- values .T if values .ndim == 2 else values
1770
- )
1770
+ self = self .make_block_same_class (values .T if values .ndim == 2 else values )
1771
1771
1772
1772
try :
1773
1773
# Caller is responsible for ensuring matching lengths
0 commit comments