Skip to content

Commit 1ec48f4

Browse files
committed
STYLE: fix pylint redefined-outer-name warnings (#49656)
Fixed warnings for the following files :- - pandas/core/arrays/datetimelike.py - pandas/core/base.py - pandas/core/computation/pytables.py
1 parent 289f32d commit 1ec48f4

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

pandas/core/arrays/datetimelike.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@
112112
)
113113

114114
from pandas.core import (
115+
algorithms,
115116
nanops,
116117
ops,
117118
)
118119
from pandas.core.algorithms import (
119120
checked_add_with_arr,
120121
isin,
121-
mode,
122122
unique1d,
123123
)
124124
from pandas.core.arraylike import OpsMixin
@@ -1690,7 +1690,7 @@ def _mode(self, dropna: bool = True):
16901690
if dropna:
16911691
mask = self.isna()
16921692

1693-
i8modes = mode(self.view("i8"), mask=mask)
1693+
i8modes = algorithms.algos.mode(self.view("i8"), mask=mask)
16941694
npmodes = i8modes.view(self._ndarray.dtype)
16951695
npmodes = cast(np.ndarray, npmodes)
16961696
return self._from_backing_data(npmodes)

pandas/core/base.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@
6161
ops,
6262
)
6363
from pandas.core.accessor import DirNamesMixin
64-
from pandas.core.algorithms import (
65-
duplicated,
66-
unique1d,
67-
value_counts,
68-
)
64+
from pandas.core.algorithms import algos
65+
66+
# from pandas.core.algorithms import (
67+
# duplicated as duplicated_func,
68+
# unique1d,
69+
# value_counts,
70+
# )
6971
from pandas.core.arraylike import OpsMixin
7072
from pandas.core.arrays import ExtensionArray
7173
from pandas.core.construction import (
@@ -991,7 +993,7 @@ def value_counts(
991993
NaN 1
992994
dtype: int64
993995
"""
994-
return value_counts(
996+
return algos.value_counts(
995997
self,
996998
sort=sort,
997999
ascending=ascending,
@@ -1006,7 +1008,7 @@ def unique(self):
10061008
# i.e. ExtensionArray
10071009
result = values.unique()
10081010
else:
1009-
result = unique1d(values)
1011+
result = algos.unique1d(values)
10101012
return result
10111013

10121014
@final
@@ -1294,7 +1296,7 @@ def drop_duplicates(self, *, keep: DropKeep = "first"):
12941296

12951297
@final
12961298
def _duplicated(self, keep: DropKeep = "first") -> npt.NDArray[np.bool_]:
1297-
return duplicated(self._values, keep=keep)
1299+
return algos.duplicated(self._values, keep=keep)
12981300

12991301
def _arith_method(self, other, op):
13001302
res_name = ops.get_op_result_name(self, other)

pandas/core/computation/pytables.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ def maybe_expression(s) -> bool:
650650
"""loose checking if s is a pytables-acceptable expression"""
651651
if not isinstance(s, str):
652652
return False
653-
ops = PyTablesExprVisitor.binary_ops + PyTablesExprVisitor.unary_ops + ("=",)
653+
operations = PyTablesExprVisitor.binary_ops + PyTablesExprVisitor.unary_ops + ("=",)
654654

655655
# make sure we have an op at least
656-
return any(op in s for op in ops)
656+
return any(op in s for op in operations)

0 commit comments

Comments
 (0)