Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: CameraResult.Result.UNKNOWN,
1: CameraResult.Result.SUCCESS,
2: CameraResult.Result.IN_PROGRESS,
3: CameraResult.Result.BUSY,
4: CameraResult.Result.DENIED,
5: CameraResult.Result.ERROR,
6: CameraResult.Result.TIMEOUT,
7: CameraResult.Result.WRONG_ARGUMENT,
}.get(rpc_enum_value, None)
"""
Stop current video streaming.
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.StopVideoStreamingRequest()
response = await self._stub.StopVideoStreaming(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "stop_video_streaming()")
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: CameraResult.Result.UNKNOWN,
1: CameraResult.Result.SUCCESS,
2: CameraResult.Result.IN_PROGRESS,
3: CameraResult.Result.BUSY,
4: CameraResult.Result.DENIED,
5: CameraResult.Result.ERROR,
6: CameraResult.Result.TIMEOUT,
7: CameraResult.Result.WRONG_ARGUMENT,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: CameraResult.Result.UNKNOWN,
1: CameraResult.Result.SUCCESS,
2: CameraResult.Result.IN_PROGRESS,
3: CameraResult.Result.BUSY,
4: CameraResult.Result.DENIED,
5: CameraResult.Result.ERROR,
6: CameraResult.Result.TIMEOUT,
7: CameraResult.Result.WRONG_ARGUMENT,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: CameraResult.Result.UNKNOWN,
1: CameraResult.Result.SUCCESS,
2: CameraResult.Result.IN_PROGRESS,
3: CameraResult.Result.BUSY,
4: CameraResult.Result.DENIED,
5: CameraResult.Result.ERROR,
6: CameraResult.Result.TIMEOUT,
7: CameraResult.Result.WRONG_ARGUMENT,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: CameraResult.Result.UNKNOWN,
1: CameraResult.Result.SUCCESS,
2: CameraResult.Result.IN_PROGRESS,
3: CameraResult.Result.BUSY,
4: CameraResult.Result.DENIED,
5: CameraResult.Result.ERROR,
6: CameraResult.Result.TIMEOUT,
7: CameraResult.Result.WRONG_ARGUMENT,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpcCameraResult):
""" Translates a gRPC struct to the SDK equivalent """
return CameraResult(
CameraResult.Result.translate_from_rpc(rpcCameraResult.result),
rpcCameraResult.result_str
)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: CameraResult.Result.UNKNOWN,
1: CameraResult.Result.SUCCESS,
2: CameraResult.Result.IN_PROGRESS,
3: CameraResult.Result.BUSY,
4: CameraResult.Result.DENIED,
5: CameraResult.Result.ERROR,
6: CameraResult.Result.TIMEOUT,
7: CameraResult.Result.WRONG_ARGUMENT,
}.get(rpc_enum_value, None)
def translate_from_rpc(rpc_enum_value):
""" Parses a gRPC response """
return {
0: CameraResult.Result.UNKNOWN,
1: CameraResult.Result.SUCCESS,
2: CameraResult.Result.IN_PROGRESS,
3: CameraResult.Result.BUSY,
4: CameraResult.Result.DENIED,
5: CameraResult.Result.ERROR,
6: CameraResult.Result.TIMEOUT,
7: CameraResult.Result.WRONG_ARGUMENT,
}.get(rpc_enum_value, None)