
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Timing utilities based on asyncio
.
pip install aio-timers
import asyncio
from aio_timers import Timer
def callback(name):
print("Hello {}!".format(name))
# timer is scheduled here
timer = Timer(5, callback, callback_args=("World",))
# wait until the callback has been executed
loop = asyncio.get_event_loop()
loop.run_until_complete(timer.wait())
print("end")
Output:
(after 5 seconds)
Hello World!
end
Calls a callback
after delay
seconds.
The timer is executed as a task on an event loop.
The callback is invoked:
callback_async
flag is set to True
.Any result returned by the callback is ignored.
Timer(delay, callback, callback_args=(), callback_kwargs={}, callback_async=False, *, loop=None)
where:
callback
is executed;delay
seconds()
) positional arguments to pass to callback
{}
) keyword arguments to pass to callback
False
) if True
the callback will be executed on the event loop (await
)None
) event loop where the delayed task will be scheduled (ifNone
will use asyncio.get_event_loop()
)NOTE: the callback_async
flag should be used when a coroutine is decorated (e.g., using functools.partial
)
Cancels the execution of the callback.
Wait until the callback has been executed or its execution has been canceled.
If the execution has been canceled, will raise asyncio.CancelledError
.
FAQs
Timer support for asyncio.
We found that aio-timers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.