Skip to content

Commit c20e3b8

Browse files
committed
Add ignores
1 parent b2893df commit c20e3b8

File tree

11 files changed

+37
-24
lines changed

11 files changed

+37
-24
lines changed

pandas/_config/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ def _warn_if_deprecated(key: str) -> bool:
716716
if d.msg:
717717
warnings.warn(
718718
d.msg,
719-
FutureWarning,
719+
FutureWarning, # pdlint: ignore[warning_class]
720720
stacklevel=find_stack_level(),
721721
)
722722
else:
@@ -728,7 +728,11 @@ def _warn_if_deprecated(key: str) -> bool:
728728
else:
729729
msg += ", please refrain from using it."
730730

731-
warnings.warn(msg, FutureWarning, stacklevel=find_stack_level())
731+
warnings.warn(
732+
msg,
733+
FutureWarning, # pdlint: ignore[warning_class]
734+
stacklevel=find_stack_level(),
735+
)
732736
return True
733737
return False
734738

pandas/core/arrays/string_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __init__(
176176
"'pd.options.future.infer_string = True' option globally and use "
177177
'the "str" alias as a shorthand notation to specify a dtype '
178178
'(instead of "string[pyarrow_numpy]").',
179-
FutureWarning,
179+
FutureWarning, # pdlint: ignore[warning_class]
180180
stacklevel=find_stack_level(),
181181
)
182182
storage = "pyarrow"

pandas/core/arrays/string_arrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def _convert_bool_result(self, values, na=lib.no_default, method_name=None):
245245
warnings.warn(
246246
f"Allowing a non-bool 'na' in obj.str.{method_name} is deprecated "
247247
"and will raise in a future version.",
248-
FutureWarning,
248+
FutureWarning, # pdlint: ignore[warning_class]
249249
stacklevel=find_stack_level(),
250250
)
251251
na = bool(na)

pandas/core/dtypes/dtypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ def __new__(cls, freq) -> PeriodDtype: # noqa: PYI034
10531053
warnings.warn(
10541054
"PeriodDtype[B] is deprecated and will be removed in a future "
10551055
"version. Use a DatetimeIndex with freq='B' instead",
1056-
FutureWarning,
1056+
FutureWarning, # pdlint: ignore[warning_class]
10571057
stacklevel=find_stack_level(),
10581058
)
10591059

pandas/core/frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13262,7 +13262,7 @@ def idxmin(
1326213262
f"The behavior of {type(self).__name__}.idxmin with all-NA "
1326313263
"values, or any-NA and skipna=False, is deprecated. In a future "
1326413264
"version this will raise ValueError",
13265-
FutureWarning,
13265+
FutureWarning, # pdlint: ignore[warning_class]
1326613266
stacklevel=find_stack_level(),
1326713267
)
1326813268

@@ -13369,7 +13369,7 @@ def idxmax(
1336913369
f"The behavior of {type(self).__name__}.idxmax with all-NA "
1337013370
"values, or any-NA and skipna=False, is deprecated. In a future "
1337113371
"version this will raise ValueError",
13372-
FutureWarning,
13372+
FutureWarning, # pdlint: ignore[warning_class]
1337313373
stacklevel=find_stack_level(),
1337413374
)
1337513375

pandas/core/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9139,7 +9139,7 @@ def resample(
91399139
"deprecated and will be removed in a future version. "
91409140
"Explicitly cast PeriodIndex to DatetimeIndex before resampling "
91419141
"instead.",
9142-
FutureWarning, # pdlint: ignore
9142+
FutureWarning, # pdlint: ignore[warning_class]
91439143
stacklevel=find_stack_level(),
91449144
)
91459145
else:

pandas/core/groupby/groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def groups(self) -> dict[Hashable, Index]:
557557
"and will be removed. In a future version `groups` by one element "
558558
"list will return tuple. Use ``df.groupby(by='a').groups`` "
559559
"instead of ``df.groupby(by=['a']).groups`` to avoid this warning",
560-
FutureWarning, # pdlint: ignore
560+
FutureWarning, # pdlint: ignore[warning_class]
561561
stacklevel=find_stack_level(),
562562
)
563563
return self._grouper.groups

pandas/core/resample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,7 @@ def _resampler_for_grouping(self):
19491949
warnings.warn(
19501950
"Resampling a groupby with a PeriodIndex is deprecated. "
19511951
"Cast to DatetimeIndex before resampling instead.",
1952-
FutureWarning,
1952+
FutureWarning, # pdlint: ignore[warning_class]
19531953
stacklevel=find_stack_level(),
19541954
)
19551955
return PeriodIndexResamplerGroupby
@@ -2297,7 +2297,7 @@ def _get_resampler(self, obj: NDFrame) -> Resampler:
22972297
warnings.warn(
22982298
"Resampling with a PeriodIndex is deprecated. "
22992299
"Cast index to DatetimeIndex before resampling instead.",
2300-
FutureWarning,
2300+
FutureWarning, # pdlint: ignore[warning_class]
23012301
stacklevel=find_stack_level(),
23022302
)
23032303
return PeriodIndexResampler(

pandas/core/strings/object_array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _str_contains(
163163
warnings.warn(
164164
"Allowing a non-bool 'na' in obj.str.contains is deprecated "
165165
"and will raise in a future version.",
166-
FutureWarning, # pdlint: ignore
166+
FutureWarning, # pdlint: ignore[warning_class]
167167
stacklevel=find_stack_level(),
168168
)
169169
return self._str_map(f, na, dtype=np.dtype("bool"))
@@ -175,7 +175,7 @@ def _str_startswith(self, pat, na=lib.no_default):
175175
warnings.warn(
176176
"Allowing a non-bool 'na' in obj.str.startswith is deprecated "
177177
"and will raise in a future version.",
178-
FutureWarning, # pdlint: ignore
178+
FutureWarning, # pdlint: ignore[warning_class]
179179
stacklevel=find_stack_level(),
180180
)
181181
return self._str_map(f, na_value=na, dtype=np.dtype(bool))
@@ -187,7 +187,7 @@ def _str_endswith(self, pat, na=lib.no_default):
187187
warnings.warn(
188188
"Allowing a non-bool 'na' in obj.str.endswith is deprecated "
189189
"and will raise in a future version.",
190-
FutureWarning, # pdlint: ignore
190+
FutureWarning, # pdlint: ignore[warning_class]
191191
stacklevel=find_stack_level(),
192192
)
193193
return self._str_map(f, na_value=na, dtype=np.dtype(bool))

pandas/tests/util/test_assert_produces_warning.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def pair_different_warnings(request):
3838

3939

4040
def f():
41-
warnings.warn("f1", FutureWarning)
41+
warnings.warn("f1", FutureWarning) # pdlint: ignore[warning_class]
4242
warnings.warn("f2", RuntimeWarning)
4343

4444

@@ -175,7 +175,7 @@ def test_match_multiple_warnings():
175175
# https://github.com/pandas-dev/pandas/issues/47829
176176
category = (FutureWarning, UserWarning)
177177
with tm.assert_produces_warning(category, match=r"^Match this"):
178-
warnings.warn("Match this", FutureWarning)
178+
warnings.warn("Match this", FutureWarning) # pdlint: ignore[warning_class]
179179
warnings.warn("Match this too", UserWarning)
180180

181181

@@ -185,7 +185,7 @@ def test_must_match_multiple_warnings():
185185
msg = "Did not see expected warning of class 'UserWarning'"
186186
with pytest.raises(AssertionError, match=msg):
187187
with tm.assert_produces_warning(category, match=r"^Match this"):
188-
warnings.warn("Match this", FutureWarning)
188+
warnings.warn("Match this", FutureWarning) # pdlint: ignore[warning_class]
189189

190190

191191
def test_must_match_multiple_warnings_messages():
@@ -194,7 +194,7 @@ def test_must_match_multiple_warnings_messages():
194194
msg = r"The emitted warning messages are \[UserWarning\('Not this'\)\]"
195195
with pytest.raises(AssertionError, match=msg):
196196
with tm.assert_produces_warning(category, match=r"^Match this"):
197-
warnings.warn("Match this", FutureWarning)
197+
warnings.warn("Match this", FutureWarning) # pdlint: ignore[warning_class]
198198
warnings.warn("Not this", UserWarning)
199199

200200

@@ -204,7 +204,7 @@ def test_allow_partial_match_for_multiple_warnings():
204204
with tm.assert_produces_warning(
205205
category, match=r"^Match this", must_find_all_warnings=False
206206
):
207-
warnings.warn("Match this", FutureWarning)
207+
warnings.warn("Match this", FutureWarning) # pdlint: ignore[warning_class]
208208

209209

210210
def test_allow_partial_match_for_multiple_warnings_messages():
@@ -213,7 +213,7 @@ def test_allow_partial_match_for_multiple_warnings_messages():
213213
with tm.assert_produces_warning(
214214
category, match=r"^Match this", must_find_all_warnings=False
215215
):
216-
warnings.warn("Match this", FutureWarning)
216+
warnings.warn("Match this", FutureWarning) # pdlint: ignore[warning_class]
217217
warnings.warn("Not this", UserWarning)
218218

219219

@@ -250,13 +250,17 @@ def test_raises_during_exception():
250250

251251
with pytest.raises(AssertionError, match=msg):
252252
with tm.assert_produces_warning(UserWarning):
253-
warnings.warn("FutureWarning", FutureWarning)
253+
warnings.warn(
254+
"FutureWarning", FutureWarning
255+
) # pdlint: ignore[warning_class]
254256
raise IndexError
255257

256258
msg = "Caused unexpected warning"
257259
with pytest.raises(AssertionError, match=msg):
258260
with tm.assert_produces_warning(None):
259-
warnings.warn("FutureWarning", FutureWarning)
261+
warnings.warn(
262+
"FutureWarning", FutureWarning
263+
) # pdlint: ignore[warning_class]
260264
raise SystemError
261265

262266

@@ -267,5 +271,7 @@ def test_passes_during_exception():
267271

268272
with pytest.raises(ValueError, match="Error"):
269273
with tm.assert_produces_warning(FutureWarning, match="FutureWarning"):
270-
warnings.warn("FutureWarning", FutureWarning)
274+
warnings.warn(
275+
"FutureWarning", FutureWarning
276+
) # pdlint: ignore[warning_class]
271277
raise ValueError("Error")

0 commit comments

Comments
 (0)