Package circuits :: Package core

Package core

Core Building Blocks

This package contains the most basic building blocks of all Components.

Submodules

Classes
  Event
Create a new Event Object
  Error
Error Event
  Started
Started Event
  Stopped
Stopped Event
  Signal
Signal Event
  Registered
Registered Event
  Unregistered
Unregistered Event
  HandlersType
Handlers metaclass
  Manager
Manager
  BaseComponent
Base Component
  Component
Component
Functions
 
handler(*channels, **kwargs)
Creates an Event Handler
Variables
  HAS_MULTIPROCESSING = 0
Function Details

handler(*channels, **kwargs)

 

Creates an Event Handler

Decorator to wrap a callable into an Event Handler that listens on a set of channels defined by channels. The type of the Event Handler defaults to "listener". If kwargs["filter"] is defined and is True, the Event Handler is defined as a Filter and has priority over Listener Event Handlers. If kwargs["target"] is defined and is not None, the Event Handler will listen for the spcified channels on the spcified Target Component's Channel.

Examples:

>>> @handler("foo")
... def foo():
...     pass
>>> @handler("bar", filter=True)
... def bar():
...     pass
>>> @handler("foo", "bar")
... def foobar():
...     pass
>>> @handler("x", target="other")
... def x():
...     pass