Skip to main content

onoff is a Python module that provides the OnOffMixin class which can be used to add on(), off(), and trigger() style events to any Python class.

Example

>>> from onoff import OnOffMixin
>>> class Foo(OnOffMixin):
...     def __init__(self):
...         self.on("hello", self.hello)
...     def hello(self, *args):
...         print("Hello: %s" % args)
...     def test(self, *args):
...         self.trigger("hello", *args)
...
>>> f = Foo()
>>> f.test("Triggered events rock!")
Hello: Triggered events rock!

Download files

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

Source Distribution

onoff-1.0.1.tar.gz (13.5 kB view details)

Uploaded Source

File details

Details for the file onoff-1.0.1.tar.gz.

File metadata

  • Download URL: onoff-1.0.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for onoff-1.0.1.tar.gz
Algorithm Hash digest
SHA256 094accfbc621d250729ba7824fb5251bf43f1b844a71f11fe523c5b313457b3f
MD5 b0dd3ba024f3a1a2e82e1328a3f11503
BLAKE2b-256 9144f2849b517e475185d3131d508efc34edbfc325b07d6b35ba38cbc134271b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 file

Supported by

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