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
Hi, thanks for the great library, we are really enjoying using it!
My question is regarding _Metadata being a protected member of the module. Is there any reason for this?
Because sometimes we want to manipulate metadata inside our business logic and we send it as an argument to a function.
Then, trying to annotate our function with types we would get a warning from IDE that it is protected.
I would be glad to provide PR if you think this is okay?
I didn't wanted to expose implementation details. Metadata should be an abstract multidict-like data structure from a user's perspective, not a specific type – multidict.Multidict.
There are two possible solutions:
if you don't expect keys with multiple values you can use the typing.Mapping type, because Multidict implements the Mapping protocol and mypy should be ok with that
if you expect multiple values you can implement a class Multidict(typing.Protocol): protocol and use it, mypy should be also ok with that
I don't want to add this protocol into grpclib because protocols were introduced only in Python 3.8 or you should depend on typing_extensions, and I think that there should be other place for such generic protocols.
Hi, thanks for the great library, we are really enjoying using it!
My question is regarding
_Metadata
being a protected member of the module. Is there any reason for this?Because sometimes we want to manipulate metadata inside our business logic and we send it as an argument to a function.
Then, trying to annotate our function with types we would get a warning from IDE that it is protected.
I would be glad to provide PR if you think this is okay?
Here's the small example:
The text was updated successfully, but these errors were encountered: