sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.5k stars 65 forks source link

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

Open OZOOOOOH opened 1 year ago

OZOOOOOH commented 1 year ago

Checklist

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
Hellebore commented 1 year ago

Thanks for raising this - have reproduced it