-
-
Couldn't load subscription status.
- Fork 1.9k
Closed
Labels
stubs: improvementImprove/refactor existing annotations, other stubs issuesImprove/refactor existing annotations, other stubs issues
Description
Since shutil._PathReturn is defined as Any, it may hide type errors to mypy-like tools. E.g in the following code, mypy will not detect that f function is invoked with an str argument instead of a Path.
import shutil
from pathlib import Path
def f(p: Path) -> None:
pass
def cp(target: str | Path) -> None:
p = shutil.copy("/src", target)
return f(p)Metadata
Metadata
Assignees
Labels
stubs: improvementImprove/refactor existing annotations, other stubs issuesImprove/refactor existing annotations, other stubs issues