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

Skip to content

Add type annotations for Pathlike arguments #3864

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

Merged
merged 4 commits into from
Mar 22, 2020

Conversation

djb4ai
Copy link
Contributor

@djb4ai djb4ai commented Mar 18, 2020

Closes #3858

shallow: Union[int, bool] = ...) -> Tuple[List[AnyStr], List[AnyStr], List[AnyStr]]: ...
if sys.version_info >= (3, 6):
def cmp(f1: Union[bytes, Text, Path], f2: Union[bytes, Text, Path], shallow: Union[int, bool] = ...) -> bool: ...
def cmpfiles(a: Union[AnyStr, Path], b: Union[AnyStr, Path], common: Iterable[AnyStr],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be PathLike[AnyStr] I think, so that the str/bytes match is right even if you use PathLikes.

Though I think that may run into an annoying mypy bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure pathlib.Path accepts bytes. I get this error: TypeError: argument should be a str object or an os.PathLike object returning str, not <class 'bytes'>

I have added the changes and surprisingly it didn't break anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stubs for filecmp are missing Pathlike arguments
2 participants