Skip to main content

onoff

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!

Metadata

Release files for onoff 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onoff 1.0.1
File Size Uploaded
onoff-1.0.1.tar.gz 13.5 kB Details

Release files / onoff-1.0.1.tar.gz

Download URL onoff-1.0.1.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
094accfbc621d250729ba7824fb5251bf43f1b844a71f11fe523c5b313457b3f
BLAKE2b-256 checksum
How to use checksums
9144f2849b517e475185d3131d508efc34edbfc325b07d6b35ba38cbc134271b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page