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
Using with statement with DaprClient should return type of DaprClient on enter. To make this happen the __enter__ method of DaprGrpcClient should return type Self and not DaprGrpcClient so that sub-classes return the correct type. E.g DaprClient would return type of DaprClient
Using with statement with DaprClient returns type of DaprGrpcClient, not DaprClient. This means that methods like e.g invoke_method_async is not available for static type checkers such as Pyright.
Note that this is a static type checker problem, not a runtime problem. Code runs just fine, but editor shows a problem.
Steps to Reproduce the Problem
Writing code such as with DaprClient() as d: in editors such as vscode using standard Python extension with Pylance (pyright) will show error.
Release Note
RELEASE NOTE:
The text was updated successfully, but these errors were encountered:
Expected Behavior
Using
with
statement withDaprClient
should return type ofDaprClient
on enter. To make this happen the__enter__
method ofDaprGrpcClient
should return typeSelf
and notDaprGrpcClient
so that sub-classes return the correct type. E.gDaprClient
would return type ofDaprClient
python-sdk/dapr/clients/grpc/client.py
Line 150 in edff0ff
The
Self
type can be used from Python 3.11. For versions less than 3.11 it can be imported fromtyping_extensions
e.g:Actual Behavior
Using
with
statement withDaprClient
returns type ofDaprGrpcClient
, notDaprClient
. This means that methods like e.ginvoke_method_async
is not available for static type checkers such as Pyright.Note that this is a static type checker problem, not a runtime problem. Code runs just fine, but editor shows a problem.
Steps to Reproduce the Problem
Writing code such as
with DaprClient() as d:
in editors such as vscode using standard Python extension with Pylance (pyright) will show error.Release Note
RELEASE NOTE:
The text was updated successfully, but these errors were encountered: