Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pyee/__init__.py: 75%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

4 statements  

1# -*- coding: utf-8 -*- 

2 

3""" 

4pyee supplies a `EventEmitter` class that is similar to the 

5`EventEmitter` class from Node.js. In addition, it supplies the subclasses 

6`AsyncIOEventEmitter`, `TwistedEventEmitter` and `ExecutorEventEmitter` 

7for supporting async and threaded execution with asyncio, twisted, and 

8concurrent.futures Executors respectively, as supported by the environment. 

9 

10# Example 

11 

12```text 

13In [1]: from pyee.base import EventEmitter 

14 

15In [2]: ee = EventEmitter() 

16 

17In [3]: @ee.on('event') 

18 ...: def event_handler(): 

19 ...: print('BANG BANG') 

20 ...: 

21 

22In [4]: ee.emit('event') 

23BANG BANG 

24 

25In [5]: 

26``` 

27 

28""" 

29 

30from pyee.base import EventEmitter, Handler, PyeeError, PyeeException 

31 

32__all__ = ["EventEmitter", "Handler", "PyeeError", "PyeeException"]