wtypes.evented
¶
Evented wtypes, the observable pattern
Module Contents¶
-
class
wtypes.evented.
spec
¶ -
dlink
(this, source, that, target, callable)¶
-
link
(this, source, that, target)¶
-
-
wtypes.evented.
get_jawn
(thing, key, object)¶
-
wtypes.evented.
set_jawn
(thing, key, object)¶
-
class
wtypes.evented.
wtypes_impl
¶ Bases:
wtypes.evented.spec_impl
-
dlink
(this, source, that, target, callable)¶
-
-
class
wtypes.evented.
Link
¶ -
_registered_parents
¶
-
_registered_links
¶
-
_registered_id
¶
-
_deferred_changed
¶
-
_deferred_prior
¶
-
_depth
= 0¶
-
_display_id
¶
-
__enter__
(self)¶
-
__exit__
(self, *e)¶
-
link
(this, source, that, target='value')¶
-
dlink
(self, source, that, target, callable=None)¶ Examples
>>> class d(Dict): a: int >>> e, f = d(a=1), d(a=1) >>> e.dlink('a', f, 'a', lambda x: 2*x) {'a': 1} >>> e['a'] = 7 >>> f {'a': 14}
-
observe
(self, source='', callable=None)¶ The callable has to define a signature.
-
_propagate
(self, *changed, **prior)¶
-
_update_display
(self)¶
-
_ipython_display_
(self)¶
-
_repr_mimebundle_
(self, include=None, exclude=None)¶
-
-
class
wtypes.evented.
_EventedObject
¶ Bases:
wtypes.evented.Link
-
class
wtypes.evented.
_EventedDict
(*args, **kwargs)¶ Bases:
wtypes.evented._EventedObject
-
_link_parent
(self, object)¶
-
__setitem__
(self, key, object)¶
-
update
(self, *args, **kwargs)¶
-
-
class
wtypes.evented.
_EventedDataClass
(*args, **kwargs)¶ Bases:
wtypes.evented._EventedObject
-
_link_parent
(self, object)¶
-
__setattr__
(self, key, object)¶
-
-
class
wtypes.evented.
_EventedList
(*args, **kwargs)¶ Bases:
wtypes.evented.Link
-
_link_parent
(self, object)¶
-
__exit__
(self, *e)¶
-
__setitem__
(self, key, object)¶
-
append
(self, object)¶
-
insert
(self, index, object)¶
-
extend
(self, object)¶
-
pop
(self, index=-1)¶
-
observe
(self, callable=None)¶ The callable has to define a signature.
-
-
class
wtypes.evented.
List
(*args, **kwargs)¶ Bases:
wtypes.evented._EventedList
,wtypes.wtypes.List
-
class
wtypes.evented.
Bunch
(*args, **kwargs)¶ Bases:
wtypes.evented._EventedDict
,wtypes.wtypes.Bunch
An evented dictionary/bunch
Examples
>>> e, f = Bunch(), Bunch() >>> e.link('a', f, 'b') Bunch({}) >>> e['a'] = 1 >>> f.toDict() {'b': 1} >>> e.update(a=100) >>> f.toDict() {'b': 100}
>>> f['b'] = 2 >>> assert e['a'] == f['b'] >>> e = Bunch().observe('a', print) >>> e['a'] = 2 {'new': 2, 'old': None, 'object': Bunch({'a': 2}), 'name': 'a'}
-
class
wtypes.evented.
Dict
(*args, **kwargs)¶ Bases:
wtypes.evented._EventedDict
,wtypes.wtypes.Dict
An evented dictionary/bunch
Examples
>>> e, f = Dict(), Dict() >>> e.link('a', f, 'b') {} >>> e['a'] = 1 >>> f {'b': 1} >>> e.update(a=100) >>> f {'b': 100}
>>> f['b'] = 2 >>> assert e['a'] == f['b'] >>> e = Dict().observe('a', print) >>> e['a'] = 2 {'new': 2, 'old': None, 'object': {'a': 2}, 'name': 'a'}
-
class
wtypes.evented.
DataClass
(*args, **kwargs)¶
-
class
wtypes.evented.
Namespace
(*args, **kwargs)¶ Bases:
wtypes.evented.Dict
An event namespace to visualize track the annotated fields.
Examples
>>> # evented.Namespace.register()
-
_repr_mimebundle_
(self, include=None, exclude=None)¶
-
classmethod
register
(cls)¶
-
classmethod
unregister
(cls)¶
-