Skip to main content

Gev (General Events Manager)

$ pip install gev

Usage

from gev import Event, EventManager

manager = EventManager()

def handler_1(e):
    print("handler_1 called with", e)

def handler_2(e):
    print("handler_2 called with", e)

# Register event handlers
manager.on('sys_1::event_a').do(handler_1)
manager.on('sys_1::event_b').do(handler_2)

manager.take(Event(
    source='sys_1',
    type='event_a',
    payload={'a': 1}
))  # handler_1 will be called

manager.take(Event(
    source='sys_1',
    type='event_b',
    payload={'b': 1}
))  # handler_1 will be called

If you don't want to initialize an EventManager instance, you can use the global default_manager and its on and take methods exposed at module level.

from gev import on, take, Event

def handler_1(e):
    print("handler_1 called with", e)

on('sys_1::event_a').do(handler_1)

take(Event(
    source='sys_1',
    type='event_a',
    payload={'a': 1}
))  # handler_1 will be called

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gev-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gev-0.1.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file gev-0.1.2.tar.gz.

File metadata

  • Download URL: gev-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1023-azure

File hashes

Hashes for gev-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bf4da5d8fc713c130970283a6e2a4aa2db2538b50a674bfd56279a33b1647d2c
MD5 a7796e8eaeb90582504741027f6a97d1
BLAKE2b-256 ee043b4e21c40647717e4f0aa012606f63adfd4fe6cb75452f1515d8d1184943

See more details on using hashes here.

File details

Details for the file gev-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gev-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.14 Linux/5.15.0-1023-azure

File hashes

Hashes for gev-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 99f92f879fc749201347f7c8cfd9f47227731388d6986ba2831659ce95a42a12
MD5 5419c078756657486c910640ffa5f5bf
BLAKE2b-256 c835d7e2c68f11b71f507d6db4ecdab80afa93c2b2c4148921ed56ca36c209ea

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page