Skip to main content

General function and method subscription system

Project description

Deadly simple pre/post hooks processing library

import funcsubs


def simple_hook(*_args, **_kwargs):
    print(6)


class C1(funcsubs.SubscribableMixin):

    def test1(self):
        print(5)

C1.pre_hook(C1.test1, simple_hook)

Also, has ability to propagate to childs

import funcsubs


def simple_hook(*_args, **_kwargs):
    print(6)


class C1(funcsubs.SubscribableMixin):

    t1 = False

    def test1(self):
        print(5)

class C2(C1):

    t1 = True

C1.pre_hook(C1.test1, simple_hook, lambda x: x.t1)

C1().test()  # no side-effect
C2().test()  # has side-effect

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

funcsubs-0.1.0-py2.py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page