Skip to content

Commit 1d70c15

Browse files
ramvikramsMarcoGorelli
authored and
MarcoGorelli
committed
for issue pandas-dev#49656 STYLE enable pylint's redefined-outer-name (pandas-dev#49708)
* t1 * update * update * Update generic.py * update * Update generic.py * Update generic.py * Update generic.py * Update generic.py * Update generic.py * Update generic.py * Update generic.py
1 parent 6729c55 commit 1d70c15

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

pandas/core/generic.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import annotations
33

44
import collections
5-
from datetime import timedelta
5+
import datetime as dt
66
import gc
77
import json
88
import operator
@@ -133,12 +133,12 @@
133133
from pandas.core import (
134134
algorithms as algos,
135135
arraylike,
136-
common as com,
137136
indexing,
138137
missing,
139138
nanops,
140139
sample,
141140
)
141+
from pandas.core import common # noqa: PDF018
142142
from pandas.core.array_algos.replace import should_use_regex
143143
from pandas.core.arrays import ExtensionArray
144144
from pandas.core.base import PandasObject
@@ -1009,7 +1009,7 @@ def _rename(
10091009
continue
10101010

10111011
ax = self._get_axis(axis_no)
1012-
f = com.get_rename_function(replacements)
1012+
f = common.get_rename_function(replacements)
10131013

10141014
if level is not None:
10151015
level = ax._get_level_number(level)
@@ -1240,7 +1240,7 @@ class name
12401240
if non_mapper:
12411241
newnames = v
12421242
else:
1243-
f = com.get_rename_function(v)
1243+
f = common.get_rename_function(v)
12441244
curnames = self._get_axis(axis).names
12451245
newnames = [f(name) for name in curnames]
12461246
result._set_axis_name(newnames, axis=axis, inplace=True)
@@ -1826,7 +1826,7 @@ def _drop_labels_or_levels(self, keys, axis: AxisInt = 0):
18261826
axis = self._get_axis_number(axis)
18271827

18281828
# Validate keys
1829-
keys = com.maybe_make_list(keys)
1829+
keys = common.maybe_make_list(keys)
18301830
invalid_keys = [
18311831
k for k in keys if not self._is_label_or_level_reference(k, axis=axis)
18321832
]
@@ -4445,7 +4445,7 @@ def _drop_axis(
44454445
# Case for non-unique axis
44464446
else:
44474447
is_tuple_labels = is_nested_list_like(labels) or isinstance(labels, tuple)
4448-
labels = ensure_object(com.index_labels_to_array(labels))
4448+
labels = ensure_object(common.index_labels_to_array(labels))
44494449
if level is not None:
44504450
if not isinstance(axis, MultiIndex):
44514451
raise AssertionError("axis must be a MultiIndex")
@@ -5236,7 +5236,7 @@ def _reindex_axes(
52365236
def _needs_reindex_multi(self, axes, method, level) -> bool_t:
52375237
"""Check if we do need a multi reindex."""
52385238
return (
5239-
(com.count_not_none(*axes.values()) == self._AXIS_LEN)
5239+
(common.count_not_none(*axes.values()) == self._AXIS_LEN)
52405240
and method is None
52415241
and level is None
52425242
and not self._is_mixed_type
@@ -5359,7 +5359,7 @@ def filter(
53595359
one two three
53605360
rabbit 4 5 6
53615361
"""
5362-
nkw = com.count_not_none(items, like, regex)
5362+
nkw = common.count_not_none(items, like, regex)
53635363
if nkw > 1:
53645364
raise TypeError(
53655365
"Keyword arguments `items`, `like`, or `regex` "
@@ -5684,7 +5684,7 @@ def sample(
56845684
obj_len = self.shape[axis]
56855685

56865686
# Process random_state argument
5687-
rs = com.random_state(random_state)
5687+
rs = common.random_state(random_state)
56885688

56895689
size = sample.process_sampling_size(n, frac, replace)
56905690
if size is None:
@@ -5760,7 +5760,7 @@ def pipe(
57605760
... .pipe((func, 'arg2'), arg1=a, arg3=c)
57615761
... ) # doctest: +SKIP
57625762
"""
5763-
return com.pipe(self, func, *args, **kwargs)
5763+
return common.pipe(self, func, *args, **kwargs)
57645764

57655765
# ----------------------------------------------------------------------
57665766
# Attribute access
@@ -9445,7 +9445,7 @@ def _where(
94459445
axis = self._get_axis_number(axis)
94469446

94479447
# align the cond to same shape as myself
9448-
cond = com.apply_if_callable(cond, self)
9448+
cond = common.apply_if_callable(cond, self)
94499449
if isinstance(cond, NDFrame):
94509450
cond, _ = cond.align(self, join="right", broadcast_axis=1, copy=False)
94519451
else:
@@ -9467,9 +9467,9 @@ def _where(
94679467
if not is_bool_dtype(cond):
94689468
raise ValueError(msg.format(dtype=cond.dtype))
94699469
else:
9470-
for dt in cond.dtypes:
9471-
if not is_bool_dtype(dt):
9472-
raise ValueError(msg.format(dtype=dt))
9470+
for _dt in cond.dtypes:
9471+
if not is_bool_dtype(_dt):
9472+
raise ValueError(msg.format(dtype=_dt))
94739473
else:
94749474
# GH#21947 we have an empty DataFrame/Series, could be object-dtype
94759475
cond = cond.astype(bool)
@@ -9747,7 +9747,7 @@ def where(
97479747
3 True True
97489748
4 True True
97499749
"""
9750-
other = com.apply_if_callable(other, self)
9750+
other = common.apply_if_callable(other, self)
97519751
return self._where(cond, other, inplace, axis, level)
97529752

97539753
@overload
@@ -9805,7 +9805,7 @@ def mask(
98059805
) -> NDFrameT | None:
98069806

98079807
inplace = validate_bool_kwarg(inplace, "inplace")
9808-
cond = com.apply_if_callable(cond, self)
9808+
cond = common.apply_if_callable(cond, self)
98099809

98109810
# see gh-21891
98119811
if not hasattr(cond, "__invert__"):
@@ -10317,7 +10317,7 @@ def tz_localize(
1031710317
"""
1031810318
nonexistent_options = ("raise", "NaT", "shift_forward", "shift_backward")
1031910319
if nonexistent not in nonexistent_options and not isinstance(
10320-
nonexistent, timedelta
10320+
nonexistent, dt.timedelta
1032110321
):
1032210322
raise ValueError(
1032310323
"The nonexistent argument must be one of 'raise', "
@@ -11470,7 +11470,7 @@ def min(
1147011470
@doc(Rolling)
1147111471
def rolling(
1147211472
self,
11473-
window: int | timedelta | str | BaseOffset | BaseIndexer,
11473+
window: int | dt.timedelta | str | BaseOffset | BaseIndexer,
1147411474
min_periods: int | None = None,
1147511475
center: bool_t = False,
1147611476
win_type: str | None = None,

0 commit comments

Comments
 (0)