Skip to content
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

function argument in shutil.register_unpack_format must be Callable #7083

Merged
merged 5 commits into from
Jan 30, 2022
Merged

function argument in shutil.register_unpack_format must be Callable #7083

merged 5 commits into from
Jan 30, 2022

Conversation

sobolevn
Copy link
Member

@github-actions

This comment has been minimized.

stdlib/shutil.pyi Outdated Show resolved Hide resolved
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
@github-actions

This comment has been minimized.

name: str, extensions: list[str], function: Any, extra_args: Sequence[tuple[str, Any]] | None = ..., description: str = ...
name: str,
extensions: list[str],
function: Callable[..., object],
Copy link
Member

Choose a reason for hiding this comment

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

It should be approximately Callable[[str, str], object], where the first arg is the filename and the second is the target directory. But it also passes whatever is in extra_args as **kwargs to the unpack function. I don't think we can express that accurately, so let's stick with ....

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about using an @overload for case when extra_args are None, but this might be an over-kill.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that works if you're interested in making this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I have to now 🙂

Copy link
Member

Choose a reason for hiding this comment

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

You don't have to, I'm happy to merge this change as is if you prefer.

But better types are, well, better :)

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 9854926 into python:master Jan 30, 2022
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.

3 participants