Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pyee.executor.ExecutorEventEmitter Class Reference
Inheritance diagram for pyee.executor.ExecutorEventEmitter:
Inheritance graph
[legend]
Collaboration diagram for pyee.executor.ExecutorEventEmitter:
Collaboration graph
[legend]

Public Member Functions

None __init__ (Self self, Optional[Executor] executor=None)
 
None shutdown (Self self, bool wait=True)
 
"ExecutorEventEmitter" __enter__ (Self self)
 
Optional[bool] __exit__ (Self self, Type[Exception] type, Exception value, TracebackType traceback)
 
- Public Member Functions inherited from pyee.base.EventEmitter
Mapping[str, Any] __getstate__ (Self self)
 
None __setstate__ (Self self, Mapping[str, Any] state)
 
Callable[[Handler], Handler] on (Self self, str event)
 
Handler on (Self self, str event, Handler f)
 
Union[Handler, Callable[[Handler], Handler]] on (Self self, str event, Optional[Handler] f=None)
 
Callable[[Handler], Handler] listens_to (Self self, str event)
 
Handler add_listener (Self self, str event, Handler f)
 
Set[str] event_names (Self self)
 
bool emit (Self self, str event, *Any args, **Any kwargs)
 
Callable once (Self self, str event, Optional[Callable] f=None)
 
None remove_listener (Self self, str event, Callable f)
 
None remove_all_listeners (Self self, Optional[str] event=None)
 
List[Callable] listeners (Self self, str event)
 

Protected Member Functions

None _emit_run (Self self, Callable f, Tuple[Any,...] args, Dict[str, Any] kwargs)
 
- Protected Member Functions inherited from pyee.base.EventEmitter
 _add_event_handler (Self self, str event, Callable k, Callable v)
 
None _emit_handle_potential_error (Self self, str event, Any error)
 
bool _call_handlers (Self self, str event, Tuple[Any,...] args, Dict[str, Any] kwargs)
 
None _remove_listener (Self self, str event, Callable f)
 

Protected Attributes

 _executor
 
- Protected Attributes inherited from pyee.base.EventEmitter
 _lock
 
 _events
 

Detailed Description

An event emitter class which runs handlers in a `concurrent.futures`
executor.

By default, this class creates a default `ThreadPoolExecutor`, but
a custom executor may also be passed in explicitly to, for instance,
use a `ProcessPoolExecutor` instead.

This class runs all emitted events on the configured executor. Errors
captured by the resulting Future are automatically emitted on the
`error` event. This is unlike the EventEmitter, which have no error
handling.

The underlying executor may be shut down by calling the `shutdown`
method. Alternately you can treat the event emitter as a context manager:

```py
with ExecutorEventEmitter() as ee:
    # Underlying executor open

    @ee.on('data')
    def handler(data):
        print(data)

    ee.emit('event')

# Underlying executor closed
```

Since the function call is scheduled on an executor, emit is always
non-blocking.

No effort is made to ensure thread safety, beyond using an executor.

Constructor & Destructor Documentation

◆ __init__()

None pyee.executor.ExecutorEventEmitter.__init__ ( Self  self,
Optional[Executor]   executor = None 
)

Reimplemented from pyee.base.EventEmitter.

Member Function Documentation

◆ _emit_run()

None pyee.executor.ExecutorEventEmitter._emit_run ( Self  self,
Callable  f,
Tuple[Any, ...]  args,
Dict[str, Any]  kwargs 
)
protected

Reimplemented from pyee.base.EventEmitter.

◆ shutdown()

None pyee.executor.ExecutorEventEmitter.shutdown ( Self  self,
bool   wait = True 
)
Call `shutdown` on the internal executor.

The documentation for this class was generated from the following file: