【文件属性】:
文件名称:event-bus:一个简单的python事件总线
文件大小:68KB
文件格式:ZIP
更新时间:2021-05-14 12:53:23
Python
活动巴士
一个简单的Python 3.5+事件总线。
目的
一种触发多个后续功能的方法。
安装
pip3 install event-bus
用法
EventBus是在整个应用程序中使用的单例。
from event_bus import EventBus
bus = EventBus ()
@ bus . on ( 'hello' )
def subscribed_event ():
print ( 'World!' )
def some_func ():
print ( 'Hello' )
bus . emit ( 'hello' )
>> > some_func ()
"Hello"
"World!"
表现。
构建库之后,我开始考虑性能并针对多种情况创建了测试。 通过查看tests/目录中的performance_testing.py文件,您可以确切地
【文件预览】:
event-bus-master
----setup.py(357B)
----.gitignore(2KB)
----event_bus()
--------__init__.py(82B)
--------bus.py(7KB)
--------exceptions.py(146B)
----requirements.txt(439B)
----LICENSE(1KB)
----setup.cgf(39B)
----README.md(4KB)
----tests()
--------test_decorator_return_val.py(406B)
--------test_emit_only.py(899B)
--------__init__.py(0B)
--------generated.json(75KB)
--------test_single_vs_threaded.py(1KB)
--------test_event_subscribed.py(436B)
--------performance_testing.py(5KB)
--------test_cls_str_repr.py(517B)
--------test_event_emit.py(569B)
--------test_emit_after.py(551B)
--------test_subscribed_removal.py(928B)
----performance_tests.png(39KB)