Skip to content

Commit 7f503d2

Browse files
committed
run hook on generic
1 parent 78ef768 commit 7f503d2

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

pandas/core/generic.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class NDFrame(PandasObject, SelectionMixin, indexing.IndexingMixin):
240240
def __init__(
241241
self,
242242
data: Manager,
243-
copy: bool = False,
243+
copy: bool_t = False,
244244
attrs: Optional[Mapping[Hashable, Any]] = None,
245245
):
246246
# copy kwarg is retained for mypy compat, is not used
@@ -257,7 +257,7 @@ def __init__(
257257

258258
@classmethod
259259
def _init_mgr(
260-
cls, mgr, axes, dtype: Optional[Dtype] = None, copy: bool = False
260+
cls, mgr, axes, dtype: Optional[Dtype] = None, copy: bool_t = False
261261
) -> Manager:
262262
""" passed a manager and a axes dict """
263263
for a, axe in axes.items():
@@ -385,8 +385,8 @@ def flags(self) -> Flags:
385385
def set_flags(
386386
self: FrameOrSeries,
387387
*,
388-
copy: bool = False,
389-
allows_duplicate_labels: Optional[bool] = None,
388+
copy: bool_t = False,
389+
allows_duplicate_labels: Optional[bool_t] = None,
390390
) -> FrameOrSeries:
391391
"""
392392
Return a new object with updated flags.
@@ -475,7 +475,7 @@ def _data(self):
475475
_stat_axis_name = "index"
476476
_AXIS_ORDERS: List[str]
477477
_AXIS_TO_AXIS_NUMBER: Dict[Axis, int] = {0: 0, "index": 0, "rows": 0}
478-
_AXIS_REVERSED: bool
478+
_AXIS_REVERSED: bool_t
479479
_info_axis_number: int
480480
_info_axis_name: str
481481
_AXIS_LEN: int
@@ -502,7 +502,7 @@ def _construct_axes_dict(self, axes=None, **kwargs):
502502
@final
503503
@classmethod
504504
def _construct_axes_from_arguments(
505-
cls, args, kwargs, require_all: bool = False, sentinel=None
505+
cls, args, kwargs, require_all: bool_t = False, sentinel=None
506506
):
507507
"""
508508
Construct and returns axes if supplied in args/kwargs.
@@ -722,11 +722,11 @@ def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None:
722722

723723
@overload
724724
def set_axis(
725-
self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool = ...
725+
self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ...
726726
) -> Optional[FrameOrSeries]:
727727
...
728728

729-
def set_axis(self, labels, axis: Axis = 0, inplace: bool = False):
729+
def set_axis(self, labels, axis: Axis = 0, inplace: bool_t = False):
730730
"""
731731
Assign desired index to given axis.
732732
@@ -757,7 +757,7 @@ def set_axis(self, labels, axis: Axis = 0, inplace: bool = False):
757757
return self._set_axis_nocheck(labels, axis, inplace)
758758

759759
@final
760-
def _set_axis_nocheck(self, labels, axis: Axis, inplace: bool):
760+
def _set_axis_nocheck(self, labels, axis: Axis, inplace: bool_t):
761761
# NDFrame.rename with inplace=False calls set_axis(inplace=True) on a copy.
762762
if inplace:
763763
setattr(self, self._get_axis_name(axis), labels)
@@ -1003,8 +1003,8 @@ def rename(
10031003
index: Optional[Renamer] = None,
10041004
columns: Optional[Renamer] = None,
10051005
axis: Optional[Axis] = None,
1006-
copy: bool = True,
1007-
inplace: bool = False,
1006+
copy: bool_t = True,
1007+
inplace: bool_t = False,
10081008
level: Optional[Level] = None,
10091009
errors: str = "ignore",
10101010
) -> Optional[FrameOrSeries]:
@@ -1410,13 +1410,13 @@ def _set_axis_name(self, name, axis=0, inplace=False):
14101410
# Comparison Methods
14111411

14121412
@final
1413-
def _indexed_same(self, other) -> bool:
1413+
def _indexed_same(self, other) -> bool_t:
14141414
return all(
14151415
self._get_axis(a).equals(other._get_axis(a)) for a in self._AXIS_ORDERS
14161416
)
14171417

14181418
@final
1419-
def equals(self, other: object) -> bool:
1419+
def equals(self, other: object) -> bool_t:
14201420
"""
14211421
Test whether two objects contain the same elements.
14221422
@@ -5078,15 +5078,15 @@ def filter(
50785078
return self.reindex(**{name: [r for r in items if r in labels]})
50795079
elif like:
50805080

5081-
def f(x) -> bool:
5081+
def f(x) -> bool_t:
50825082
assert like is not None # needed for mypy
50835083
return like in ensure_str(x)
50845084

50855085
values = labels.map(f)
50865086
return self.loc(axis=axis)[values]
50875087
elif regex:
50885088

5089-
def f(x) -> bool:
5089+
def f(x) -> bool_t:
50905090
return matcher.search(ensure_str(x)) is not None
50915091

50925092
matcher = re.compile(regex)

0 commit comments

Comments
 (0)