Skip to content

Commit 7f3e4f8

Browse files
authored
CLN: tighten noqas (#44529)
1 parent 8b2477d commit 7f3e4f8

35 files changed

+135
-135
lines changed

doc/source/user_guide/io.rst

+1
Original file line numberDiff line numberDiff line change
@@ -3023,6 +3023,7 @@ Read in the content of the "books.xml" as instance of ``StringIO`` or
30233023
Even read XML from AWS S3 buckets such as Python Software Foundation's IRS 990 Form:
30243024

30253025
.. ipython:: python
3026+
:okwarning:
30263027
30273028
df = pd.read_xml(
30283029
"s3://irs-form-990/201923199349319487_public.xml",

pandas/api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
""" public toolkit API """
2-
from pandas.api import ( # noqa
2+
from pandas.api import ( # noqa:F401
33
extensions,
44
indexers,
55
types,

pandas/core/algorithms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1849,5 +1849,5 @@ def union_with_duplicates(lvals: ArrayLike, rvals: ArrayLike) -> ArrayLike:
18491849
unique_array = ensure_wrapped_if_datetimelike(unique_array)
18501850

18511851
for i, value in enumerate(unique_array):
1852-
indexer += [i] * int(max(l_count[value], r_count[value]))
1852+
indexer += [i] * int(max(l_count.at[value], r_count.at[value]))
18531853
return unique_array.take(indexer)

pandas/core/arrays/floating.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ def coerce_to_array(
176176
if mask.any():
177177
values = values.copy()
178178
values[mask] = np.nan
179-
values = values.astype(dtype, copy=False) # , casting="safe")
180-
else:
181-
values = values.astype(dtype, copy=False) # , casting="safe")
179+
values = values.astype(dtype, copy=False) # , casting="safe")
182180

183181
return values, mask
184182

pandas/core/arrays/integer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ def coerce_to_array(
214214
else:
215215
assert len(mask) == len(values)
216216

217-
if not values.ndim == 1:
217+
if values.ndim != 1:
218218
raise TypeError("values must be a 1D list-like")
219-
if not mask.ndim == 1:
219+
if mask.ndim != 1:
220220
raise TypeError("mask must be a 1D list-like")
221221

222222
# infer dtype if needed

pandas/core/dtypes/missing.py

-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ def _isna(obj, inf_as_na: bool = False):
162162
return libmissing.checknull_old(obj)
163163
else:
164164
return libmissing.checknull(obj)
165-
# hack (for now) because MI registers as ndarray
166165
elif isinstance(obj, ABCMultiIndex):
167166
raise NotImplementedError("isna is not defined for MultiIndex")
168167
elif isinstance(obj, type):

pandas/core/internals/blocks.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def _slice(self, slicer) -> ArrayLike:
309309
return self.values[slicer]
310310

311311
@final
312-
def getitem_block(self, slicer) -> Block:
312+
def getitem_block(self, slicer: slice | npt.NDArray[np.intp]) -> Block:
313313
"""
314314
Perform __getitem__-like, return result as block.
315315
@@ -326,7 +326,9 @@ def getitem_block(self, slicer) -> Block:
326326
return type(self)(new_values, new_mgr_locs, self.ndim)
327327

328328
@final
329-
def getitem_block_columns(self, slicer, new_mgr_locs: BlockPlacement) -> Block:
329+
def getitem_block_columns(
330+
self, slicer: slice, new_mgr_locs: BlockPlacement
331+
) -> Block:
330332
"""
331333
Perform __getitem__-like, return result as block.
332334

pandas/core/reshape/tile.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ def _bins_to_cuts(
443443
)
444444
elif ordered and len(set(labels)) != len(labels):
445445
raise ValueError(
446-
"labels must be unique if ordered=True; pass ordered=False for duplicate labels" # noqa
446+
"labels must be unique if ordered=True; pass ordered=False "
447+
"for duplicate labels"
447448
)
448449
else:
449450
if len(labels) != len(bins) - 1:

pandas/io/sas/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from pandas.io.sas.sasreader import read_sas # noqa
1+
from pandas.io.sas.sasreader import read_sas # noqa:F401

pandas/tests/arrays/boolean/test_function.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def test_ufuncs_unary(ufunc):
5959
expected[a._mask] = np.nan
6060
tm.assert_extension_array_equal(result, expected)
6161

62-
s = pd.Series(a)
63-
result = ufunc(s)
62+
ser = pd.Series(a)
63+
result = ufunc(ser)
6464
expected = pd.Series(ufunc(a._data), dtype="boolean")
6565
expected[a._mask] = np.nan
6666
tm.assert_series_equal(result, expected)
@@ -86,8 +86,8 @@ def test_value_counts_na():
8686

8787

8888
def test_value_counts_with_normalize():
89-
s = pd.Series([True, False, pd.NA], dtype="boolean")
90-
result = s.value_counts(normalize=True)
89+
ser = pd.Series([True, False, pd.NA], dtype="boolean")
90+
result = ser.value_counts(normalize=True)
9191
expected = pd.Series([1, 1], index=[True, False], dtype="Float64") / 2
9292
tm.assert_series_equal(result, expected)
9393

@@ -102,7 +102,7 @@ def test_diff():
102102
)
103103
tm.assert_extension_array_equal(result, expected)
104104

105-
s = pd.Series(a)
106-
result = s.diff()
105+
ser = pd.Series(a)
106+
result = ser.diff()
107107
expected = pd.Series(expected)
108108
tm.assert_series_equal(result, expected)

pandas/tests/arrays/categorical/test_constructors.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ def test_constructor(self):
248248

249249
# this is a legitimate constructor
250250
with tm.assert_produces_warning(None):
251-
c = Categorical( # noqa
252-
np.array([], dtype="int64"), categories=[3, 2, 1], ordered=True
253-
)
251+
Categorical(np.array([], dtype="int64"), categories=[3, 2, 1], ordered=True)
254252

255253
def test_constructor_with_existing_categories(self):
256254
# GH25318: constructing with pd.Series used to bogusly skip recoding

0 commit comments

Comments
 (0)