Open
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)
Activity