ADI integration for pymitter
Project description
Pymitter Integration
Adds the ability to inject an instance of EventEmitter from 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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file autoinject_pymitter-1.0.0.tar.gz
.
File metadata
- Download URL: autoinject_pymitter-1.0.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e41d8cf7eedbd247b12ce602764da0a93634ea05078d30519841a4b2eb12c496 |
|
MD5 | 9ea4b246da0151c29c47aa09a621929c |
|
BLAKE2b-256 | ac0856e889aac1ea7329376287d0bb55064f0b35c86d27c1386f7e9ee3647395 |
File details
Details for the file autoinject_pymitter-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: autoinject_pymitter-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 216ebd46c4d07bf6b0d851903257ab3ba2638f4a72ea74b9522ac9955c88ca4a |
|
MD5 | 816d1a9c2de79be7e6e55b38931643a1 |
|
BLAKE2b-256 | 5c33feb6f870fe8e640d87c5951e1871247a7c06ba202b5f2c328c11227d128c |