astropy 5.0

BackRef

All methods provided by this class are underscored, since this is intended for internal use to communicate between classes in a generic way, and is not machinery that should be exposed to users of the classes involved.

Use the _add_listener method to register a listener on an instance of the notifier. This registers the listener with a weak reference, so if no other references to the listener exist it is automatically dropped from the list and does not need to be manually removed.

Call the _notify method on the notifier to update all listeners upon changes. _notify('change_type', *args, **kwargs) results in calling listener._update_change_type(*args, **kwargs) on all listeners subscribed to that notifier.

If a particular listener does not have the appropriate update method it is ignored.

Mixin class that provides services by which objects can register listeners to changes on that object.

Examples

This example is valid syntax, but we were not able to check execution
>>> class Widget(NotifierMixin):
...  state = 1
...  def __init__(self, name):
...  self.name = name
...  def update_state(self):
...  self.state += 1
...  self._notify('widget_state_changed', self) ...
This example is valid syntax, but we were not able to check execution
>>> class WidgetListener:
...  def _update_widget_state_changed(self, widget):
...  print('Widget {0} changed state to {1}'.format(
...  widget.name, widget.state)) ...
This example is valid syntax, but we were not able to check execution
>>> widget = Widget('fred')
... listener = WidgetListener()
... widget._add_listener(listener)
... widget.update_state() Widget fred changed state to 2
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

astropy.io.fits.util.NotifierMixin

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /astropy/io/fits/util.py#35
type: <class 'type'>
Commit: