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

Skip to content

Warn when abstract or protocol type is assigned to a callable #13212

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sobolevn
Copy link
Member

Now Callable[[], AbstractOrProtocol] has the same semantics as Type[AbstractOrProtocol].
I don't think we need to test for @overload here, because you cannot have inline @overload annotation.

Closes #13171

@github-actions

This comment has been minimized.

@sobolevn
Copy link
Member Author

sobolevn commented Jul 21, 2022

This is interesting 🤔
What it does is:

from ignite.handlers.param_scheduler import (
    ParamScheduler,
)

ParamScheduler = ParamScheduler

Where ParamScheduler is an abstract class.

I think that this should be fine. It does not look like an issue to me.
But, I cannot formulate the rule here.

I am also ok if others are fine with ignoring it.

@github-actions

This comment has been minimized.

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 21, 2022

I think that this should be fine. It does not look like an issue to me. But, I cannot formulate the rule here

Yeah, I think that this should be allowed. Maybe check if the lvalue and rvalue refer to the same node, and skip the concreteness check in this case? The assignment will be a no-op.

@sobolevn
Copy link
Member Author

Done!

@github-actions
Copy link
Contributor

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

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