sourcery icon indicating copy to clipboard operation
sourcery copied to clipboard

identity-comprehension; remove-unnecessary-cast when using pathlib

Open OZOOOOOH opened this issue 2 years ago • 1 comments

Checklist

  • [X] I have searched the Sourcery documentation for the issue, and found nothing
  • [X] I have checked there are no open bugs referencing the same bug or problem

Description

image I got mypy error if i accept sourcery suggestion. because the return type is changed to list[Path] image

In this case, I think sourcery suggestion should be like this image

Code snippet that reproduces issue

def get_files_by_suffix_in_dir(path: str, suffix: str) -> list[str]:
    return [str(path) for path in Path(path).glob(f"*{suffix}")]

Debug Information

IDE Version:

VSCODE 1.78.2

Sourcery Version:

sourcery 1.3.0

Operating system and Version:

Windows 10

OZOOOOOH avatar May 19 '23 01:05 OZOOOOOH

Thanks for raising this - have reproduced it

Hellebore avatar May 19 '23 09:05 Hellebore