Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Stubs for filecmp are missing Pathlike arguments #3858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BoboTiG opened this issue Mar 17, 2020 · 1 comment · Fixed by #3864
Closed

Stubs for filecmp are missing Pathlike arguments #3858

BoboTiG opened this issue Mar 17, 2020 · 1 comment · Fixed by #3864
Labels
stubs: false positive Type checkers report false errors

Comments

@BoboTiG
Copy link
Contributor

BoboTiG commented Mar 17, 2020

(Inspired from #2267)

Starting with Python 3.6, filecmp functions can handle path-like objects, including:

filecmp.cmp()
filecmp.cmpfiles()
filecmp.dircmp()

Reproduction:

import filecmp
from pathlib import Path

filecmp.dircmp(Path("/tmp"), "/tmp")
filecmp.cmp(Path("file1"), Path("file2"))

Will output:

error: Value of type variable "AnyStr" of "dircmp" cannot be "Path"
error: Argument 1 to "cmp" has incompatible type "Path"; expected "Union[bytes, str]"
error: Argument 2 to "cmp" has incompatible type "Path"; expected "Union[bytes, str]"

I will not have time to work on it, but I think it is a good thing to have a open issue for anyone wanting to give a hand.

@djb4ai
Copy link
Contributor

djb4ai commented Mar 18, 2020

@srittau Opened a PR. Let me know any changes, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: false positive Type checkers report false errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants