From 2a0ff284d5511c023e6d35e83e2b03c97ef179c9 Mon Sep 17 00:00:00 2001 From: insolor <2442833+insolor@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:01:16 +0300 Subject: [PATCH] Fix deprecation warning in examples/start_stop_counter.py --- examples/start_stop_counter.py | 4 +++- pyproject.toml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/start_stop_counter.py b/examples/start_stop_counter.py index ef1f415..c8c2ab9 100755 --- a/examples/start_stop_counter.py +++ b/examples/start_stop_counter.py @@ -32,6 +32,8 @@ def start_stop(): event = asyncio.Event() # Start background task -asyncio.get_event_loop_policy().get_event_loop().create_task(counter()) +loop = asyncio.new_event_loop() +asyncio.set_event_loop(loop) +task = loop.create_task(counter()) async_mainloop(root) diff --git a/pyproject.toml b/pyproject.toml index 56a282d..351788f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,4 +72,5 @@ fixable = ["ALL"] "S311", "PL", "INP001", + "RUF006", ] \ No newline at end of file