Menu

Python Sparse data Analysis Package

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the gallery for the big picture.

class pysap.base.observable.Observable(signals)[source]

Base class for observable classes.

This class defines a simple interface to add or remove observers on an object.

add_observer(signal, observer)[source]

Add an observer to the object. Raise an exception if the signal is not allowed.

Parameters

signal : str

a valid signal.

observer : @func

a function that will be called when the signal is emitted.

property allowed_signals

Events allowed for the current object.

notify_observers(signal, **kwargs)[source]

Notify observers of a given signal.

Parameters

signal : str

a valid signal.

kwargs : dict

the parameters that will be sent to the observers.

Returns

out : bool

Fasle if a notification is in progress, otherwise True.

remove_observer(signal, observer)[source]

Remove an observer from the object. Raise an eception if the signal is not allowed.

Parameters

signal : str

a valid signal.

observer : @func

an obervation function to be removed.

Follow us

© 2019, Antoine Grigis Samuel Farrens Jean-Luc Starck Philippe Ciuciu