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
{{ message }}
Repository navigation
Unable to use @overload with Concatenate decorator #12716
I have experimented with adding/removing conn from the overloads and adding/moving the @acquire at various locations.
Expected Behavior
The final call to work correctly with no errors in mypy.
Actual Behavior
Depending on exactly how I write it, I end up with either complaints about the definition (e.g. Overloaded function implementation does not accept all possible arguments of signature 1) or complaints about the final call (e.g. No overload variant of "get" matches argument type "bytes").
I meant something using callback protocols (that allow specifying argument names unlike simple Callable[] and are generally more expressive, but somewhat verbose), like this:
Activity
Dreamsorcerer commentedon Nov 8, 2022
Code to reproduce is at: https://github.com/aio-libs/aiomcache/blob/master/aiomcache/client.py#L159
ilevkivskyi commentedon Aug 18, 2023
Note after #15898 is merged, you should be able to either:
@acquireas defined now (overloads should have undecorated signature obviously)@acquireto preserve the name of first argument to be "self".Basic support for decorated overloads (#15898)
Dreamsorcerer commentedon Oct 17, 2023
First option works. But, I don't understand how to do the second option.
Looks like your tests do the former, so I guess I'll stick with that.
ilevkivskyi commentedon Oct 17, 2023
I meant something using callback protocols (that allow specifying argument names unlike simple
Callable[]and are generally more expressive, but somewhat verbose), like this:But I just tried and it looks like it doesn't really work because of some unrelated bug with return type checks for generic overloads.
Dreamsorcerer commentedon Nov 13, 2023
Not sure if there's something I'm doing wrong, but seem to have encountered a regression that's breaking this again in 1.7: #16481