autoinject-pymitter-1.0.0
توضیحات
ADI integration for pymitter
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | autoinject-pymitter-1.0.0 |
| نام | autoinject-pymitter |
| نسخه کتابخانه | 1.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Erin Turnbull |
| ایمیل نویسنده | erin.a.turnbull@gmail.com |
| آدرس صفحه اصلی | https://github.com/turnbullerin/autoinject_pymitter |
| آدرس اینترنتی | https://pypi.org/project/autoinject-pymitter/ |
| مجوز | - |
# Pymitter Integration
Adds the ability to inject an instance of EventEmitter from [pymitter](https://github.com/riga/pymitter). This instance
will be shared within a context (separate threads have separate emitters). Registration is done via the entry point in
autoinject, so no need to do anything other than install this package.
```python
from autoinject import injector as _injector
import pymitter
class NeedsEvents:
ee: pymitter.EventEmitter = None
@_injector.construct
def __init__(self):
pass
def do_stuff(self):
self.ee.emit("foo.bar", "hello world")
class LikesEvents:
ee: pymitter.EventEmitter = None
@_injector.construct
def __init__(self):
self.ee.on("foo.bar", self.on_event)
def on_event(self, arg):
print("foo bar emitted: {}".format(arg))
emitter = NeedsEvents()
receiver = LikesEvents()
emitter.do_stuff()
# OUTPUT: foo bar emitted: hello world
```
نیازمندی
| مقدار | نام |
|---|---|
| >=0.2.0 | autoinject |
| >=0.3.0 | pymitter |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl autoinject-pymitter-1.0.0:
pip install autoinject-pymitter-1.0.0.whl
نصب پکیج tar.gz autoinject-pymitter-1.0.0:
pip install autoinject-pymitter-1.0.0.tar.gz