1 from collections
import namedtuple
3 from .facade
import Type
11 """A single websocket delta.
13 :ivar entity: The entity name, e.g. 'unit', 'application'
16 :ivar type: The delta type, e.g. 'add', 'change', 'remove'
19 :ivar data: The raw delta data
22 NOTE: The 'data' variable above is being incorrectly cross-linked by a
23 Sphinx bug: https://github.com/sphinx-doc/sphinx/issues/2549
26 _toSchema
= {'deltas': 'deltas'}
27 _toPy
= {'deltas': 'deltas'}
29 def __init__(self
, deltas
=None):
31 :param deltas: [str, str, object]
36 Change
= namedtuple('Change', 'entity type data')
37 change
= Change(*self
.deltas
)
39 self
.entity
= change
.entity
40 self
.type = change
.type
41 self
.data
= change
.data
44 def from_json(cls
, data
):
45 return cls(deltas
=data
)