shabbyrobe / grpc-stubs

gRPC typing stubs for Python
MIT License
36 stars 21 forks source link

Call and ServicerContext should each extend RpcContext #14

Closed MHDante closed 3 years ago

MHDante commented 3 years ago

Likely a miss due to stub generator mixed with six

MHDante commented 3 years ago

This one is a bit hairy, since Call.cancel is not documented to return anything. however, Future suggests a boolean

I've left Call.cancel untyped to allow coersion, (I tried finding the actual return type, but quit when it hit the cython impl)

shabbyrobe commented 3 years ago

Looks good, thanks for the PR!

Do you anticipate this will break anybody's code if we remove the current type from cancel(), or will this be less broken than what is there currently?

MHDante commented 3 years ago

Anyone using a strict mode linter that has a call to

my_var = my_rpc_context.cancel()

...will have their linter error that my_var has type Any instead of None.

the question would then become why they stored the None? furthermore, my_var may have contained a bool, which could have been true.

In short: should be fine.

MHDante commented 3 years ago

@shabbyrobe LGTM?

shabbyrobe commented 3 years ago

Yep, LGTM! Merged, thanks for the bump and the PR.