kxg.forums.ForumObserver

class kxg.forums.ForumObserver[source]

Bases: object

Public Methods:

namedtuple(field_names, *[, rename, …])

Returns a new subclass of tuple with named fields.

__init__()

Initialize self.

__getstate__()

__setstate__(state)

subscribe_to_message(message_cls, callback)

subscribe_to_sync_response(message_cls, callback)

subscribe_to_undo_response(message_cls, callback)

unsubscribe_from_message(message_cls[, callback])

unsubscribe_from_sync_response(message_cls)

unsubscribe_from_undo_response(message_cls)

Private Methods:

_react_to_message(message)

_react_to_sync_response(message)

_react_to_undo_response(message)

_enable_forum_observation()

_disable_forum_observation()

_check_if_forum_observation_enabled()

_add_callback(event, message_cls, callback)

_drop_callback(event, message_cls, callback)

_call_callbacks(event, message)

_get_nested_observers()

class CallbackInfo(message_cls, callback)

Bases: tuple

__add__(value, /)

Return self+value.

__contains__(key, /)

Return key in self.

__eq__(value, /)

Return self==value.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getitem__(key, /)

Return self[key].

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__iter__()

Implement iter(self).

__le__(value, /)

Return self<=value.

__len__()

Return len(self).

__lt__(value, /)

Return self<value.

__mul__(value, /)

Return self*value.

__ne__(value, /)

Return self!=value.

static __new__(_cls, message_cls, callback)

Create new instance of CallbackInfo(message_cls, callback)

__repr__()

Return a nicely formatted representation string

__rmul__(value, /)

Return value*self.

__slots__ = ()
_asdict()

Return a new OrderedDict which maps field names to their values.

_fields = ('message_cls', 'callback')
_fields_defaults = {}
classmethod _make(iterable)

Make a new CallbackInfo object from a sequence or iterable

_replace(**kwds)

Return a new CallbackInfo object replacing specified fields with new values

property callback

Alias for field number 1

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

property message_cls

Alias for field number 0

__getstate__()[source]
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

__setstate__(state)[source]
_add_callback(event, message_cls, callback)[source]
_call_callbacks(event, message)[source]
_check_if_forum_observation_enabled()[source]
_disable_forum_observation()[source]
_drop_callback(event, message_cls, callback)[source]
_enable_forum_observation()[source]
_get_nested_observers()[source]
_react_to_message(message)[source]
_react_to_sync_response(message)[source]
_react_to_undo_response(message)[source]
namedtuple(field_names, *, rename=False, defaults=None, module=None)

Returns a new subclass of tuple with named fields.

>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__                   # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22)             # instantiate with positional args or keywords
>>> p[0] + p[1]                     # indexable like a plain tuple
33
>>> x, y = p                        # unpack like a regular tuple
>>> x, y
(11, 22)
>>> p.x + p.y                       # fields also accessible by name
33
>>> d = p._asdict()                 # convert to a dictionary
>>> d['x']
11
>>> Point(**d)                      # convert from a dictionary
Point(x=11, y=22)
>>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields
Point(x=100, y=22)
subscribe_to_message(message_cls, callback)[source]
subscribe_to_sync_response(message_cls, callback)[source]
subscribe_to_undo_response(message_cls, callback)[source]
unsubscribe_from_message(message_cls, callback=None)[source]
unsubscribe_from_sync_response(message_cls, callback=None)[source]
unsubscribe_from_undo_response(message_cls, callback=None)[source]