mirror of
https://github.com/rany2/edge-tts
synced 2024-11-21 17:29:07 +00:00
Merge pull request #210 from zhoukuncheng/refactor-async
Simplify asyncio main loop setup
This commit is contained in:
commit
bafe5d825a
@ -32,8 +32,4 @@ async def amain() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
loop = asyncio.get_event_loop_policy().get_event_loop()
|
||||
try:
|
||||
loop.run_until_complete(amain())
|
||||
finally:
|
||||
loop.close()
|
||||
asyncio.run(amain())
|
||||
|
@ -20,8 +20,4 @@ async def amain() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
loop = asyncio.get_event_loop_policy().get_event_loop()
|
||||
try:
|
||||
loop.run_until_complete(amain())
|
||||
finally:
|
||||
loop.close()
|
||||
asyncio.run(amain())
|
||||
|
@ -26,8 +26,4 @@ async def amain() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
loop = asyncio.get_event_loop_policy().get_event_loop()
|
||||
try:
|
||||
loop.run_until_complete(amain())
|
||||
finally:
|
||||
loop.close()
|
||||
asyncio.run(amain())
|
||||
|
@ -33,8 +33,4 @@ async def amain() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
loop = asyncio.get_event_loop_policy().get_event_loop()
|
||||
try:
|
||||
loop.run_until_complete(amain())
|
||||
finally:
|
||||
loop.close()
|
||||
asyncio.run(amain())
|
||||
|
@ -133,11 +133,7 @@ async def amain() -> None:
|
||||
|
||||
def main() -> None:
|
||||
"""Run the main function using asyncio."""
|
||||
loop = asyncio.get_event_loop_policy().get_event_loop()
|
||||
try:
|
||||
loop.run_until_complete(amain())
|
||||
finally:
|
||||
loop.close()
|
||||
asyncio.run(amain())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user