Skip to content

Commit

Permalink
fix: return None type in return_xxx async api in Python (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxilin authored Dec 26, 2024
1 parent 8f29d00 commit b259f72
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ async def send_audio_frame(
error = await q.get()
return error

async def return_result(
self, result: CmdResult, target_cmd: Cmd
) -> Optional[TenError]:
async def return_result(self, result: CmdResult, target_cmd: Cmd) -> None:
q = asyncio.Queue(maxsize=1)
self._internal.return_result(
result,
Expand All @@ -133,11 +131,11 @@ async def return_result(
)

error = await q.get()
return error

async def return_result_directly(
self, result: CmdResult
) -> Optional[TenError]:
if error is not None:
raise RuntimeError(error.err_msg())

async def return_result_directly(self, result: CmdResult) -> None:
q = asyncio.Queue(maxsize=1)
self._internal.return_result_directly(
result,
Expand All @@ -148,7 +146,9 @@ async def return_result_directly(
)

error = await q.get()
return error

if error is not None:
raise RuntimeError(error.err_msg())

async def get_property_to_json(self, path: str) -> str:
q = asyncio.Queue(maxsize=1)
Expand Down

0 comments on commit b259f72

Please sign in to comment.