Menu

Helper Module for Deep Learning.

Observable pattern implementation.

class pynet.observable.Observable(signals)[source]

Base class for observable classes.

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

__init__(signals)[source]

Initilize the Observable class.

Parameters

signals: list of str

the allowed signals.

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

outputs: list

The information returned by the observers.

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.

class pynet.observable.SignalObject[source]

Dummy class for signals.

Follow us

© 2019, pynet developers .
Inspired by AZMIND template.