aiotimer-0.1.0
توضیحات
High resoltion timer for asyncio
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aiotimer-0.1.0 |
| نام | aiotimer |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Simon Gomizelj |
| ایمیل نویسنده | simon@vodik.xyz |
| آدرس صفحه اصلی | https://github.com/vodik/aiotimer |
| آدرس اینترنتی | https://pypi.org/project/aiotimer/ |
| مجوز | Apache 2 |
========
aiotimer
========
AsyncIO compatible periodic timer. Linux only and very alpha API.
-------
Example
-------
The timer is implemented as a straightforward protocol similar to how
the asyncio's network protocols are handled:
.. code-block:: python
class MyTimer(aiotimer.Protocol):
def __init__(self):
self.counter = 0
def timer_started(self, timer):
self.timer = timer
def timer_ticked(self):
# Callback triggered when the timer interval elapses
...
def timer_overrun(self):
# Callback triggered if the timer_ticked callback runtime
# should exceed the timer interval. Return True to
# reschedule, otherwise the timer is aborted.
return True
def error_received():
...
The protocol can then be used to create a new timer:
.. code-block:: python
# Schedule once every 10th of a second
aiotimer.create_timer(MyTimer, 0.1, loop=loop)
نحوه نصب
نصب پکیج whl aiotimer-0.1.0:
pip install aiotimer-0.1.0.whl
نصب پکیج tar.gz aiotimer-0.1.0:
pip install aiotimer-0.1.0.tar.gz