summaryrefslogtreecommitdiffstats
path: root/contrib/python/grpcio/py3/grpc/_typing.py
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-08-29 14:19:24 +0300
committerrobot-piglet <[email protected]>2025-08-29 14:40:38 +0300
commit5715939b5b1a1812ed85171fb519f9c1c3c326e8 (patch)
tree5d981253427e490749bbb50d3616507fa0d6d1bc /contrib/python/grpcio/py3/grpc/_typing.py
parentc390a008ee5d15e1d8f49326671908f375e0851b (diff)
Intermediate changes
commit_hash:88dd3a7e237f5ebeb9b302a0e6866042635fda83
Diffstat (limited to 'contrib/python/grpcio/py3/grpc/_typing.py')
-rw-r--r--contrib/python/grpcio/py3/grpc/_typing.py87
1 files changed, 62 insertions, 25 deletions
diff --git a/contrib/python/grpcio/py3/grpc/_typing.py b/contrib/python/grpcio/py3/grpc/_typing.py
index d2a0b472153..93ecb5c3cf2 100644
--- a/contrib/python/grpcio/py3/grpc/_typing.py
+++ b/contrib/python/grpcio/py3/grpc/_typing.py
@@ -13,8 +13,18 @@
# limitations under the License.
"""Common types for gRPC Sync API"""
-from typing import (TYPE_CHECKING, Any, Callable, Iterable, Iterator, Optional,
- Sequence, Tuple, TypeVar, Union)
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ Callable,
+ Iterable,
+ Iterator,
+ Optional,
+ Sequence,
+ Tuple,
+ TypeVar,
+ Union,
+)
from grpc._cython import cygrpc
@@ -22,8 +32,8 @@ if TYPE_CHECKING:
from grpc import ServicerContext
from grpc._server import _RPCState
-RequestType = TypeVar('RequestType')
-ResponseType = TypeVar('ResponseType')
+RequestType = TypeVar("RequestType")
+ResponseType = TypeVar("ResponseType")
SerializingFunction = Callable[[Any], bytes]
DeserializingFunction = Callable[[bytes], Any]
MetadataType = Sequence[Tuple[str, Union[str, bytes]]]
@@ -33,26 +43,53 @@ NullaryCallbackType = Callable[[], None]
RequestIterableType = Iterable[Any]
ResponseIterableType = Iterable[Any]
UserTag = Callable[[cygrpc.BaseEvent], bool]
-IntegratedCallFactory = Callable[[
- int, bytes, None, Optional[float], Optional[MetadataType], Optional[
- cygrpc.CallCredentials], Sequence[Sequence[cygrpc.
- Operation]], UserTag, Any
-], cygrpc.IntegratedCall]
-ServerTagCallbackType = Tuple[Optional['_RPCState'],
- Sequence[NullaryCallbackType]]
+IntegratedCallFactory = Callable[
+ [
+ int,
+ bytes,
+ None,
+ Optional[float],
+ Optional[MetadataType],
+ Optional[cygrpc.CallCredentials],
+ Sequence[Sequence[cygrpc.Operation]],
+ UserTag,
+ Any,
+ ],
+ cygrpc.IntegratedCall,
+]
+ServerTagCallbackType = Tuple[
+ Optional["_RPCState"], Sequence[NullaryCallbackType]
+]
ServerCallbackTag = Callable[[cygrpc.BaseEvent], ServerTagCallbackType]
ArityAgnosticMethodHandler = Union[
- Callable[[RequestType, 'ServicerContext', Callable[[ResponseType], None]],
- ResponseType],
- Callable[[RequestType, 'ServicerContext', Callable[[ResponseType], None]],
- Iterator[ResponseType]],
- Callable[[
- Iterator[RequestType], 'ServicerContext', Callable[[ResponseType], None]
- ], ResponseType], Callable[[
- Iterator[RequestType], 'ServicerContext', Callable[[ResponseType], None]
- ], Iterator[ResponseType]], Callable[[RequestType, 'ServicerContext'],
- ResponseType],
- Callable[[RequestType, 'ServicerContext'], Iterator[ResponseType]],
- Callable[[Iterator[RequestType], 'ServicerContext'],
- ResponseType], Callable[[Iterator[RequestType], 'ServicerContext'],
- Iterator[ResponseType]]]
+ Callable[
+ [RequestType, "ServicerContext", Callable[[ResponseType], None]],
+ ResponseType,
+ ],
+ Callable[
+ [RequestType, "ServicerContext", Callable[[ResponseType], None]],
+ Iterator[ResponseType],
+ ],
+ Callable[
+ [
+ Iterator[RequestType],
+ "ServicerContext",
+ Callable[[ResponseType], None],
+ ],
+ ResponseType,
+ ],
+ Callable[
+ [
+ Iterator[RequestType],
+ "ServicerContext",
+ Callable[[ResponseType], None],
+ ],
+ Iterator[ResponseType],
+ ],
+ Callable[[RequestType, "ServicerContext"], ResponseType],
+ Callable[[RequestType, "ServicerContext"], Iterator[ResponseType]],
+ Callable[[Iterator[RequestType], "ServicerContext"], ResponseType],
+ Callable[
+ [Iterator[RequestType], "ServicerContext"], Iterator[ResponseType]
+ ],
+]