Axel is a very small Python library inspired by C# events that allows an easy and elegant events handling.
Examples:
from axel import Event
event = Event()
def on_event(*args, **kwargs):
return (args, kwargs)
event += on_event #handler registration
print(event(10, 20, y=30))
>> ((True, ((10, 20), {'y': 30}), <function on_event at 0x00BAA270>),)
event -= on_event #handler is unregistered
print(event(10, 20, y=30))
>> None
class Mouse(object):
def __init__(self):
self.click = Event(self)
self.click += self.on_click #handler registration
def on_click(self, sender, *args, **kwargs):
assert isinstance(sender, Mouse), 'Wrong sender'
return (args, kwargs)
mouse = Mouse()
print(mouse.click(10, 20))
>> ((True, ((10, 20), {}),
>> <bound method Mouse.on_click of <__main__.Mouse object at ...>>),)
mouse.click -= mouse.on_click #handler is unregistered
print(mouse.click(10, 20))
>> None
Features:
- handlers can receive the sender as their first argument - handlers can be executed in the same or separate threads - handlers may be executed synchronous or asynchronous - handlers execution may be synchronized on a lock - the time allocated for the execution of a handler is controllable - the number of actively executed handlers at one time is controllable - the execution result of a handler can be cached - the result of the execution is provided as a tuple ((flag, result, handler),) - in case of error, the traceback may be provided for each handler in error
Contributors:
Erwin Mayer <traderwin at gmail dot com> Rob van der Most <Rob at rmsoft dot nl>
Please see the documentation: https://pythonhosted.org/axel
Metadata
Release files for axel 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| axel-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for axel-0.0.7-py3-none-any.whl |
Release files / axel-0.0.7-py3-none-any.whl
| Download URL | axel-0.0.7-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44a0fa2318a1761d629e315d2f0ca00f3ba370cd3032ea2971ed630873de63b1
|
|
BLAKE2b-256 checksum How to use checksums |
8e670390d9e5661dd974c4d76dc1ab0e151c20c5a4af69047d34b7348497d443
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for axel 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.