class ExtractorChannel(GRPCChannel): (source)
A mock gRPC channel for extracting service names from stub classes.
This channel implementation records the last method called on it and can extract the service name from the method name. It is used to introspect gRPC stub classes without making actual network calls.
| Async Method | __aenter__ |
Enter async context. |
| Async Method | __aexit__ |
Exit async context. |
| Method | __init__ |
Undocumented |
| Async Method | channel |
Wait for channel to be ready (no-op for this mock). |
| Async Method | close |
Close the channel (no-op for this mock implementation). |
| Method | get |
Extract the service name from the last recorded method. |
| Method | get |
Get the channel state (always READY for this mock). |
| Method | stream |
Record a stream-stream method call and return a stub. |
| Method | stream |
Record a stream-unary method call and return a stub. |
| Method | unary |
Record a unary-stream method call and return a stub. |
| Method | unary |
Record a unary-unary method call and return a stub. |
| Async Method | wait |
Wait for state change (not implemented for this mock). |
| Instance Variable | _last |
Undocumented |
Exit async context.
| Parameters | |
| exc | Exception type. |
| exc | Exception value. |
| exc | Exception traceback. |
Close the channel (no-op for this mock implementation).
| Parameters | |
| grace:float or None | Optional grace period. |
Extract the service name from the last recorded method.
| Returns | |
| str | The service name. |
| Raises | |
NoMethodsInServiceError | If no methods have been recorded. |
Get the channel state (always READY for this mock).
| Parameters | |
| try | Whether to attempt connection. |
| Returns | |
ChannelConnectivity | The connectivity state. |
str, request_serializer: SerializingFunction | None = None, response_deserializer: DeserializingFunction | None = None, _registered_method: bool | None = None) -> StreamStreamMultiCallable:
(source)
¶
Record a stream-stream method call and return a stub.
| Parameters | |
| method:str | The method name. |
requestSerializingFunction or None | Optional request serializer. |
responseDeserializingFunction or None | Optional response deserializer. |
| _registered | Whether the method is registered. |
| Returns | |
StreamStreamMultiCallable | A stub callable. |
str, request_serializer: SerializingFunction | None = None, response_deserializer: DeserializingFunction | None = None, _registered_method: bool | None = None) -> StreamUnaryMultiCallable:
(source)
¶
Record a stream-unary method call and return a stub.
| Parameters | |
| method:str | The method name. |
requestSerializingFunction or None | Optional request serializer. |
responseDeserializingFunction or None | Optional response deserializer. |
| _registered | Whether the method is registered. |
| Returns | |
StreamUnaryMultiCallable | A stub callable. |
str, request_serializer: SerializingFunction | None = None, response_deserializer: DeserializingFunction | None = None, _registered_method: bool | None = None) -> UnaryStreamMultiCallable[ Req, Res]:
(source)
¶
Record a unary-stream method call and return a stub.
| Parameters | |
| method:str | The method name. |
requestSerializingFunction or None | Optional request serializer. |
responseDeserializingFunction or None | Optional response deserializer. |
| _registered | Whether the method is registered. |
| Returns | |
UnaryStreamMultiCallable | A stub callable. |
str, request_serializer: SerializingFunction | None = None, response_deserializer: DeserializingFunction | None = None, _registered_method: bool | None = False) -> UnaryUnaryMultiCallable[ Req, Res]:
(source)
¶
Record a unary-unary method call and return a stub.
| Parameters | |
| method:str | The method name. |
requestSerializingFunction or None | Optional request serializer. |
responseDeserializingFunction or None | Optional response deserializer. |
| _registered | Whether the method is registered. |
| Returns | |
UnaryUnaryMultiCallable | A stub callable. |
Wait for state change (not implemented for this mock).
| Parameters | |
lastChannelConnectivity | The last observed state. |
| Raises | |
NotImplementedError | Always raised. |