You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Unfortunately, changing this to a union in the general case would mean that users would need to add isinstance checks to the returned value in many cases. That said, looking at the implementation of copy(), I think we could do better for some cases: For example, passing str or bytes as dst will always return the same type. We could reflect that and keep the Any return type only when passing in a PathLike.
The best solution would be to fix the functions in the standard library to return consistent types, but that's out of scope for typeshed.
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 thatf
function is invoked with anstr
argument instead of a Path.The text was updated successfully, but these errors were encountered: