cuelib


License
Apache-2.0
Install
pip install cuelib==0.1.0

Documentation

cue

Pythonic implementation of the observer pattern.

Usage:

import cue

class MyClass:
    @cue.publisher
    def my_method(self, x: Any) -> Any:
        ...
      
      
 @cue.subscribe(MyClass.my_method)
 def on_method_call(myclass_instance: MyClass, x: Any) -> None:
     # called after the myclass_instance.my_method is called
     ...
import cue

class MyClass:
    my_attribute: Cue[Any] = Cue()
    
@cue.subscribe(MyClass.my_attribute)
def on_method_call(myclass_instance: MyClass, value: Any):
    # called after myclass_instance.my_attribute assignment
    ...