Skip to content

Commit 7640355

Browse files
committed
cleanup
1 parent 74f25eb commit 7640355

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/validate_unwanted_patterns.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,17 @@ def nodefault_used_not_only_for_typing(file_obj: IO[str]) -> Iterable[tuple[int,
350350

351351
def doesnt_use_pandas_warnings(file_obj: IO[str]) -> Iterable[tuple[int, str]]:
352352
"""
353-
Checking that a private function is not used across modules.
353+
Checking that pandas-specific warnings are used for deprecations.
354+
354355
Parameters
355356
----------
356357
file_obj : IO
357358
File-like object containing the Python code to validate.
359+
358360
Yields
359361
------
360362
line_number : int
361-
Line number of the private function that is used across modules.
363+
Line number of the warning.
362364
msg : str
363365
Explanation of the error.
364366
"""
@@ -387,7 +389,12 @@ def doesnt_use_pandas_warnings(file_obj: IO[str]) -> Iterable[tuple[int, str]]:
387389
for value in values:
388390
matches = re.match(DEPRECATION_WARNINGS_PATTERN, value)
389391
if matches is not None:
390-
yield (node.lineno, f"Don't use {matches[0]}")
392+
yield (
393+
node.lineno,
394+
f"Don't use {matches[0]}, use a pandas-specific warning in "
395+
f"pd.errors instead. You can add "
396+
f"`# pdlint: ignore[warning_class]` to override."
397+
)
391398

392399

393400
def main(

0 commit comments

Comments
 (0)