id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 51 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
700 | horazont/aioxmpp | aioxmpp/presence/service.py | PresenceClient.get_most_available_stanza | def get_most_available_stanza(self, peer_jid):
"""
Obtain the stanza describing the most-available presence of the
contact.
:param peer_jid: Bare JID of the contact.
:type peer_jid: :class:`aioxmpp.JID`
:rtype: :class:`aioxmpp.Presence` or :data:`None`
:return: T... | python | def get_most_available_stanza(self, peer_jid):
presences = sorted(
self.get_peer_resources(peer_jid).items(),
key=lambda item: aioxmpp.structs.PresenceState.from_stanza(item[1])
)
if not presences:
return None
return presences[-1][1] | [
"def",
"get_most_available_stanza",
"(",
"self",
",",
"peer_jid",
")",
":",
"presences",
"=",
"sorted",
"(",
"self",
".",
"get_peer_resources",
"(",
"peer_jid",
")",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"item",
":",
"aioxmpp",
".",
"structs",... | Obtain the stanza describing the most-available presence of the
contact.
:param peer_jid: Bare JID of the contact.
:type peer_jid: :class:`aioxmpp.JID`
:rtype: :class:`aioxmpp.Presence` or :data:`None`
:return: The presence stanza of the most available resource or
... | [
"Obtain",
"the",
"stanza",
"describing",
"the",
"most",
"-",
"available",
"presence",
"of",
"the",
"contact",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L123-L146 |
701 | horazont/aioxmpp | aioxmpp/presence/service.py | PresenceClient.get_peer_resources | def get_peer_resources(self, peer_jid):
"""
Return a dict mapping resources of the given bare `peer_jid` to the
presence state last received for that resource.
Unavailable presence states are not included. If the bare JID is in a
error state (i.e. an error presence stanza has be... | python | def get_peer_resources(self, peer_jid):
try:
d = dict(self._presences[peer_jid])
d.pop(None, None)
return d
except KeyError:
return {} | [
"def",
"get_peer_resources",
"(",
"self",
",",
"peer_jid",
")",
":",
"try",
":",
"d",
"=",
"dict",
"(",
"self",
".",
"_presences",
"[",
"peer_jid",
"]",
")",
"d",
".",
"pop",
"(",
"None",
",",
"None",
")",
"return",
"d",
"except",
"KeyError",
":",
... | Return a dict mapping resources of the given bare `peer_jid` to the
presence state last received for that resource.
Unavailable presence states are not included. If the bare JID is in a
error state (i.e. an error presence stanza has been received), the
returned mapping is empty. | [
"Return",
"a",
"dict",
"mapping",
"resources",
"of",
"the",
"given",
"bare",
"peer_jid",
"to",
"the",
"presence",
"state",
"last",
"received",
"for",
"that",
"resource",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L148-L162 |
702 | horazont/aioxmpp | aioxmpp/presence/service.py | PresenceServer.make_stanza | def make_stanza(self):
"""
Create and return a presence stanza with the current settings.
:return: Presence stanza
:rtype: :class:`aioxmpp.Presence`
"""
stanza = aioxmpp.Presence()
self._state.apply_to_stanza(stanza)
stanza.status.update(self._status)
... | python | def make_stanza(self):
stanza = aioxmpp.Presence()
self._state.apply_to_stanza(stanza)
stanza.status.update(self._status)
return stanza | [
"def",
"make_stanza",
"(",
"self",
")",
":",
"stanza",
"=",
"aioxmpp",
".",
"Presence",
"(",
")",
"self",
".",
"_state",
".",
"apply_to_stanza",
"(",
"stanza",
")",
"stanza",
".",
"status",
".",
"update",
"(",
"self",
".",
"_status",
")",
"return",
"st... | Create and return a presence stanza with the current settings.
:return: Presence stanza
:rtype: :class:`aioxmpp.Presence` | [
"Create",
"and",
"return",
"a",
"presence",
"stanza",
"with",
"the",
"current",
"settings",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L344-L354 |
703 | horazont/aioxmpp | aioxmpp/presence/service.py | PresenceServer.set_presence | def set_presence(self, state, status={}, priority=0):
"""
Change the presence broadcast by the client.
:param state: New presence state to broadcast
:type state: :class:`aioxmpp.PresenceState`
:param status: New status information to broadcast
:type status: :class:`dict`... | python | def set_presence(self, state, status={}, priority=0):
if not isinstance(priority, numbers.Integral):
raise TypeError(
"invalid priority: got {}, expected integer".format(
type(priority)
)
)
if not isinstance(state, aioxmpp.Pres... | [
"def",
"set_presence",
"(",
"self",
",",
"state",
",",
"status",
"=",
"{",
"}",
",",
"priority",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"priority",
",",
"numbers",
".",
"Integral",
")",
":",
"raise",
"TypeError",
"(",
"\"invalid priority: go... | Change the presence broadcast by the client.
:param state: New presence state to broadcast
:type state: :class:`aioxmpp.PresenceState`
:param status: New status information to broadcast
:type status: :class:`dict` or :class:`str`
:param priority: New priority for the resource
... | [
"Change",
"the",
"presence",
"broadcast",
"by",
"the",
"client",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L356-L417 |
704 | horazont/aioxmpp | aioxmpp/presence/service.py | PresenceServer.resend_presence | def resend_presence(self):
"""
Re-send the currently configured presence.
:return: Stanza token of the presence stanza or :data:`None` if the
stream is not established.
:rtype: :class:`~.stream.StanzaToken`
.. note::
:meth:`set_presence` automatical... | python | def resend_presence(self):
if self.client.established:
return self.client.enqueue(self.make_stanza()) | [
"def",
"resend_presence",
"(",
"self",
")",
":",
"if",
"self",
".",
"client",
".",
"established",
":",
"return",
"self",
".",
"client",
".",
"enqueue",
"(",
"self",
".",
"make_stanza",
"(",
")",
")"
] | Re-send the currently configured presence.
:return: Stanza token of the presence stanza or :data:`None` if the
stream is not established.
:rtype: :class:`~.stream.StanzaToken`
.. note::
:meth:`set_presence` automatically broadcasts the new presence if
an... | [
"Re",
"-",
"send",
"the",
"currently",
"configured",
"presence",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L419-L434 |
705 | horazont/aioxmpp | aioxmpp/security_layer.py | AbstractPinStore.export_to_json | def export_to_json(self):
"""
Return a JSON dictionary which contains all the pins stored in this
store.
"""
return {
hostname: sorted(self._encode_key(key) for key in pins)
for hostname, pins in self._storage.items()
} | python | def export_to_json(self):
return {
hostname: sorted(self._encode_key(key) for key in pins)
for hostname, pins in self._storage.items()
} | [
"def",
"export_to_json",
"(",
"self",
")",
":",
"return",
"{",
"hostname",
":",
"sorted",
"(",
"self",
".",
"_encode_key",
"(",
"key",
")",
"for",
"key",
"in",
"pins",
")",
"for",
"hostname",
",",
"pins",
"in",
"self",
".",
"_storage",
".",
"items",
... | Return a JSON dictionary which contains all the pins stored in this
store. | [
"Return",
"a",
"JSON",
"dictionary",
"which",
"contains",
"all",
"the",
"pins",
"stored",
"in",
"this",
"store",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L584-L593 |
706 | horazont/aioxmpp | aioxmpp/security_layer.py | SASLProvider._find_supported | def _find_supported(self, features, mechanism_classes):
"""
Find the first mechansim class which supports a mechanism announced in
the given stream features.
:param features: Current XMPP stream features
:type features: :class:`~.nonza.StreamFeatures`
:param mechanism_cl... | python | def _find_supported(self, features, mechanism_classes):
try:
mechanisms = features[SASLMechanisms]
except KeyError:
logger.error("No sasl mechanisms: %r", list(features))
raise errors.SASLUnavailable(
"Remote side does not support SASL") from None
... | [
"def",
"_find_supported",
"(",
"self",
",",
"features",
",",
"mechanism_classes",
")",
":",
"try",
":",
"mechanisms",
"=",
"features",
"[",
"SASLMechanisms",
"]",
"except",
"KeyError",
":",
"logger",
".",
"error",
"(",
"\"No sasl mechanisms: %r\"",
",",
"list",
... | Find the first mechansim class which supports a mechanism announced in
the given stream features.
:param features: Current XMPP stream features
:type features: :class:`~.nonza.StreamFeatures`
:param mechanism_classes: SASL mechanism classes to use
:type mechanism_classes: iterab... | [
"Find",
"the",
"first",
"mechansim",
"class",
"which",
"supports",
"a",
"mechanism",
"announced",
"in",
"the",
"given",
"stream",
"features",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L764-L804 |
707 | horazont/aioxmpp | aioxmpp/security_layer.py | SASLProvider._execute | def _execute(self, intf, mechanism, token):
"""
Execute a SASL authentication process.
:param intf: SASL interface to use
:type intf: :class:`~.sasl.SASLXMPPInterface`
:param mechanism: SASL mechanism to use
:type mechanism: :class:`aiosasl.SASLMechanism`
:param ... | python | def _execute(self, intf, mechanism, token):
sm = aiosasl.SASLStateMachine(intf)
try:
yield from mechanism.authenticate(sm, token)
return True
except aiosasl.SASLFailure as err:
if err.opaque_error in self.AUTHENTICATION_FAILURES:
raise aiosasl.... | [
"def",
"_execute",
"(",
"self",
",",
"intf",
",",
"mechanism",
",",
"token",
")",
":",
"sm",
"=",
"aiosasl",
".",
"SASLStateMachine",
"(",
"intf",
")",
"try",
":",
"yield",
"from",
"mechanism",
".",
"authenticate",
"(",
"sm",
",",
"token",
")",
"return... | Execute a SASL authentication process.
:param intf: SASL interface to use
:type intf: :class:`~.sasl.SASLXMPPInterface`
:param mechanism: SASL mechanism to use
:type mechanism: :class:`aiosasl.SASLMechanism`
:param token: The opaque token argument for the mechanism
:type... | [
"Execute",
"a",
"SASL",
"authentication",
"process",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L821-L856 |
708 | horazont/aioxmpp | aioxmpp/im/conversation.py | AbstractConversation.send_message | def send_message(self, body):
"""
Send a message to the conversation.
:param msg: The message to send.
:type msg: :class:`aioxmpp.Message`
:return: The stanza token obtained from sending.
:rtype: :class:`~aioxmpp.stream.StanzaToken`
The default implementation si... | python | def send_message(self, body):
token, tracker = self.send_message_tracked(body)
tracker.cancel()
return token | [
"def",
"send_message",
"(",
"self",
",",
"body",
")",
":",
"token",
",",
"tracker",
"=",
"self",
".",
"send_message_tracked",
"(",
"body",
")",
"tracker",
".",
"cancel",
"(",
")",
"return",
"token"
] | Send a message to the conversation.
:param msg: The message to send.
:type msg: :class:`aioxmpp.Message`
:return: The stanza token obtained from sending.
:rtype: :class:`~aioxmpp.stream.StanzaToken`
The default implementation simply calls :meth:`send_message_tracked`
an... | [
"Send",
"a",
"message",
"to",
"the",
"conversation",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/im/conversation.py#L680-L712 |
709 | horazont/aioxmpp | aioxmpp/im/conversation.py | AbstractConversation.invite | def invite(self, address, text=None, *,
mode=InviteMode.DIRECT,
allow_upgrade=False):
"""
Invite another entity to the conversation.
:param address: The address of the entity to invite.
:type address: :class:`aioxmpp.JID`
:param text: A reason/accom... | python | def invite(self, address, text=None, *,
mode=InviteMode.DIRECT,
allow_upgrade=False):
raise self._not_implemented_error("inviting entities") | [
"def",
"invite",
"(",
"self",
",",
"address",
",",
"text",
"=",
"None",
",",
"*",
",",
"mode",
"=",
"InviteMode",
".",
"DIRECT",
",",
"allow_upgrade",
"=",
"False",
")",
":",
"raise",
"self",
".",
"_not_implemented_error",
"(",
"\"inviting entities\"",
")"... | Invite another entity to the conversation.
:param address: The address of the entity to invite.
:type address: :class:`aioxmpp.JID`
:param text: A reason/accompanying text for the invitation.
:param mode: The invitation mode to use.
:type mode: :class:`~.im.InviteMode`
:... | [
"Invite",
"another",
"entity",
"to",
"the",
"conversation",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/im/conversation.py#L809-L873 |
710 | horazont/aioxmpp | examples/xmpp_bridge.py | stdout_writer | async def stdout_writer():
"""
This is a bit complex, as stdout can be a pipe or a file.
If it is a file, we cannot use
:meth:`asycnio.BaseEventLoop.connect_write_pipe`.
"""
if sys.stdout.seekable():
# it’s a file
return sys.stdout.buffer.raw
if os.isatty(sys.stdin.fileno()... | python | async def stdout_writer():
if sys.stdout.seekable():
# it’s a file
return sys.stdout.buffer.raw
if os.isatty(sys.stdin.fileno()):
# it’s a tty, use fd 0
fd_to_use = 0
else:
fd_to_use = 1
twrite, pwrite = await loop.connect_write_pipe(
asyncio.streams.Flo... | [
"async",
"def",
"stdout_writer",
"(",
")",
":",
"if",
"sys",
".",
"stdout",
".",
"seekable",
"(",
")",
":",
"# it’s a file",
"return",
"sys",
".",
"stdout",
".",
"buffer",
".",
"raw",
"if",
"os",
".",
"isatty",
"(",
"sys",
".",
"stdin",
".",
"fileno"... | This is a bit complex, as stdout can be a pipe or a file.
If it is a file, we cannot use
:meth:`asycnio.BaseEventLoop.connect_write_pipe`. | [
"This",
"is",
"a",
"bit",
"complex",
"as",
"stdout",
"can",
"be",
"a",
"pipe",
"or",
"a",
"file",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/examples/xmpp_bridge.py#L32-L61 |
711 | horazont/aioxmpp | aioxmpp/callbacks.py | first_signal | def first_signal(*signals):
"""
Connect to multiple signals and wait for the first to emit.
:param signals: Signals to connect to.
:type signals: :class:`AdHocSignal`
:return: An awaitable for the first signal to emit.
The awaitable returns the first argument passed to the signal. If the first... | python | def first_signal(*signals):
fut = asyncio.Future()
for signal in signals:
signal.connect(fut, signal.AUTO_FUTURE)
return fut | [
"def",
"first_signal",
"(",
"*",
"signals",
")",
":",
"fut",
"=",
"asyncio",
".",
"Future",
"(",
")",
"for",
"signal",
"in",
"signals",
":",
"signal",
".",
"connect",
"(",
"fut",
",",
"signal",
".",
"AUTO_FUTURE",
")",
"return",
"fut"
] | Connect to multiple signals and wait for the first to emit.
:param signals: Signals to connect to.
:type signals: :class:`AdHocSignal`
:return: An awaitable for the first signal to emit.
The awaitable returns the first argument passed to the signal. If the first
argument is an exception, the excep... | [
"Connect",
"to",
"multiple",
"signals",
"and",
"wait",
"for",
"the",
"first",
"to",
"emit",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L853-L898 |
712 | horazont/aioxmpp | aioxmpp/callbacks.py | AdHocSignal.connect | def connect(self, f, mode=None):
"""
Connect an object `f` to the signal. The type the object needs to have
depends on `mode`, but usually it needs to be a callable.
:meth:`connect` returns an opaque token which can be used with
:meth:`disconnect` to disconnect the object from t... | python | def connect(self, f, mode=None):
mode = mode or self.STRONG
self.logger.debug("connecting %r with mode %r", f, mode)
return self._connect(mode(f)) | [
"def",
"connect",
"(",
"self",
",",
"f",
",",
"mode",
"=",
"None",
")",
":",
"mode",
"=",
"mode",
"or",
"self",
".",
"STRONG",
"self",
".",
"logger",
".",
"debug",
"(",
"\"connecting %r with mode %r\"",
",",
"f",
",",
"mode",
")",
"return",
"self",
"... | Connect an object `f` to the signal. The type the object needs to have
depends on `mode`, but usually it needs to be a callable.
:meth:`connect` returns an opaque token which can be used with
:meth:`disconnect` to disconnect the object from the signal.
The default value for `mode` is :... | [
"Connect",
"an",
"object",
"f",
"to",
"the",
"signal",
".",
"The",
"type",
"the",
"object",
"needs",
"to",
"have",
"depends",
"on",
"mode",
"but",
"usually",
"it",
"needs",
"to",
"be",
"a",
"callable",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L472-L503 |
713 | horazont/aioxmpp | aioxmpp/callbacks.py | AdHocSignal.fire | def fire(self, *args, **kwargs):
"""
Emit the signal, calling all connected objects in-line with the given
arguments and in the order they were registered.
:class:`AdHocSignal` provides full isolation with respect to
exceptions. If a connected listener raises an exception, the o... | python | def fire(self, *args, **kwargs):
for token, wrapper in list(self._connections.items()):
try:
keep = wrapper(args, kwargs)
except Exception:
self.logger.exception("listener attached to signal raised")
keep = False
if not keep:
... | [
"def",
"fire",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"token",
",",
"wrapper",
"in",
"list",
"(",
"self",
".",
"_connections",
".",
"items",
"(",
")",
")",
":",
"try",
":",
"keep",
"=",
"wrapper",
"(",
"args",
... | Emit the signal, calling all connected objects in-line with the given
arguments and in the order they were registered.
:class:`AdHocSignal` provides full isolation with respect to
exceptions. If a connected listener raises an exception, the other
listeners are executed as normal, but th... | [
"Emit",
"the",
"signal",
"calling",
"all",
"connected",
"objects",
"in",
"-",
"line",
"with",
"the",
"given",
"arguments",
"and",
"in",
"the",
"order",
"they",
"were",
"registered",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L520-L541 |
714 | horazont/aioxmpp | aioxmpp/callbacks.py | SyncAdHocSignal.connect | def connect(self, coro):
"""
The coroutine `coro` is connected to the signal. The coroutine must
return a true value, unless it wants to be disconnected from the
signal.
.. note::
This is different from the return value convention with
:attr:`AdHocSignal.S... | python | def connect(self, coro):
self.logger.debug("connecting %r", coro)
return self._connect(coro) | [
"def",
"connect",
"(",
"self",
",",
"coro",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"connecting %r\"",
",",
"coro",
")",
"return",
"self",
".",
"_connect",
"(",
"coro",
")"
] | The coroutine `coro` is connected to the signal. The coroutine must
return a true value, unless it wants to be disconnected from the
signal.
.. note::
This is different from the return value convention with
:attr:`AdHocSignal.STRONG` and :attr:`AdHocSignal.WEAK`.
... | [
"The",
"coroutine",
"coro",
"is",
"connected",
"to",
"the",
"signal",
".",
"The",
"coroutine",
"must",
"return",
"a",
"true",
"value",
"unless",
"it",
"wants",
"to",
"be",
"disconnected",
"from",
"the",
"signal",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L572-L587 |
715 | horazont/aioxmpp | aioxmpp/callbacks.py | SyncAdHocSignal.fire | def fire(self, *args, **kwargs):
"""
Emit the signal, calling all coroutines in-line with the given
arguments and in the order they were registered.
This is obviously a coroutine.
Instead of calling :meth:`fire` explicitly, the ad-hoc signal object
itself can be called,... | python | def fire(self, *args, **kwargs):
for token, coro in list(self._connections.items()):
keep = yield from coro(*args, **kwargs)
if not keep:
del self._connections[token] | [
"def",
"fire",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"token",
",",
"coro",
"in",
"list",
"(",
"self",
".",
"_connections",
".",
"items",
"(",
")",
")",
":",
"keep",
"=",
"yield",
"from",
"coro",
"(",
"*",
"arg... | Emit the signal, calling all coroutines in-line with the given
arguments and in the order they were registered.
This is obviously a coroutine.
Instead of calling :meth:`fire` explicitly, the ad-hoc signal object
itself can be called, too. | [
"Emit",
"the",
"signal",
"calling",
"all",
"coroutines",
"in",
"-",
"line",
"with",
"the",
"given",
"arguments",
"and",
"in",
"the",
"order",
"they",
"were",
"registered",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L605-L618 |
716 | horazont/aioxmpp | aioxmpp/callbacks.py | Filter.register | def register(self, func, order):
"""
Add a function to the filter chain.
:param func: A callable which is to be added to the filter chain.
:param order: An object indicating the ordering of the function
relative to the others.
:return: Token representing th... | python | def register(self, func, order):
token = self.Token()
self._filter_order.append((order, token, func))
self._filter_order.sort(key=lambda x: x[0])
return token | [
"def",
"register",
"(",
"self",
",",
"func",
",",
"order",
")",
":",
"token",
"=",
"self",
".",
"Token",
"(",
")",
"self",
".",
"_filter_order",
".",
"append",
"(",
"(",
"order",
",",
"token",
",",
"func",
")",
")",
"self",
".",
"_filter_order",
".... | Add a function to the filter chain.
:param func: A callable which is to be added to the filter chain.
:param order: An object indicating the ordering of the function
relative to the others.
:return: Token representing the registration.
Register the function `func`... | [
"Add",
"a",
"function",
"to",
"the",
"filter",
"chain",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L758-L788 |
717 | horazont/aioxmpp | aioxmpp/callbacks.py | Filter.filter | def filter(self, obj, *args, **kwargs):
"""
Filter the given object through the filter chain.
:param obj: The object to filter
:param args: Additional arguments to pass to each filter function.
:param kwargs: Additional keyword arguments to pass to each filter
... | python | def filter(self, obj, *args, **kwargs):
for _, _, func in self._filter_order:
obj = func(obj, *args, **kwargs)
if obj is None:
return None
return obj | [
"def",
"filter",
"(",
"self",
",",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"_",
",",
"_",
",",
"func",
"in",
"self",
".",
"_filter_order",
":",
"obj",
"=",
"func",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwarg... | Filter the given object through the filter chain.
:param obj: The object to filter
:param args: Additional arguments to pass to each filter function.
:param kwargs: Additional keyword arguments to pass to each filter
function.
:return: The filtered object or :data... | [
"Filter",
"the",
"given",
"object",
"through",
"the",
"filter",
"chain",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L790-L809 |
718 | horazont/aioxmpp | aioxmpp/callbacks.py | Filter.unregister | def unregister(self, token_to_remove):
"""
Unregister a filter function.
:param token_to_remove: The token as returned by :meth:`register`.
Unregister a function from the filter chain using the token returned by
:meth:`register`.
"""
for i, (_, token, _) in enum... | python | def unregister(self, token_to_remove):
for i, (_, token, _) in enumerate(self._filter_order):
if token == token_to_remove:
break
else:
raise ValueError("unregistered token: {!r}".format(
token_to_remove))
del self._filter_order[i] | [
"def",
"unregister",
"(",
"self",
",",
"token_to_remove",
")",
":",
"for",
"i",
",",
"(",
"_",
",",
"token",
",",
"_",
")",
"in",
"enumerate",
"(",
"self",
".",
"_filter_order",
")",
":",
"if",
"token",
"==",
"token_to_remove",
":",
"break",
"else",
... | Unregister a filter function.
:param token_to_remove: The token as returned by :meth:`register`.
Unregister a function from the filter chain using the token returned by
:meth:`register`. | [
"Unregister",
"a",
"filter",
"function",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/callbacks.py#L811-L826 |
719 | horazont/aioxmpp | aioxmpp/tracking.py | MessageTracker.set_timeout | def set_timeout(self, timeout):
"""
Automatically close the tracker after `timeout` has elapsed.
:param timeout: The timeout after which the tracker is closed
automatically.
:type timeout: :class:`numbers.Real` or :class:`datetime.timedelta`
If the `time... | python | def set_timeout(self, timeout):
loop = asyncio.get_event_loop()
if isinstance(timeout, timedelta):
timeout = timeout.total_seconds()
loop.call_later(timeout, self.close) | [
"def",
"set_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"loop",
"=",
"asyncio",
".",
"get_event_loop",
"(",
")",
"if",
"isinstance",
"(",
"timeout",
",",
"timedelta",
")",
":",
"timeout",
"=",
"timeout",
".",
"total_seconds",
"(",
")",
"loop",
".",
... | Automatically close the tracker after `timeout` has elapsed.
:param timeout: The timeout after which the tracker is closed
automatically.
:type timeout: :class:`numbers.Real` or :class:`datetime.timedelta`
If the `timeout` is not a :class:`datetime.timedelta` instance, ... | [
"Automatically",
"close",
"the",
"tracker",
"after",
"timeout",
"has",
"elapsed",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/tracking.py#L269-L288 |
720 | horazont/aioxmpp | aioxmpp/tracking.py | MessageTracker._set_state | def _set_state(self, new_state, response=None):
"""
Set the state of the tracker.
:param new_state: The new state of the tracker.
:type new_state: :class:`~.MessageState` member
:param response: A stanza related to the new state.
:type response: :class:`~.StanzaBase` or ... | python | def _set_state(self, new_state, response=None):
if self._closed:
raise RuntimeError("message tracker is closed")
# reject some transitions as documented
if (self._state == MessageState.ABORTED or
new_state == MessageState.IN_TRANSIT or
(self._state ==... | [
"def",
"_set_state",
"(",
"self",
",",
"new_state",
",",
"response",
"=",
"None",
")",
":",
"if",
"self",
".",
"_closed",
":",
"raise",
"RuntimeError",
"(",
"\"message tracker is closed\"",
")",
"# reject some transitions as documented",
"if",
"(",
"self",
".",
... | Set the state of the tracker.
:param new_state: The new state of the tracker.
:type new_state: :class:`~.MessageState` member
:param response: A stanza related to the new state.
:type response: :class:`~.StanzaBase` or :data:`None`
:raise ValueError: if a forbidden state transit... | [
"Set",
"the",
"state",
"of",
"the",
"tracker",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/tracking.py#L292-L352 |
721 | horazont/aioxmpp | aioxmpp/tracking.py | BasicTrackingService.send_tracked | def send_tracked(self, stanza, tracker):
"""
Send a message stanza with tracking.
:param stanza: Message stanza to send.
:type stanza: :class:`aioxmpp.Message`
:param tracker: Message tracker to use.
:type tracker: :class:`~.MessageTracker`
:rtype: :class:`~.Stan... | python | def send_tracked(self, stanza, tracker):
token = self.client.enqueue(stanza)
self.attach_tracker(stanza, tracker, token)
return token | [
"def",
"send_tracked",
"(",
"self",
",",
"stanza",
",",
"tracker",
")",
":",
"token",
"=",
"self",
".",
"client",
".",
"enqueue",
"(",
"stanza",
")",
"self",
".",
"attach_tracker",
"(",
"stanza",
",",
"tracker",
",",
"token",
")",
"return",
"token"
] | Send a message stanza with tracking.
:param stanza: Message stanza to send.
:type stanza: :class:`aioxmpp.Message`
:param tracker: Message tracker to use.
:type tracker: :class:`~.MessageTracker`
:rtype: :class:`~.StanzaToken`
:return: The token used to send the stanza.
... | [
"Send",
"a",
"message",
"stanza",
"with",
"tracking",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/tracking.py#L425-L451 |
722 | horazont/aioxmpp | aioxmpp/tracking.py | BasicTrackingService.attach_tracker | def attach_tracker(self, stanza, tracker=None, token=None):
"""
Configure tracking for a stanza without sending it.
:param stanza: Message stanza to send.
:type stanza: :class:`aioxmpp.Message`
:param tracker: Message tracker to use.
:type tracker: :class:`~.MessageTrack... | python | def attach_tracker(self, stanza, tracker=None, token=None):
if tracker is None:
tracker = MessageTracker()
stanza.autoset_id()
key = stanza.to.bare(), stanza.id_
self._trackers[key] = tracker
tracker.on_closed.connect(
functools.partial(self._tracker_close... | [
"def",
"attach_tracker",
"(",
"self",
",",
"stanza",
",",
"tracker",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"if",
"tracker",
"is",
"None",
":",
"tracker",
"=",
"MessageTracker",
"(",
")",
"stanza",
".",
"autoset_id",
"(",
")",
"key",
"=",
... | Configure tracking for a stanza without sending it.
:param stanza: Message stanza to send.
:type stanza: :class:`aioxmpp.Message`
:param tracker: Message tracker to use.
:type tracker: :class:`~.MessageTracker` or :data:`None`
:param token: Optional stanza token for more fine-gr... | [
"Configure",
"tracking",
"for",
"a",
"stanza",
"without",
"sending",
"it",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/tracking.py#L453-L497 |
723 | horazont/aioxmpp | aioxmpp/muc/self_ping.py | MUCPinger.start | def start(self):
"""
Start the pinging coroutine using the client and event loop which was
passed to the constructor.
:meth:`start` always behaves as if :meth:`stop` was called right before
it.
"""
self.stop()
self._task = asyncio.ensure_future(self._ping... | python | def start(self):
self.stop()
self._task = asyncio.ensure_future(self._pinger(), loop=self._loop) | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"stop",
"(",
")",
"self",
".",
"_task",
"=",
"asyncio",
".",
"ensure_future",
"(",
"self",
".",
"_pinger",
"(",
")",
",",
"loop",
"=",
"self",
".",
"_loop",
")"
] | Start the pinging coroutine using the client and event loop which was
passed to the constructor.
:meth:`start` always behaves as if :meth:`stop` was called right before
it. | [
"Start",
"the",
"pinging",
"coroutine",
"using",
"the",
"client",
"and",
"event",
"loop",
"which",
"was",
"passed",
"to",
"the",
"constructor",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/self_ping.py#L131-L140 |
724 | horazont/aioxmpp | aioxmpp/muc/self_ping.py | MUCPinger._interpret_result | def _interpret_result(self, task):
"""
Interpret the result of a ping.
:param task: The pinger task.
The result or exception of the `task` is interpreted as follows:
* :data:`None` result: *positive*
* :class:`aioxmpp.errors.XMPPError`, ``service-unavailable``:
... | python | def _interpret_result(self, task):
if task.exception() is None:
self._on_fresh()
return
exc = task.exception()
if isinstance(exc, aioxmpp.errors.XMPPError):
if exc.condition in [
aioxmpp.errors.ErrorCondition.SERVICE_UNAVAILABLE,
... | [
"def",
"_interpret_result",
"(",
"self",
",",
"task",
")",
":",
"if",
"task",
".",
"exception",
"(",
")",
"is",
"None",
":",
"self",
".",
"_on_fresh",
"(",
")",
"return",
"exc",
"=",
"task",
".",
"exception",
"(",
")",
"if",
"isinstance",
"(",
"exc",... | Interpret the result of a ping.
:param task: The pinger task.
The result or exception of the `task` is interpreted as follows:
* :data:`None` result: *positive*
* :class:`aioxmpp.errors.XMPPError`, ``service-unavailable``:
*positive*
* :class:`aioxmpp.errors.XMPPErro... | [
"Interpret",
"the",
"result",
"of",
"a",
"ping",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/self_ping.py#L156-L189 |
725 | horazont/aioxmpp | aioxmpp/muc/self_ping.py | MUCMonitor.reset | def reset(self):
"""
Reset the monitor.
Reset the aliveness timeouts. Clear the stale state. Cancel and stop
pinging.
Call `on_fresh` if the stale state was set.
"""
self._monitor.notify_received()
self._pinger.stop()
self._mark_fresh() | python | def reset(self):
self._monitor.notify_received()
self._pinger.stop()
self._mark_fresh() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_monitor",
".",
"notify_received",
"(",
")",
"self",
".",
"_pinger",
".",
"stop",
"(",
")",
"self",
".",
"_mark_fresh",
"(",
")"
] | Reset the monitor.
Reset the aliveness timeouts. Clear the stale state. Cancel and stop
pinging.
Call `on_fresh` if the stale state was set. | [
"Reset",
"the",
"monitor",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/self_ping.py#L378-L389 |
726 | horazont/aioxmpp | aioxmpp/mdr/service.py | DeliveryReceiptsService.attach_tracker | def attach_tracker(self, stanza, tracker=None):
"""
Return a new tracker or modify one to track the stanza.
:param stanza: Stanza to track.
:type stanza: :class:`aioxmpp.Message`
:param tracker: Existing tracker to attach to.
:type tracker: :class:`.tracking.MessageTrack... | python | def attach_tracker(self, stanza, tracker=None):
if stanza.xep0184_received is not None:
raise ValueError(
"requesting delivery receipts for delivery receipts is not "
"allowed"
)
if stanza.type_ == aioxmpp.MessageType.ERROR:
raise Value... | [
"def",
"attach_tracker",
"(",
"self",
",",
"stanza",
",",
"tracker",
"=",
"None",
")",
":",
"if",
"stanza",
".",
"xep0184_received",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"requesting delivery receipts for delivery receipts is not \"",
"\"allowed\"",
... | Return a new tracker or modify one to track the stanza.
:param stanza: Stanza to track.
:type stanza: :class:`aioxmpp.Message`
:param tracker: Existing tracker to attach to.
:type tracker: :class:`.tracking.MessageTracker`
:raises ValueError: if the stanza is of type
... | [
"Return",
"a",
"new",
"tracker",
"or",
"modify",
"one",
"to",
"track",
"the",
"stanza",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/mdr/service.py#L73-L112 |
727 | horazont/aioxmpp | aioxmpp/private_xml/service.py | PrivateXMLService.get_private_xml | def get_private_xml(self, query_xso):
"""
Get the private XML data for the element `query_xso` from the
server.
:param query_xso: the object to retrieve.
:returns: the stored private XML data.
`query_xso` *must* serialize to an empty XML node of the
wanted names... | python | def get_private_xml(self, query_xso):
iq = aioxmpp.IQ(
type_=aioxmpp.IQType.GET,
payload=private_xml_xso.Query(query_xso)
)
return (yield from self.client.send(iq)) | [
"def",
"get_private_xml",
"(",
"self",
",",
"query_xso",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"IQType",
".",
"GET",
",",
"payload",
"=",
"private_xml_xso",
".",
"Query",
"(",
"query_xso",
")",
")",
"return",
"("... | Get the private XML data for the element `query_xso` from the
server.
:param query_xso: the object to retrieve.
:returns: the stored private XML data.
`query_xso` *must* serialize to an empty XML node of the
wanted namespace and type and *must* be registered as private
... | [
"Get",
"the",
"private",
"XML",
"data",
"for",
"the",
"element",
"query_xso",
"from",
"the",
"server",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/private_xml/service.py#L43-L60 |
728 | horazont/aioxmpp | aioxmpp/private_xml/service.py | PrivateXMLService.set_private_xml | def set_private_xml(self, xso):
"""
Store the serialization of `xso` on the server as the private XML
data for the namespace of `xso`.
:param xso: the XSO whose serialization is send as private XML data.
"""
iq = aioxmpp.IQ(
type_=aioxmpp.IQType.SET,
... | python | def set_private_xml(self, xso):
iq = aioxmpp.IQ(
type_=aioxmpp.IQType.SET,
payload=private_xml_xso.Query(xso)
)
yield from self.client.send(iq) | [
"def",
"set_private_xml",
"(",
"self",
",",
"xso",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"IQType",
".",
"SET",
",",
"payload",
"=",
"private_xml_xso",
".",
"Query",
"(",
"xso",
")",
")",
"yield",
"from",
"self"... | Store the serialization of `xso` on the server as the private XML
data for the namespace of `xso`.
:param xso: the XSO whose serialization is send as private XML data. | [
"Store",
"the",
"serialization",
"of",
"xso",
"on",
"the",
"server",
"as",
"the",
"private",
"XML",
"data",
"for",
"the",
"namespace",
"of",
"xso",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/private_xml/service.py#L63-L74 |
729 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient._get_bookmarks | def _get_bookmarks(self):
"""
Get the stored bookmarks from the server.
:returns: a list of bookmarks
"""
res = yield from self._private_xml.get_private_xml(
bookmark_xso.Storage()
)
return res.registered_payload.bookmarks | python | def _get_bookmarks(self):
res = yield from self._private_xml.get_private_xml(
bookmark_xso.Storage()
)
return res.registered_payload.bookmarks | [
"def",
"_get_bookmarks",
"(",
"self",
")",
":",
"res",
"=",
"yield",
"from",
"self",
".",
"_private_xml",
".",
"get_private_xml",
"(",
"bookmark_xso",
".",
"Storage",
"(",
")",
")",
"return",
"res",
".",
"registered_payload",
".",
"bookmarks"
] | Get the stored bookmarks from the server.
:returns: a list of bookmarks | [
"Get",
"the",
"stored",
"bookmarks",
"from",
"the",
"server",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L120-L130 |
730 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient._set_bookmarks | def _set_bookmarks(self, bookmarks):
"""
Set the bookmarks stored on the server.
"""
storage = bookmark_xso.Storage()
storage.bookmarks[:] = bookmarks
yield from self._private_xml.set_private_xml(storage) | python | def _set_bookmarks(self, bookmarks):
storage = bookmark_xso.Storage()
storage.bookmarks[:] = bookmarks
yield from self._private_xml.set_private_xml(storage) | [
"def",
"_set_bookmarks",
"(",
"self",
",",
"bookmarks",
")",
":",
"storage",
"=",
"bookmark_xso",
".",
"Storage",
"(",
")",
"storage",
".",
"bookmarks",
"[",
":",
"]",
"=",
"bookmarks",
"yield",
"from",
"self",
".",
"_private_xml",
".",
"set_private_xml",
... | Set the bookmarks stored on the server. | [
"Set",
"the",
"bookmarks",
"stored",
"on",
"the",
"server",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L133-L139 |
731 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient.get_bookmarks | def get_bookmarks(self):
"""
Get the stored bookmarks from the server. Causes signals to be
fired to reflect the changes.
:returns: a list of bookmarks
"""
with (yield from self._lock):
bookmarks = yield from self._get_bookmarks()
self._diff_emit_... | python | def get_bookmarks(self):
with (yield from self._lock):
bookmarks = yield from self._get_bookmarks()
self._diff_emit_update(bookmarks)
return bookmarks | [
"def",
"get_bookmarks",
"(",
"self",
")",
":",
"with",
"(",
"yield",
"from",
"self",
".",
"_lock",
")",
":",
"bookmarks",
"=",
"yield",
"from",
"self",
".",
"_get_bookmarks",
"(",
")",
"self",
".",
"_diff_emit_update",
"(",
"bookmarks",
")",
"return",
"b... | Get the stored bookmarks from the server. Causes signals to be
fired to reflect the changes.
:returns: a list of bookmarks | [
"Get",
"the",
"stored",
"bookmarks",
"from",
"the",
"server",
".",
"Causes",
"signals",
"to",
"be",
"fired",
"to",
"reflect",
"the",
"changes",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L268-L278 |
732 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient.set_bookmarks | def set_bookmarks(self, bookmarks):
"""
Store the sequence of bookmarks `bookmarks`.
Causes signals to be fired to reflect the changes.
.. note:: This should normally not be used. It does not
mitigate the race condition between clients
concurrently m... | python | def set_bookmarks(self, bookmarks):
with (yield from self._lock):
yield from self._set_bookmarks(bookmarks)
self._diff_emit_update(bookmarks) | [
"def",
"set_bookmarks",
"(",
"self",
",",
"bookmarks",
")",
":",
"with",
"(",
"yield",
"from",
"self",
".",
"_lock",
")",
":",
"yield",
"from",
"self",
".",
"_set_bookmarks",
"(",
"bookmarks",
")",
"self",
".",
"_diff_emit_update",
"(",
"bookmarks",
")"
] | Store the sequence of bookmarks `bookmarks`.
Causes signals to be fired to reflect the changes.
.. note:: This should normally not be used. It does not
mitigate the race condition between clients
concurrently modifying the bookmarks and may lead to
... | [
"Store",
"the",
"sequence",
"of",
"bookmarks",
"bookmarks",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L281-L298 |
733 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient.add_bookmark | def add_bookmark(self, new_bookmark, *, max_retries=3):
"""
Add a bookmark and check whether it was successfully added to the
bookmark list. Already existant bookmarks are not added twice.
:param new_bookmark: the bookmark to add
:type new_bookmark: an instance of :class:`~bookm... | python | def add_bookmark(self, new_bookmark, *, max_retries=3):
with (yield from self._lock):
bookmarks = yield from self._get_bookmarks()
try:
modified_bookmarks = list(bookmarks)
if new_bookmark not in bookmarks:
modified_bookmarks.append(ne... | [
"def",
"add_bookmark",
"(",
"self",
",",
"new_bookmark",
",",
"*",
",",
"max_retries",
"=",
"3",
")",
":",
"with",
"(",
"yield",
"from",
"self",
".",
"_lock",
")",
":",
"bookmarks",
"=",
"yield",
"from",
"self",
".",
"_get_bookmarks",
"(",
")",
"try",
... | Add a bookmark and check whether it was successfully added to the
bookmark list. Already existant bookmarks are not added twice.
:param new_bookmark: the bookmark to add
:type new_bookmark: an instance of :class:`~bookmark_xso.Bookmark`
:param max_retries: the number of retries if setti... | [
"Add",
"a",
"bookmark",
"and",
"check",
"whether",
"it",
"was",
"successfully",
"added",
"to",
"the",
"bookmark",
"list",
".",
"Already",
"existant",
"bookmarks",
"are",
"not",
"added",
"twice",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L312-L356 |
734 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient.discard_bookmark | def discard_bookmark(self, bookmark_to_remove, *, max_retries=3):
"""
Remove a bookmark and check it has been removed.
:param bookmark_to_remove: the bookmark to remove
:type bookmark_to_remove: a :class:`~bookmark_xso.Bookmark` subclass.
:param max_retries: the number of retrie... | python | def discard_bookmark(self, bookmark_to_remove, *, max_retries=3):
with (yield from self._lock):
bookmarks = yield from self._get_bookmarks()
occurences = bookmarks.count(bookmark_to_remove)
try:
if not occurences:
return
m... | [
"def",
"discard_bookmark",
"(",
"self",
",",
"bookmark_to_remove",
",",
"*",
",",
"max_retries",
"=",
"3",
")",
":",
"with",
"(",
"yield",
"from",
"self",
".",
"_lock",
")",
":",
"bookmarks",
"=",
"yield",
"from",
"self",
".",
"_get_bookmarks",
"(",
")",... | Remove a bookmark and check it has been removed.
:param bookmark_to_remove: the bookmark to remove
:type bookmark_to_remove: a :class:`~bookmark_xso.Bookmark` subclass.
:param max_retries: the number of retries of removing the bookmark
fails.
:type max_retrie... | [
"Remove",
"a",
"bookmark",
"and",
"check",
"it",
"has",
"been",
"removed",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L359-L413 |
735 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient.update_bookmark | def update_bookmark(self, old, new, *, max_retries=3):
"""
Update a bookmark and check it was successful.
The bookmark matches an existing bookmark `old` according to
bookmark equalitiy and replaces it by `new`. The bookmark
`new` is added if no bookmark matching `old` exists.
... | python | def update_bookmark(self, old, new, *, max_retries=3):
def replace_bookmark(bookmarks, old, new):
modified_bookmarks = list(bookmarks)
try:
i = bookmarks.index(old)
modified_bookmarks[i] = new
except ValueError:
modified_bookmar... | [
"def",
"update_bookmark",
"(",
"self",
",",
"old",
",",
"new",
",",
"*",
",",
"max_retries",
"=",
"3",
")",
":",
"def",
"replace_bookmark",
"(",
"bookmarks",
",",
"old",
",",
"new",
")",
":",
"modified_bookmarks",
"=",
"list",
"(",
"bookmarks",
")",
"t... | Update a bookmark and check it was successful.
The bookmark matches an existing bookmark `old` according to
bookmark equalitiy and replaces it by `new`. The bookmark
`new` is added if no bookmark matching `old` exists.
:param old: the bookmark to replace
:type bookmark_to_remov... | [
"Update",
"a",
"bookmark",
"and",
"check",
"it",
"was",
"successful",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L416-L479 |
736 | horazont/aioxmpp | aioxmpp/disco/service.py | Node.iter_identities | def iter_identities(self, stanza=None):
"""
Return an iterator of tuples describing the identities of the node.
:param stanza: The IQ request stanza
:type stanza: :class:`~aioxmpp.IQ` or :data:`None`
:rtype: iterable of (:class:`str`, :class:`str`, :class:`str` or
:d... | python | def iter_identities(self, stanza=None):
for (category, type_), names in self._identities.items():
for lang, name in names.items():
yield category, type_, lang, name
if not names:
yield category, type_, None, None | [
"def",
"iter_identities",
"(",
"self",
",",
"stanza",
"=",
"None",
")",
":",
"for",
"(",
"category",
",",
"type_",
")",
",",
"names",
"in",
"self",
".",
"_identities",
".",
"items",
"(",
")",
":",
"for",
"lang",
",",
"name",
"in",
"names",
".",
"it... | Return an iterator of tuples describing the identities of the node.
:param stanza: The IQ request stanza
:type stanza: :class:`~aioxmpp.IQ` or :data:`None`
:rtype: iterable of (:class:`str`, :class:`str`, :class:`str` or
:data:`None`, :class:`str` or :data:`None`) tuples
:re... | [
"Return",
"an",
"iterator",
"of",
"tuples",
"describing",
"the",
"identities",
"of",
"the",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L98-L133 |
737 | horazont/aioxmpp | aioxmpp/disco/service.py | Node.iter_features | def iter_features(self, stanza=None):
"""
Return an iterator which yields the features of the node.
:param stanza: The IQ request stanza
:type stanza: :class:`~aioxmpp.IQ`
:rtype: iterable of :class:`str`
:return: :xep:`30` features of this node
`stanza` is the ... | python | def iter_features(self, stanza=None):
return itertools.chain(
iter(self.STATIC_FEATURES),
iter(self._features)
) | [
"def",
"iter_features",
"(",
"self",
",",
"stanza",
"=",
"None",
")",
":",
"return",
"itertools",
".",
"chain",
"(",
"iter",
"(",
"self",
".",
"STATIC_FEATURES",
")",
",",
"iter",
"(",
"self",
".",
"_features",
")",
")"
] | Return an iterator which yields the features of the node.
:param stanza: The IQ request stanza
:type stanza: :class:`~aioxmpp.IQ`
:rtype: iterable of :class:`str`
:return: :xep:`30` features of this node
`stanza` is the :class:`aioxmpp.IQ` stanza of the request. This can be
... | [
"Return",
"an",
"iterator",
"which",
"yields",
"the",
"features",
"of",
"the",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L135-L163 |
738 | horazont/aioxmpp | aioxmpp/disco/service.py | Node.register_feature | def register_feature(self, var):
"""
Register a feature with the namespace variable `var`.
If the feature is already registered or part of the default :xep:`30`
features, a :class:`ValueError` is raised.
"""
if var in self._features or var in self.STATIC_FEATURES:
... | python | def register_feature(self, var):
if var in self._features or var in self.STATIC_FEATURES:
raise ValueError("feature already claimed: {!r}".format(var))
self._features.add(var)
self.on_info_changed() | [
"def",
"register_feature",
"(",
"self",
",",
"var",
")",
":",
"if",
"var",
"in",
"self",
".",
"_features",
"or",
"var",
"in",
"self",
".",
"STATIC_FEATURES",
":",
"raise",
"ValueError",
"(",
"\"feature already claimed: {!r}\"",
".",
"format",
"(",
"var",
")"... | Register a feature with the namespace variable `var`.
If the feature is already registered or part of the default :xep:`30`
features, a :class:`ValueError` is raised. | [
"Register",
"a",
"feature",
"with",
"the",
"namespace",
"variable",
"var",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L192-L202 |
739 | horazont/aioxmpp | aioxmpp/disco/service.py | Node.register_identity | def register_identity(self, category, type_, *, names={}):
"""
Register an identity with the given `category` and `type_`.
If there is already a registered identity with the same `category` and
`type_`, :class:`ValueError` is raised.
`names` may be a mapping which maps :class:`... | python | def register_identity(self, category, type_, *, names={}):
key = category, type_
if key in self._identities:
raise ValueError("identity already claimed: {!r}".format(key))
self._identities[key] = names
self.on_info_changed() | [
"def",
"register_identity",
"(",
"self",
",",
"category",
",",
"type_",
",",
"*",
",",
"names",
"=",
"{",
"}",
")",
":",
"key",
"=",
"category",
",",
"type_",
"if",
"key",
"in",
"self",
".",
"_identities",
":",
"raise",
"ValueError",
"(",
"\"identity a... | Register an identity with the given `category` and `type_`.
If there is already a registered identity with the same `category` and
`type_`, :class:`ValueError` is raised.
`names` may be a mapping which maps :class:`.structs.LanguageTag`
instances to strings. This mapping will be used t... | [
"Register",
"an",
"identity",
"with",
"the",
"given",
"category",
"and",
"type_",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L204-L220 |
740 | horazont/aioxmpp | aioxmpp/disco/service.py | DiscoClient.query_info | def query_info(self, jid, *,
node=None, require_fresh=False, timeout=None,
no_cache=False):
"""
Query the features and identities of the specified entity.
:param jid: The entity to query.
:type jid: :class:`aioxmpp.JID`
:param node: The node... | python | def query_info(self, jid, *,
node=None, require_fresh=False, timeout=None,
no_cache=False):
key = jid, node
if not require_fresh:
try:
request = self._info_pending[key]
except KeyError:
pass
else:
... | [
"def",
"query_info",
"(",
"self",
",",
"jid",
",",
"*",
",",
"node",
"=",
"None",
",",
"require_fresh",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"no_cache",
"=",
"False",
")",
":",
"key",
"=",
"jid",
",",
"node",
"if",
"not",
"require_fresh",
... | Query the features and identities of the specified entity.
:param jid: The entity to query.
:type jid: :class:`aioxmpp.JID`
:param node: The node to query.
:type node: :class:`str` or :data:`None`
:param require_fresh: Boolean flag to discard previous caches.
:type requi... | [
"Query",
"the",
"features",
"and",
"identities",
"of",
"the",
"specified",
"entity",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L644-L746 |
741 | horazont/aioxmpp | aioxmpp/disco/service.py | DiscoClient.query_items | def query_items(self, jid, *,
node=None, require_fresh=False, timeout=None):
"""
Query the items of the specified entity.
:param jid: The entity to query.
:type jid: :class:`aioxmpp.JID`
:param node: The node to query.
:type node: :class:`str` or :dat... | python | def query_items(self, jid, *,
node=None, require_fresh=False, timeout=None):
key = jid, node
if not require_fresh:
try:
request = self._items_pending[key]
except KeyError:
pass
else:
try:
... | [
"def",
"query_items",
"(",
"self",
",",
"jid",
",",
"*",
",",
"node",
"=",
"None",
",",
"require_fresh",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"key",
"=",
"jid",
",",
"node",
"if",
"not",
"require_fresh",
":",
"try",
":",
"request",
... | Query the items of the specified entity.
:param jid: The entity to query.
:type jid: :class:`aioxmpp.JID`
:param node: The node to query.
:type node: :class:`str` or :data:`None`
:param require_fresh: Boolean flag to discard previous caches.
:type require_fresh: :class:`... | [
"Query",
"the",
"items",
"of",
"the",
"specified",
"entity",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/disco/service.py#L749-L810 |
742 | horazont/aioxmpp | aioxmpp/roster/service.py | RosterClient.export_as_json | def export_as_json(self):
"""
Export the whole roster as currently stored on the client side into a
JSON-compatible dictionary and return that dictionary.
"""
return {
"items": {
str(jid): item.export_as_json()
for jid, item in self.ite... | python | def export_as_json(self):
return {
"items": {
str(jid): item.export_as_json()
for jid, item in self.items.items()
},
"ver": self.version
} | [
"def",
"export_as_json",
"(",
"self",
")",
":",
"return",
"{",
"\"items\"",
":",
"{",
"str",
"(",
"jid",
")",
":",
"item",
".",
"export_as_json",
"(",
")",
"for",
"jid",
",",
"item",
"in",
"self",
".",
"items",
".",
"items",
"(",
")",
"}",
",",
"... | Export the whole roster as currently stored on the client side into a
JSON-compatible dictionary and return that dictionary. | [
"Export",
"the",
"whole",
"roster",
"as",
"currently",
"stored",
"on",
"the",
"client",
"side",
"into",
"a",
"JSON",
"-",
"compatible",
"dictionary",
"and",
"return",
"that",
"dictionary",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/roster/service.py#L574-L585 |
743 | horazont/aioxmpp | aioxmpp/roster/service.py | RosterClient.set_entry | def set_entry(self, jid, *,
name=_Sentinel,
add_to_groups=frozenset(),
remove_from_groups=frozenset(),
timeout=None):
"""
Set properties of a roster entry or add a new roster entry. The roster
entry is identified by its bare... | python | def set_entry(self, jid, *,
name=_Sentinel,
add_to_groups=frozenset(),
remove_from_groups=frozenset(),
timeout=None):
existing = self.items.get(jid, Item(jid))
post_groups = (existing.groups | add_to_groups) - remove_from_groups
... | [
"def",
"set_entry",
"(",
"self",
",",
"jid",
",",
"*",
",",
"name",
"=",
"_Sentinel",
",",
"add_to_groups",
"=",
"frozenset",
"(",
")",
",",
"remove_from_groups",
"=",
"frozenset",
"(",
")",
",",
"timeout",
"=",
"None",
")",
":",
"existing",
"=",
"self... | Set properties of a roster entry or add a new roster entry. The roster
entry is identified by its bare `jid`.
If an entry already exists, all values default to those stored in the
existing entry. For example, if no `name` is given, the current name of
the entry is re-used, if any.
... | [
"Set",
"properties",
"of",
"a",
"roster",
"entry",
"or",
"add",
"a",
"new",
"roster",
"entry",
".",
"The",
"roster",
"entry",
"is",
"identified",
"by",
"its",
"bare",
"jid",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/roster/service.py#L612-L668 |
744 | horazont/aioxmpp | aioxmpp/roster/service.py | RosterClient.remove_entry | def remove_entry(self, jid, *, timeout=None):
"""
Request removal of the roster entry identified by the given bare
`jid`. If the entry currently has any subscription state, the server
will send the corresponding unsubscribing presence stanzas.
`timeout` is the maximum time in se... | python | def remove_entry(self, jid, *, timeout=None):
yield from self.client.send(
stanza.IQ(
structs.IQType.SET,
payload=roster_xso.Query(items=[
roster_xso.Item(
jid=jid,
subscription="remove"
... | [
"def",
"remove_entry",
"(",
"self",
",",
"jid",
",",
"*",
",",
"timeout",
"=",
"None",
")",
":",
"yield",
"from",
"self",
".",
"client",
".",
"send",
"(",
"stanza",
".",
"IQ",
"(",
"structs",
".",
"IQType",
".",
"SET",
",",
"payload",
"=",
"roster_... | Request removal of the roster entry identified by the given bare
`jid`. If the entry currently has any subscription state, the server
will send the corresponding unsubscribing presence stanzas.
`timeout` is the maximum time in seconds to wait for a reply from the
server.
This m... | [
"Request",
"removal",
"of",
"the",
"roster",
"entry",
"identified",
"by",
"the",
"given",
"bare",
"jid",
".",
"If",
"the",
"entry",
"currently",
"has",
"any",
"subscription",
"state",
"the",
"server",
"will",
"send",
"the",
"corresponding",
"unsubscribing",
"p... | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/roster/service.py#L671-L695 |
745 | horazont/aioxmpp | aioxmpp/roster/service.py | RosterClient.subscribe | def subscribe(self, peer_jid):
"""
Request presence subscription with the given `peer_jid`.
This is deliberately not a coroutine; we don’t know whether the peer is
online (usually) and they may defer the confirmation very long, if they
confirm at all. Use :meth:`on_subscribed` t... | python | def subscribe(self, peer_jid):
self.client.enqueue(
stanza.Presence(type_=structs.PresenceType.SUBSCRIBE,
to=peer_jid)
) | [
"def",
"subscribe",
"(",
"self",
",",
"peer_jid",
")",
":",
"self",
".",
"client",
".",
"enqueue",
"(",
"stanza",
".",
"Presence",
"(",
"type_",
"=",
"structs",
".",
"PresenceType",
".",
"SUBSCRIBE",
",",
"to",
"=",
"peer_jid",
")",
")"
] | Request presence subscription with the given `peer_jid`.
This is deliberately not a coroutine; we don’t know whether the peer is
online (usually) and they may defer the confirmation very long, if they
confirm at all. Use :meth:`on_subscribed` to get notified when a peer
accepted a subsc... | [
"Request",
"presence",
"subscription",
"with",
"the",
"given",
"peer_jid",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/roster/service.py#L721-L733 |
746 | horazont/aioxmpp | aioxmpp/roster/service.py | RosterClient.unsubscribe | def unsubscribe(self, peer_jid):
"""
Unsubscribe from the presence of the given `peer_jid`.
"""
self.client.enqueue(
stanza.Presence(type_=structs.PresenceType.UNSUBSCRIBE,
to=peer_jid)
) | python | def unsubscribe(self, peer_jid):
self.client.enqueue(
stanza.Presence(type_=structs.PresenceType.UNSUBSCRIBE,
to=peer_jid)
) | [
"def",
"unsubscribe",
"(",
"self",
",",
"peer_jid",
")",
":",
"self",
".",
"client",
".",
"enqueue",
"(",
"stanza",
".",
"Presence",
"(",
"type_",
"=",
"structs",
".",
"PresenceType",
".",
"UNSUBSCRIBE",
",",
"to",
"=",
"peer_jid",
")",
")"
] | Unsubscribe from the presence of the given `peer_jid`. | [
"Unsubscribe",
"from",
"the",
"presence",
"of",
"the",
"given",
"peer_jid",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/roster/service.py#L735-L742 |
747 | horazont/aioxmpp | aioxmpp/dispatcher.py | message_handler | def message_handler(type_, from_):
"""
Register the decorated function as message handler.
:param type_: Message type to listen for
:type type_: :class:`~.MessageType`
:param from_: Sender JIDs to listen for
:type from_: :class:`aioxmpp.JID` or :data:`None`
:raise TypeError: if the decorate... | python | def message_handler(type_, from_):
def decorator(f):
if asyncio.iscoroutinefunction(f):
raise TypeError("message_handler must not be a coroutine function")
aioxmpp.service.add_handler_spec(
f,
aioxmpp.service.HandlerSpec(
(_apply_message_handler, ... | [
"def",
"message_handler",
"(",
"type_",
",",
"from_",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"if",
"asyncio",
".",
"iscoroutinefunction",
"(",
"f",
")",
":",
"raise",
"TypeError",
"(",
"\"message_handler must not be a coroutine function\"",
")",
"aiox... | Register the decorated function as message handler.
:param type_: Message type to listen for
:type type_: :class:`~.MessageType`
:param from_: Sender JIDs to listen for
:type from_: :class:`aioxmpp.JID` or :data:`None`
:raise TypeError: if the decorated object is a coroutine function
.. seeals... | [
"Register",
"the",
"decorated",
"function",
"as",
"message",
"handler",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/dispatcher.py#L338-L373 |
748 | horazont/aioxmpp | aioxmpp/dispatcher.py | presence_handler | def presence_handler(type_, from_):
"""
Register the decorated function as presence stanza handler.
:param type_: Presence type to listen for
:type type_: :class:`~.PresenceType`
:param from_: Sender JIDs to listen for
:type from_: :class:`aioxmpp.JID` or :data:`None`
:raise TypeError: if t... | python | def presence_handler(type_, from_):
def decorator(f):
if asyncio.iscoroutinefunction(f):
raise TypeError(
"presence_handler must not be a coroutine function"
)
aioxmpp.service.add_handler_spec(
f,
aioxmpp.service.HandlerSpec(
... | [
"def",
"presence_handler",
"(",
"type_",
",",
"from_",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"if",
"asyncio",
".",
"iscoroutinefunction",
"(",
"f",
")",
":",
"raise",
"TypeError",
"(",
"\"presence_handler must not be a coroutine function\"",
")",
"ai... | Register the decorated function as presence stanza handler.
:param type_: Presence type to listen for
:type type_: :class:`~.PresenceType`
:param from_: Sender JIDs to listen for
:type from_: :class:`aioxmpp.JID` or :data:`None`
:raise TypeError: if the decorated object is a coroutine function
... | [
"Register",
"the",
"decorated",
"function",
"as",
"presence",
"stanza",
"handler",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/dispatcher.py#L376-L413 |
749 | horazont/aioxmpp | aioxmpp/dispatcher.py | SimpleStanzaDispatcher._feed | def _feed(self, stanza):
"""
Dispatch the given `stanza`.
:param stanza: Stanza to dispatch
:type stanza: :class:`~.StanzaBase`
:rtype: :class:`bool`
:return: true if the stanza was dispatched, false otherwise.
Dispatch the stanza to up to one handler registered... | python | def _feed(self, stanza):
from_ = stanza.from_
if from_ is None:
from_ = self.local_jid
keys = [
(stanza.type_, from_, False),
(stanza.type_, from_.bare(), True),
(None, from_, False),
(None, from_.bare(), True),
(stanza.typ... | [
"def",
"_feed",
"(",
"self",
",",
"stanza",
")",
":",
"from_",
"=",
"stanza",
".",
"from_",
"if",
"from_",
"is",
"None",
":",
"from_",
"=",
"self",
".",
"local_jid",
"keys",
"=",
"[",
"(",
"stanza",
".",
"type_",
",",
"from_",
",",
"False",
")",
... | Dispatch the given `stanza`.
:param stanza: Stanza to dispatch
:type stanza: :class:`~.StanzaBase`
:rtype: :class:`bool`
:return: true if the stanza was dispatched, false otherwise.
Dispatch the stanza to up to one handler registered on the dispatcher.
If no handler is ... | [
"Dispatch",
"the",
"given",
"stanza",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/dispatcher.py#L103-L136 |
750 | horazont/aioxmpp | aioxmpp/dispatcher.py | SimpleStanzaDispatcher.register_callback | def register_callback(self, type_, from_, cb, *,
wildcard_resource=True):
"""
Register a callback function.
:param type_: Stanza type to listen for, or :data:`None` for a
wildcard match.
:param from_: Sender to listen for, or :data:`None` ... | python | def register_callback(self, type_, from_, cb, *,
wildcard_resource=True):
# NOQA: E501
if from_ is None or not from_.is_bare:
wildcard_resource = False
key = (type_, from_, wildcard_resource)
if key in self._map:
raise ValueError(
... | [
"def",
"register_callback",
"(",
"self",
",",
"type_",
",",
"from_",
",",
"cb",
",",
"*",
",",
"wildcard_resource",
"=",
"True",
")",
":",
"# NOQA: E501",
"if",
"from_",
"is",
"None",
"or",
"not",
"from_",
".",
"is_bare",
":",
"wildcard_resource",
"=",
"... | Register a callback function.
:param type_: Stanza type to listen for, or :data:`None` for a
wildcard match.
:param from_: Sender to listen for, or :data:`None` for a full wildcard
match.
:type from_: :class:`aioxmpp.JID` or :data:`None`
:para... | [
"Register",
"a",
"callback",
"function",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/dispatcher.py#L138-L211 |
751 | horazont/aioxmpp | aioxmpp/dispatcher.py | SimpleStanzaDispatcher.unregister_callback | def unregister_callback(self, type_, from_, *,
wildcard_resource=True):
"""
Unregister a callback function.
:param type_: Stanza type to listen for, or :data:`None` for a
wildcard match.
:param from_: Sender to listen for, or :data:`None... | python | def unregister_callback(self, type_, from_, *,
wildcard_resource=True):
if from_ is None or not from_.is_bare:
wildcard_resource = False
self._map.pop((type_, from_, wildcard_resource)) | [
"def",
"unregister_callback",
"(",
"self",
",",
"type_",
",",
"from_",
",",
"*",
",",
"wildcard_resource",
"=",
"True",
")",
":",
"if",
"from_",
"is",
"None",
"or",
"not",
"from_",
".",
"is_bare",
":",
"wildcard_resource",
"=",
"False",
"self",
".",
"_ma... | Unregister a callback function.
:param type_: Stanza type to listen for, or :data:`None` for a
wildcard match.
:param from_: Sender to listen for, or :data:`None` for a full wildcard
match.
:type from_: :class:`aioxmpp.JID` or :data:`None`
:pa... | [
"Unregister",
"a",
"callback",
"function",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/dispatcher.py#L213-L233 |
752 | horazont/aioxmpp | aioxmpp/dispatcher.py | SimpleStanzaDispatcher.handler_context | def handler_context(self, type_, from_, cb, *, wildcard_resource=True):
"""
Context manager which temporarily registers a callback.
The arguments are the same as for :meth:`register_callback`.
When the context is entered, the callback `cb` is registered. When the
context is exi... | python | def handler_context(self, type_, from_, cb, *, wildcard_resource=True):
self.register_callback(
type_, from_, cb,
wildcard_resource=wildcard_resource
)
try:
yield
finally:
self.unregister_callback(
type_, from_,
... | [
"def",
"handler_context",
"(",
"self",
",",
"type_",
",",
"from_",
",",
"cb",
",",
"*",
",",
"wildcard_resource",
"=",
"True",
")",
":",
"self",
".",
"register_callback",
"(",
"type_",
",",
"from_",
",",
"cb",
",",
"wildcard_resource",
"=",
"wildcard_resou... | Context manager which temporarily registers a callback.
The arguments are the same as for :meth:`register_callback`.
When the context is entered, the callback `cb` is registered. When the
context is exited, no matter if an exception is raised or not, the
callback is unregistered. | [
"Context",
"manager",
"which",
"temporarily",
"registers",
"a",
"callback",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/dispatcher.py#L236-L256 |
753 | horazont/aioxmpp | aioxmpp/forms/fields.py | BoundField.load | def load(self, field_xso):
"""
Load the field information from a data field.
:param field_xso: XSO describing the field.
:type field_xso: :class:`~.Field`
This loads the current value, description, label and possibly options
from the `field_xso`, shadowing the informati... | python | def load(self, field_xso):
if field_xso.desc:
self._desc = field_xso.desc
if field_xso.label:
self._label = field_xso.label
self._required = field_xso.required | [
"def",
"load",
"(",
"self",
",",
"field_xso",
")",
":",
"if",
"field_xso",
".",
"desc",
":",
"self",
".",
"_desc",
"=",
"field_xso",
".",
"desc",
"if",
"field_xso",
".",
"label",
":",
"self",
".",
"_label",
"=",
"field_xso",
".",
"label",
"self",
"."... | Load the field information from a data field.
:param field_xso: XSO describing the field.
:type field_xso: :class:`~.Field`
This loads the current value, description, label and possibly options
from the `field_xso`, shadowing the information from the declaration of
the field on... | [
"Load",
"the",
"field",
"information",
"from",
"a",
"data",
"field",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/fields.py#L208-L232 |
754 | horazont/aioxmpp | aioxmpp/forms/fields.py | BoundMultiValueField.value | def value(self):
"""
A tuple of values. This attribute can be set with any iterable; the
iterable is then evaluated into a tuple and stored at the bound field.
Whenever values are written to this attribute, they are passed through
the :meth:`~.AbstractCDataType.coerce` method of... | python | def value(self):
try:
return self._value
except AttributeError:
self.value = self._field.default()
return self._value | [
"def",
"value",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_value",
"except",
"AttributeError",
":",
"self",
".",
"value",
"=",
"self",
".",
"_field",
".",
"default",
"(",
")",
"return",
"self",
".",
"_value"
] | A tuple of values. This attribute can be set with any iterable; the
iterable is then evaluated into a tuple and stored at the bound field.
Whenever values are written to this attribute, they are passed through
the :meth:`~.AbstractCDataType.coerce` method of the
:attr:`~.AbstractField.t... | [
"A",
"tuple",
"of",
"values",
".",
"This",
"attribute",
"can",
"be",
"set",
"with",
"any",
"iterable",
";",
"the",
"iterable",
"is",
"then",
"evaluated",
"into",
"a",
"tuple",
"and",
"stored",
"at",
"the",
"bound",
"field",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/fields.py#L384-L398 |
755 | horazont/aioxmpp | aioxmpp/xml.py | write_single_xso | def write_single_xso(x, dest):
"""
Write a single XSO `x` to a binary file-like object `dest`.
"""
gen = XMPPXMLGenerator(dest,
short_empty_elements=True,
sorted_attributes=True)
x.unparse_to_sax(gen) | python | def write_single_xso(x, dest):
gen = XMPPXMLGenerator(dest,
short_empty_elements=True,
sorted_attributes=True)
x.unparse_to_sax(gen) | [
"def",
"write_single_xso",
"(",
"x",
",",
"dest",
")",
":",
"gen",
"=",
"XMPPXMLGenerator",
"(",
"dest",
",",
"short_empty_elements",
"=",
"True",
",",
"sorted_attributes",
"=",
"True",
")",
"x",
".",
"unparse_to_sax",
"(",
"gen",
")"
] | Write a single XSO `x` to a binary file-like object `dest`. | [
"Write",
"a",
"single",
"XSO",
"x",
"to",
"a",
"binary",
"file",
"-",
"like",
"object",
"dest",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xml.py#L1112-L1119 |
756 | horazont/aioxmpp | aioxmpp/xml.py | read_xso | def read_xso(src, xsomap):
"""
Read a single XSO from a binary file-like input `src` containing an XML
document.
`xsomap` must be a mapping which maps :class:`~.XSO` subclasses
to callables. These will be registered at a newly created
:class:`.xso.XSOParser` instance which will be used to parse... | python | def read_xso(src, xsomap):
xso_parser = xso.XSOParser()
for class_, cb in xsomap.items():
xso_parser.add_class(class_, cb)
driver = xso.SAXDriver(xso_parser)
parser = xml.sax.make_parser()
parser.setFeature(
xml.sax.handler.feature_namespaces,
True)
parser.setFeature(
... | [
"def",
"read_xso",
"(",
"src",
",",
"xsomap",
")",
":",
"xso_parser",
"=",
"xso",
".",
"XSOParser",
"(",
")",
"for",
"class_",
",",
"cb",
"in",
"xsomap",
".",
"items",
"(",
")",
":",
"xso_parser",
".",
"add_class",
"(",
"class_",
",",
"cb",
")",
"d... | Read a single XSO from a binary file-like input `src` containing an XML
document.
`xsomap` must be a mapping which maps :class:`~.XSO` subclasses
to callables. These will be registered at a newly created
:class:`.xso.XSOParser` instance which will be used to parse the document
in `src`.
The `... | [
"Read",
"a",
"single",
"XSO",
"from",
"a",
"binary",
"file",
"-",
"like",
"input",
"src",
"containing",
"an",
"XML",
"document",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xml.py#L1122-L1152 |
757 | horazont/aioxmpp | aioxmpp/xml.py | XMPPXMLGenerator.startPrefixMapping | def startPrefixMapping(self, prefix, uri, *, auto=False):
"""
Start a prefix mapping which maps the given `prefix` to the given
`uri`.
Note that prefix mappings are handled transactional. All announcements
of prefix mappings are collected until the next call to
:meth:`st... | python | def startPrefixMapping(self, prefix, uri, *, auto=False):
if (prefix is not None and
(prefix == "xml" or
prefix == "xmlns" or
not xmlValidateNameValue_str(prefix) or
":" in prefix)):
raise ValueError("not a valid prefix: {!r}".fo... | [
"def",
"startPrefixMapping",
"(",
"self",
",",
"prefix",
",",
"uri",
",",
"*",
",",
"auto",
"=",
"False",
")",
":",
"if",
"(",
"prefix",
"is",
"not",
"None",
"and",
"(",
"prefix",
"==",
"\"xml\"",
"or",
"prefix",
"==",
"\"xmlns\"",
"or",
"not",
"xmlV... | Start a prefix mapping which maps the given `prefix` to the given
`uri`.
Note that prefix mappings are handled transactional. All announcements
of prefix mappings are collected until the next call to
:meth:`startElementNS`. At that point, the mappings are collected and
start to ... | [
"Start",
"a",
"prefix",
"mapping",
"which",
"maps",
"the",
"given",
"prefix",
"to",
"the",
"given",
"uri",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xml.py#L348-L388 |
758 | horazont/aioxmpp | aioxmpp/xml.py | XMPPXMLGenerator.buffer | def buffer(self):
"""
Context manager to temporarily buffer the output.
:raise RuntimeError: If two :meth:`buffer` context managers are used
nestedly.
If the context manager is left without exception, the buffered output
is sent to the actual sink. ... | python | def buffer(self):
if self._buf_in_use:
raise RuntimeError("nested use of buffer() is not supported")
self._buf_in_use = True
old_write = self._write
old_flush = self._flush
if self._buf is None:
self._buf = io.BytesIO()
else:
try:
... | [
"def",
"buffer",
"(",
"self",
")",
":",
"if",
"self",
".",
"_buf_in_use",
":",
"raise",
"RuntimeError",
"(",
"\"nested use of buffer() is not supported\"",
")",
"self",
".",
"_buf_in_use",
"=",
"True",
"old_write",
"=",
"self",
".",
"_write",
"old_flush",
"=",
... | Context manager to temporarily buffer the output.
:raise RuntimeError: If two :meth:`buffer` context managers are used
nestedly.
If the context manager is left without exception, the buffered output
is sent to the actual sink. Otherwise, it is discarded.
I... | [
"Context",
"manager",
"to",
"temporarily",
"buffer",
"the",
"output",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xml.py#L594-L644 |
759 | horazont/aioxmpp | aioxmpp/xml.py | XMLStreamWriter.start | def start(self):
"""
Send the stream header as described above.
"""
attrs = {
(None, "to"): str(self._to),
(None, "version"): ".".join(map(str, self._version))
}
if self._from:
attrs[None, "from"] = str(self._from)
self._writer... | python | def start(self):
attrs = {
(None, "to"): str(self._to),
(None, "version"): ".".join(map(str, self._version))
}
if self._from:
attrs[None, "from"] = str(self._from)
self._writer.startDocument()
for prefix, uri in self._nsmap_to_use.items():
... | [
"def",
"start",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"(",
"None",
",",
"\"to\"",
")",
":",
"str",
"(",
"self",
".",
"_to",
")",
",",
"(",
"None",
",",
"\"version\"",
")",
":",
"\".\"",
".",
"join",
"(",
"map",
"(",
"str",
",",
"self",
".... | Send the stream header as described above. | [
"Send",
"the",
"stream",
"header",
"as",
"described",
"above",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xml.py#L718-L736 |
760 | horazont/aioxmpp | aioxmpp/xml.py | XMLStreamWriter.send | def send(self, xso):
"""
Send a single XML stream object.
:param xso: Object to serialise and send.
:type xso: :class:`aioxmpp.xso.XSO`
:raises Exception: from any serialisation errors, usually
:class:`ValueError`.
Serialise the `xso` and send... | python | def send(self, xso):
with self._writer.buffer():
xso.unparse_to_sax(self._writer) | [
"def",
"send",
"(",
"self",
",",
"xso",
")",
":",
"with",
"self",
".",
"_writer",
".",
"buffer",
"(",
")",
":",
"xso",
".",
"unparse_to_sax",
"(",
"self",
".",
"_writer",
")"
] | Send a single XML stream object.
:param xso: Object to serialise and send.
:type xso: :class:`aioxmpp.xso.XSO`
:raises Exception: from any serialisation errors, usually
:class:`ValueError`.
Serialise the `xso` and send it over the stream. If any serialisation... | [
"Send",
"a",
"single",
"XML",
"stream",
"object",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xml.py#L738-L759 |
761 | horazont/aioxmpp | aioxmpp/xml.py | XMLStreamWriter.abort | def abort(self):
"""
Abort the stream.
The stream is flushed and the internal data structures are cleaned up.
No stream footer is sent. The stream is :attr:`closed` afterwards.
If the stream is already :attr:`closed`, this method does nothing.
"""
if self._close... | python | def abort(self):
if self._closed:
return
self._closed = True
self._writer.flush()
del self._writer | [
"def",
"abort",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"return",
"self",
".",
"_closed",
"=",
"True",
"self",
".",
"_writer",
".",
"flush",
"(",
")",
"del",
"self",
".",
"_writer"
] | Abort the stream.
The stream is flushed and the internal data structures are cleaned up.
No stream footer is sent. The stream is :attr:`closed` afterwards.
If the stream is already :attr:`closed`, this method does nothing. | [
"Abort",
"the",
"stream",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xml.py#L761-L774 |
762 | horazont/aioxmpp | aioxmpp/rsm/xso.py | ResultSetMetadata.fetch_page | def fetch_page(cls, index, max_=None):
"""
Return a query set which requests a specific page.
:param index: Index of the first element of the page to fetch.
:type index: :class:`int`
:param max_: Maximum number of elements to fetch
:type max_: :class:`int` or :data:`None... | python | def fetch_page(cls, index, max_=None):
result = cls()
result.index = index
result.max_ = max_
return result | [
"def",
"fetch_page",
"(",
"cls",
",",
"index",
",",
"max_",
"=",
"None",
")",
":",
"result",
"=",
"cls",
"(",
")",
"result",
".",
"index",
"=",
"index",
"result",
".",
"max_",
"=",
"max_",
"return",
"result"
] | Return a query set which requests a specific page.
:param index: Index of the first element of the page to fetch.
:type index: :class:`int`
:param max_: Maximum number of elements to fetch
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:retur... | [
"Return",
"a",
"query",
"set",
"which",
"requests",
"a",
"specific",
"page",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/rsm/xso.py#L193-L214 |
763 | horazont/aioxmpp | aioxmpp/rsm/xso.py | ResultSetMetadata.limit | def limit(self, max_):
"""
Limit the result set to a given number of items.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request at most `max_` items.
... | python | def limit(self, max_):
if isinstance(self, type):
result = self()
else:
result = copy.deepcopy(self)
result.max_ = max_
return result | [
"def",
"limit",
"(",
"self",
",",
"max_",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"type",
")",
":",
"result",
"=",
"self",
"(",
")",
"else",
":",
"result",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"result",
".",
"max_",
"=",
"max_"... | Limit the result set to a given number of items.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request at most `max_` items.
This method can be called on the class and... | [
"Limit",
"the",
"result",
"set",
"to",
"a",
"given",
"number",
"of",
"items",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/rsm/xso.py#L217-L237 |
764 | horazont/aioxmpp | aioxmpp/rsm/xso.py | ResultSetMetadata.next_page | def next_page(self, max_=None):
"""
Return a query set which requests the page after this response.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request the ne... | python | def next_page(self, max_=None):
result = type(self)()
result.after = After(self.last.value)
result.max_ = max_
return result | [
"def",
"next_page",
"(",
"self",
",",
"max_",
"=",
"None",
")",
":",
"result",
"=",
"type",
"(",
"self",
")",
"(",
")",
"result",
".",
"after",
"=",
"After",
"(",
"self",
".",
"last",
".",
"value",
")",
"result",
".",
"max_",
"=",
"max_",
"return... | Return a query set which requests the page after this response.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request the next page.
Must be called on a result set whi... | [
"Return",
"a",
"query",
"set",
"which",
"requests",
"the",
"page",
"after",
"this",
"response",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/rsm/xso.py#L239-L254 |
765 | horazont/aioxmpp | aioxmpp/rsm/xso.py | ResultSetMetadata.previous_page | def previous_page(self, max_=None):
"""
Return a query set which requests the page before this response.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request t... | python | def previous_page(self, max_=None):
result = type(self)()
result.before = Before(self.first.value)
result.max_ = max_
return result | [
"def",
"previous_page",
"(",
"self",
",",
"max_",
"=",
"None",
")",
":",
"result",
"=",
"type",
"(",
"self",
")",
"(",
")",
"result",
".",
"before",
"=",
"Before",
"(",
"self",
".",
"first",
".",
"value",
")",
"result",
".",
"max_",
"=",
"max_",
... | Return a query set which requests the page before this response.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request the previous page.
Must be called on a result se... | [
"Return",
"a",
"query",
"set",
"which",
"requests",
"the",
"page",
"before",
"this",
"response",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/rsm/xso.py#L256-L271 |
766 | horazont/aioxmpp | aioxmpp/rsm/xso.py | ResultSetMetadata.last_page | def last_page(self_or_cls, max_=None):
"""
Return a query set which requests the last page.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request the last page.... | python | def last_page(self_or_cls, max_=None):
result = self_or_cls()
result.before = Before()
result.max_ = max_
return result | [
"def",
"last_page",
"(",
"self_or_cls",
",",
"max_",
"=",
"None",
")",
":",
"result",
"=",
"self_or_cls",
"(",
")",
"result",
".",
"before",
"=",
"Before",
"(",
")",
"result",
".",
"max_",
"=",
"max_",
"return",
"result"
] | Return a query set which requests the last page.
:param max_: Maximum number of items to return.
:type max_: :class:`int` or :data:`None`
:rtype: :class:`ResultSetMetadata`
:return: A new request set up to request the last page. | [
"Return",
"a",
"query",
"set",
"which",
"requests",
"the",
"last",
"page",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/rsm/xso.py#L274-L286 |
767 | horazont/aioxmpp | aioxmpp/forms/xso.py | FieldType.allow_upcast | def allow_upcast(self, to):
"""
Return true if the field type may be upcast to the other field type
`to`.
This relation specifies when it is safe to transfer data from this
field type to the given other field type `to`.
This is the case if any of the following holds tru... | python | def allow_upcast(self, to):
if self == to:
return True
if self == FieldType.TEXT_SINGLE and to == FieldType.TEXT_PRIVATE:
return True
return False | [
"def",
"allow_upcast",
"(",
"self",
",",
"to",
")",
":",
"if",
"self",
"==",
"to",
":",
"return",
"True",
"if",
"self",
"==",
"FieldType",
".",
"TEXT_SINGLE",
"and",
"to",
"==",
"FieldType",
".",
"TEXT_PRIVATE",
":",
"return",
"True",
"return",
"False"
] | Return true if the field type may be upcast to the other field type
`to`.
This relation specifies when it is safe to transfer data from this
field type to the given other field type `to`.
This is the case if any of the following holds true:
* `to` is equal to this type
... | [
"Return",
"true",
"if",
"the",
"field",
"type",
"may",
"be",
"upcast",
"to",
"the",
"other",
"field",
"type",
"to",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/xso.py#L252-L270 |
768 | horazont/aioxmpp | aioxmpp/forms/xso.py | Data.get_form_type | def get_form_type(self):
"""
Extract the ``FORM_TYPE`` from the fields.
:return: ``FORM_TYPE`` value or :data:`None`
:rtype: :class:`str` or :data:`None`
Return :data:`None` if no well-formed ``FORM_TYPE`` field is found in
the list of fields.
.. versionadded::... | python | def get_form_type(self):
for field in self.fields:
if field.var == "FORM_TYPE" and field.type_ == FieldType.HIDDEN:
if len(field.values) != 1:
return None
return field.values[0] | [
"def",
"get_form_type",
"(",
"self",
")",
":",
"for",
"field",
"in",
"self",
".",
"fields",
":",
"if",
"field",
".",
"var",
"==",
"\"FORM_TYPE\"",
"and",
"field",
".",
"type_",
"==",
"FieldType",
".",
"HIDDEN",
":",
"if",
"len",
"(",
"field",
".",
"v... | Extract the ``FORM_TYPE`` from the fields.
:return: ``FORM_TYPE`` value or :data:`None`
:rtype: :class:`str` or :data:`None`
Return :data:`None` if no well-formed ``FORM_TYPE`` field is found in
the list of fields.
.. versionadded:: 0.8 | [
"Extract",
"the",
"FORM_TYPE",
"from",
"the",
"fields",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/xso.py#L623-L640 |
769 | horazont/aioxmpp | aioxmpp/ibr/service.py | get_registration_fields | def get_registration_fields(xmlstream,
timeout=60,
):
"""
A query is sent to the server to obtain the fields that need to be
filled to register with the server.
:param xmlstream: Specifies the stream connected to the server where
... | python | def get_registration_fields(xmlstream,
timeout=60,
):
iq = aioxmpp.IQ(
to=aioxmpp.JID.fromstr(xmlstream._to),
type_=aioxmpp.IQType.GET,
payload=xso.Query()
)
iq.autoset_id()
reply = yield from aioxmpp.protocol.send_and_wait... | [
"def",
"get_registration_fields",
"(",
"xmlstream",
",",
"timeout",
"=",
"60",
",",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"to",
"=",
"aioxmpp",
".",
"JID",
".",
"fromstr",
"(",
"xmlstream",
".",
"_to",
")",
",",
"type_",
"=",
"aioxmpp",
"."... | A query is sent to the server to obtain the fields that need to be
filled to register with the server.
:param xmlstream: Specifies the stream connected to the server where
the account will be created.
:type xmlstream: :class:`aioxmpp.protocol.XMLStream`
:param timeout: Maximum ti... | [
"A",
"query",
"is",
"sent",
"to",
"the",
"server",
"to",
"obtain",
"the",
"fields",
"that",
"need",
"to",
"be",
"filled",
"to",
"register",
"with",
"the",
"server",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibr/service.py#L34-L63 |
770 | horazont/aioxmpp | aioxmpp/ibr/service.py | register | def register(xmlstream,
query_xso,
timeout=60,
):
"""
Create a new account on the server.
:param query_xso: XSO with the information needed for the registration.
:type query_xso: :class:`~aioxmpp.ibr.Query`
:param xmlstream: Specifies the stream connected to ... | python | def register(xmlstream,
query_xso,
timeout=60,
):
iq = aioxmpp.IQ(
to=aioxmpp.JID.fromstr(xmlstream._to),
type_=aioxmpp.IQType.SET,
payload=query_xso
)
iq.autoset_id()
yield from aioxmpp.protocol.send_and_wait_for(xmlstream,
... | [
"def",
"register",
"(",
"xmlstream",
",",
"query_xso",
",",
"timeout",
"=",
"60",
",",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"to",
"=",
"aioxmpp",
".",
"JID",
".",
"fromstr",
"(",
"xmlstream",
".",
"_to",
")",
",",
"type_",
"=",
"aioxmpp"... | Create a new account on the server.
:param query_xso: XSO with the information needed for the registration.
:type query_xso: :class:`~aioxmpp.ibr.Query`
:param xmlstream: Specifies the stream connected to the server where
the account will be created.
:type xmlstream: :class:`aiox... | [
"Create",
"a",
"new",
"account",
"on",
"the",
"server",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibr/service.py#L67-L95 |
771 | horazont/aioxmpp | aioxmpp/ibr/service.py | get_used_fields | def get_used_fields(payload):
"""
Get a list containing the names of the fields that are used in the
xso.Query.
:param payload: Query object o be
:type payload: :class:`~aioxmpp.ibr.Query`
:return: :attr:`list`
"""
return [
tag
for tag, descriptor in payload.CHILD_MAP.it... | python | def get_used_fields(payload):
return [
tag
for tag, descriptor in payload.CHILD_MAP.items()
if descriptor.__get__(payload, type(payload)) is not None
] | [
"def",
"get_used_fields",
"(",
"payload",
")",
":",
"return",
"[",
"tag",
"for",
"tag",
",",
"descriptor",
"in",
"payload",
".",
"CHILD_MAP",
".",
"items",
"(",
")",
"if",
"descriptor",
".",
"__get__",
"(",
"payload",
",",
"type",
"(",
"payload",
")",
... | Get a list containing the names of the fields that are used in the
xso.Query.
:param payload: Query object o be
:type payload: :class:`~aioxmpp.ibr.Query`
:return: :attr:`list` | [
"Get",
"a",
"list",
"containing",
"the",
"names",
"of",
"the",
"fields",
"that",
"are",
"used",
"in",
"the",
"xso",
".",
"Query",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibr/service.py#L98-L111 |
772 | horazont/aioxmpp | aioxmpp/ibr/service.py | RegistrationService.get_client_info | def get_client_info(self):
"""
A query is sent to the server to obtain the client's data stored at the
server.
:return: :class:`~aioxmpp.ibr.Query`
"""
iq = aioxmpp.IQ(
to=self.client.local_jid.bare().replace(localpart=None),
type_=aioxmpp.IQType.... | python | def get_client_info(self):
iq = aioxmpp.IQ(
to=self.client.local_jid.bare().replace(localpart=None),
type_=aioxmpp.IQType.GET,
payload=xso.Query()
)
reply = (yield from self.client.send(iq))
return reply | [
"def",
"get_client_info",
"(",
"self",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"to",
"=",
"self",
".",
"client",
".",
"local_jid",
".",
"bare",
"(",
")",
".",
"replace",
"(",
"localpart",
"=",
"None",
")",
",",
"type_",
"=",
"aioxmpp",
".",... | A query is sent to the server to obtain the client's data stored at the
server.
:return: :class:`~aioxmpp.ibr.Query` | [
"A",
"query",
"is",
"sent",
"to",
"the",
"server",
"to",
"obtain",
"the",
"client",
"s",
"data",
"stored",
"at",
"the",
"server",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibr/service.py#L132-L146 |
773 | horazont/aioxmpp | aioxmpp/ibr/service.py | RegistrationService.change_pass | def change_pass(self,
new_pass):
"""
Change the client password for 'new_pass'.
:param new_pass: New password of the client.
:type new_pass: :class:`str`
:param old_pass: Old password of the client.
:type old_pass: :class:`str`
"""
i... | python | def change_pass(self,
new_pass):
iq = aioxmpp.IQ(
to=self.client.local_jid.bare().replace(localpart=None),
type_=aioxmpp.IQType.SET,
payload=xso.Query(self.client.local_jid.localpart, new_pass)
)
yield from self.client.send(iq) | [
"def",
"change_pass",
"(",
"self",
",",
"new_pass",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"to",
"=",
"self",
".",
"client",
".",
"local_jid",
".",
"bare",
"(",
")",
".",
"replace",
"(",
"localpart",
"=",
"None",
")",
",",
"type_",
"=",
... | Change the client password for 'new_pass'.
:param new_pass: New password of the client.
:type new_pass: :class:`str`
:param old_pass: Old password of the client.
:type old_pass: :class:`str` | [
"Change",
"the",
"client",
"password",
"for",
"new_pass",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibr/service.py#L149-L167 |
774 | horazont/aioxmpp | aioxmpp/ibr/service.py | RegistrationService.cancel_registration | def cancel_registration(self):
"""
Cancels the currents client's account with the server.
Even if the cancelation is succesful, this method will raise an
exception due to he account no longer exists for the server, so the
client will fail.
To continue with the execution,... | python | def cancel_registration(self):
iq = aioxmpp.IQ(
to=self.client.local_jid.bare().replace(localpart=None),
type_=aioxmpp.IQType.SET,
payload=xso.Query()
)
iq.payload.remove = True
yield from self.client.send(iq) | [
"def",
"cancel_registration",
"(",
"self",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"to",
"=",
"self",
".",
"client",
".",
"local_jid",
".",
"bare",
"(",
")",
".",
"replace",
"(",
"localpart",
"=",
"None",
")",
",",
"type_",
"=",
"aioxmpp",
... | Cancels the currents client's account with the server.
Even if the cancelation is succesful, this method will raise an
exception due to he account no longer exists for the server, so the
client will fail.
To continue with the execution, this method should be surrounded by a
try/... | [
"Cancels",
"the",
"currents",
"client",
"s",
"account",
"with",
"the",
"server",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibr/service.py#L170-L187 |
775 | horazont/aioxmpp | aioxmpp/node.py | discover_connectors | def discover_connectors(
domain: str,
loop=None,
logger=logger):
"""
Discover all connection options for a domain, in descending order of
preference.
This coroutine returns options discovered from SRV records, or if none are
found, the generic option using the domain name an... | python | def discover_connectors(
domain: str,
loop=None,
logger=logger):
domain_encoded = domain.encode("idna") + b"."
starttls_srv_failed = False
tls_srv_failed = False
try:
starttls_srv_records = yield from network.lookup_srv(
domain_encoded,
"xmpp-clie... | [
"def",
"discover_connectors",
"(",
"domain",
":",
"str",
",",
"loop",
"=",
"None",
",",
"logger",
"=",
"logger",
")",
":",
"domain_encoded",
"=",
"domain",
".",
"encode",
"(",
"\"idna\"",
")",
"+",
"b\".\"",
"starttls_srv_failed",
"=",
"False",
"tls_srv_fail... | Discover all connection options for a domain, in descending order of
preference.
This coroutine returns options discovered from SRV records, or if none are
found, the generic option using the domain name and the default XMPP client
port.
Each option is represented by a triple ``(host, port, connec... | [
"Discover",
"all",
"connection",
"options",
"for",
"a",
"domain",
"in",
"descending",
"order",
"of",
"preference",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L105-L231 |
776 | horazont/aioxmpp | aioxmpp/node.py | Client.stop | def stop(self):
"""
Stop the client. This sends a signal to the clients main task which
makes it terminate.
It may take some cycles through the event loop to stop the client
task. To check whether the task has actually stopped, query
:attr:`running`.
"""
... | python | def stop(self):
if not self.running:
return
self.logger.debug("stopping main task of %r", self, stack_info=True)
self._main_task.cancel() | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"running",
":",
"return",
"self",
".",
"logger",
".",
"debug",
"(",
"\"stopping main task of %r\"",
",",
"self",
",",
"stack_info",
"=",
"True",
")",
"self",
".",
"_main_task",
".",
"cancel"... | Stop the client. This sends a signal to the clients main task which
makes it terminate.
It may take some cycles through the event loop to stop the client
task. To check whether the task has actually stopped, query
:attr:`running`. | [
"Stop",
"the",
"client",
".",
"This",
"sends",
"a",
"signal",
"to",
"the",
"clients",
"main",
"task",
"which",
"makes",
"it",
"terminate",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1058-L1071 |
777 | horazont/aioxmpp | aioxmpp/node.py | Client.enqueue | def enqueue(self, stanza, **kwargs):
"""
Put a `stanza` in the internal transmission queue and return a token to
track it.
:param stanza: Stanza to send
:type stanza: :class:`IQ`, :class:`Message` or :class:`Presence`
:param kwargs: see :class:`StanzaToken`
:rais... | python | def enqueue(self, stanza, **kwargs):
if not self.established_event.is_set():
raise ConnectionError("stream is not ready")
return self.stream._enqueue(stanza, **kwargs) | [
"def",
"enqueue",
"(",
"self",
",",
"stanza",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"established_event",
".",
"is_set",
"(",
")",
":",
"raise",
"ConnectionError",
"(",
"\"stream is not ready\"",
")",
"return",
"self",
".",
"stream",
... | Put a `stanza` in the internal transmission queue and return a token to
track it.
:param stanza: Stanza to send
:type stanza: :class:`IQ`, :class:`Message` or :class:`Presence`
:param kwargs: see :class:`StanzaToken`
:raises ConnectionError: if the stream is not :attr:`establish... | [
"Put",
"a",
"stanza",
"in",
"the",
"internal",
"transmission",
"queue",
"and",
"return",
"a",
"token",
"to",
"track",
"it",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1215-L1252 |
778 | horazont/aioxmpp | aioxmpp/node.py | Client.send | def send(self, stanza, *, timeout=None, cb=None):
"""
Send a stanza.
:param stanza: Stanza to send
:type stanza: :class:`~.IQ`, :class:`~.Presence` or :class:`~.Message`
:param timeout: Maximum time in seconds to wait for an IQ response, or
:data:`None` t... | python | def send(self, stanza, *, timeout=None, cb=None):
if not self.running:
raise ConnectionError("client is not running")
if not self.established:
self.logger.debug("send(%s): stream not established, waiting",
stanza)
# wait for the stream t... | [
"def",
"send",
"(",
"self",
",",
"stanza",
",",
"*",
",",
"timeout",
"=",
"None",
",",
"cb",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"running",
":",
"raise",
"ConnectionError",
"(",
"\"client is not running\"",
")",
"if",
"not",
"self",
".",
... | Send a stanza.
:param stanza: Stanza to send
:type stanza: :class:`~.IQ`, :class:`~.Presence` or :class:`~.Message`
:param timeout: Maximum time in seconds to wait for an IQ response, or
:data:`None` to disable the timeout.
:type timeout: :class:`~numbers.Real` o... | [
"Send",
"a",
"stanza",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1255-L1372 |
779 | horazont/aioxmpp | aioxmpp/ping/service.py | ping | def ping(client, peer):
"""
Ping a peer.
:param peer: The peer to ping.
:type peer: :class:`aioxmpp.JID`
:raises aioxmpp.errors.XMPPError: as received
Send a :xep:`199` ping IQ to `peer` and wait for the reply.
This is a low-level version of :meth:`aioxmpp.PingService.ping`.
**When t... | python | def ping(client, peer):
iq = aioxmpp.IQ(
to=peer,
type_=aioxmpp.IQType.GET,
payload=ping_xso.Ping()
)
yield from client.send(iq) | [
"def",
"ping",
"(",
"client",
",",
"peer",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"to",
"=",
"peer",
",",
"type_",
"=",
"aioxmpp",
".",
"IQType",
".",
"GET",
",",
"payload",
"=",
"ping_xso",
".",
"Ping",
"(",
")",
")",
"yield",
"from",
... | Ping a peer.
:param peer: The peer to ping.
:type peer: :class:`aioxmpp.JID`
:raises aioxmpp.errors.XMPPError: as received
Send a :xep:`199` ping IQ to `peer` and wait for the reply.
This is a low-level version of :meth:`aioxmpp.PingService.ping`.
**When to use this function vs. the service ... | [
"Ping",
"a",
"peer",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ping/service.py#L90-L124 |
780 | horazont/aioxmpp | aioxmpp/shim/service.py | SHIMService.register_header | def register_header(self, name):
"""
Register support for the SHIM header with the given `name`.
If the header has already been registered as supported,
:class:`ValueError` is raised.
"""
self._node.register_feature(
"#".join([namespaces.xep0131_shim, name])... | python | def register_header(self, name):
self._node.register_feature(
"#".join([namespaces.xep0131_shim, name])
) | [
"def",
"register_header",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_node",
".",
"register_feature",
"(",
"\"#\"",
".",
"join",
"(",
"[",
"namespaces",
".",
"xep0131_shim",
",",
"name",
"]",
")",
")"
] | Register support for the SHIM header with the given `name`.
If the header has already been registered as supported,
:class:`ValueError` is raised. | [
"Register",
"support",
"for",
"the",
"SHIM",
"header",
"with",
"the",
"given",
"name",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/shim/service.py#L71-L81 |
781 | horazont/aioxmpp | aioxmpp/shim/service.py | SHIMService.unregister_header | def unregister_header(self, name):
"""
Unregister support for the SHIM header with the given `name`.
If the header is currently not registered as supported,
:class:`KeyError` is raised.
"""
self._node.unregister_feature(
"#".join([namespaces.xep0131_shim, na... | python | def unregister_header(self, name):
self._node.unregister_feature(
"#".join([namespaces.xep0131_shim, name])
) | [
"def",
"unregister_header",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_node",
".",
"unregister_feature",
"(",
"\"#\"",
".",
"join",
"(",
"[",
"namespaces",
".",
"xep0131_shim",
",",
"name",
"]",
")",
")"
] | Unregister support for the SHIM header with the given `name`.
If the header is currently not registered as supported,
:class:`KeyError` is raised. | [
"Unregister",
"support",
"for",
"the",
"SHIM",
"header",
"with",
"the",
"given",
"name",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/shim/service.py#L83-L93 |
782 | horazont/aioxmpp | aioxmpp/vcard/service.py | VCardService.set_vcard | def set_vcard(self, vcard):
"""
Store the vCard `vcard` for the connected entity.
:param vcard: the vCard to store.
.. note::
`vcard` should always be derived from the result of
`get_vcard` to preserve the elements of the vcard the
client does not modi... | python | def set_vcard(self, vcard):
iq = aioxmpp.IQ(
type_=aioxmpp.IQType.SET,
payload=vcard,
)
yield from self.client.send(iq) | [
"def",
"set_vcard",
"(",
"self",
",",
"vcard",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"IQType",
".",
"SET",
",",
"payload",
"=",
"vcard",
",",
")",
"yield",
"from",
"self",
".",
"client",
".",
"send",
"(",
"... | Store the vCard `vcard` for the connected entity.
:param vcard: the vCard to store.
.. note::
`vcard` should always be derived from the result of
`get_vcard` to preserve the elements of the vcard the
client does not modify.
.. warning::
It is in t... | [
"Store",
"the",
"vCard",
"vcard",
"for",
"the",
"connected",
"entity",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/vcard/service.py#L71-L92 |
783 | horazont/aioxmpp | aioxmpp/chatstates/utils.py | ChatStateManager.handle | def handle(self, state, message=False):
"""
Handle a state update.
:param state: the new chat state
:type state: :class:`~aioxmpp.chatstates.ChatState`
:param message: pass true to indicate that we handle the
:data:`ACTIVE` state that is implied by
... | python | def handle(self, state, message=False):
if message:
if state != chatstates_xso.ChatState.ACTIVE:
raise ValueError(
"Only the state ACTIVE can be sent with messages."
)
elif self._state == state:
return False
self._state... | [
"def",
"handle",
"(",
"self",
",",
"state",
",",
"message",
"=",
"False",
")",
":",
"if",
"message",
":",
"if",
"state",
"!=",
"chatstates_xso",
".",
"ChatState",
".",
"ACTIVE",
":",
"raise",
"ValueError",
"(",
"\"Only the state ACTIVE can be sent with messages.... | Handle a state update.
:param state: the new chat state
:type state: :class:`~aioxmpp.chatstates.ChatState`
:param message: pass true to indicate that we handle the
:data:`ACTIVE` state that is implied by
sending a content message.
:type ... | [
"Handle",
"a",
"state",
"update",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/chatstates/utils.py#L111-L139 |
784 | horazont/aioxmpp | aioxmpp/protocol.py | XMLStream.close | def close(self):
"""
Close the XML stream and the underlying transport.
This gracefully shuts down the XML stream and the transport, if
possible by writing the eof using :meth:`asyncio.Transport.write_eof`
after sending the stream footer.
After a call to :meth:`close`, ... | python | def close(self):
if (self._smachine.state == State.CLOSING or
self._smachine.state == State.CLOSED):
return
self._writer.close()
if self._transport.can_write_eof():
self._transport.write_eof()
if self._smachine.state == State.STREAM_HEADER_SENT:
... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_smachine",
".",
"state",
"==",
"State",
".",
"CLOSING",
"or",
"self",
".",
"_smachine",
".",
"state",
"==",
"State",
".",
"CLOSED",
")",
":",
"return",
"self",
".",
"_writer",
".",
"c... | Close the XML stream and the underlying transport.
This gracefully shuts down the XML stream and the transport, if
possible by writing the eof using :meth:`asyncio.Transport.write_eof`
after sending the stream footer.
After a call to :meth:`close`, no other stream manipulating or sendi... | [
"Close",
"the",
"XML",
"stream",
"and",
"the",
"underlying",
"transport",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L539-L565 |
785 | horazont/aioxmpp | aioxmpp/protocol.py | XMLStream.reset | def reset(self):
"""
Reset the stream by discarding all state and re-sending the stream
header.
Calling :meth:`reset` when the stream is disconnected or currently
disconnecting results in either :class:`ConnectionError` being raised
or the exception which caused the stre... | python | def reset(self):
self._require_connection(accept_partial=True)
self._reset_state()
self._writer.start()
self._smachine.rewind(State.STREAM_HEADER_SENT) | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_require_connection",
"(",
"accept_partial",
"=",
"True",
")",
"self",
".",
"_reset_state",
"(",
")",
"self",
".",
"_writer",
".",
"start",
"(",
")",
"self",
".",
"_smachine",
".",
"rewind",
"(",
"St... | Reset the stream by discarding all state and re-sending the stream
header.
Calling :meth:`reset` when the stream is disconnected or currently
disconnecting results in either :class:`ConnectionError` being raised
or the exception which caused the stream to die (possibly a received
... | [
"Reset",
"the",
"stream",
"by",
"discarding",
"all",
"state",
"and",
"re",
"-",
"sending",
"the",
"stream",
"header",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L613-L632 |
786 | horazont/aioxmpp | aioxmpp/protocol.py | XMLStream.abort | def abort(self):
"""
Abort the stream by writing an EOF if possible and closing the
transport.
The transport is closed using :meth:`asyncio.BaseTransport.close`, so
buffered data is sent, but no more data will be received. The stream is
in :attr:`State.CLOSED` state afte... | python | def abort(self):
if self._smachine.state == State.CLOSED:
return
if self._smachine.state == State.READY:
self._smachine.state = State.CLOSED
return
if (self._smachine.state != State.CLOSING and
self._transport.can_write_eof()):
self... | [
"def",
"abort",
"(",
"self",
")",
":",
"if",
"self",
".",
"_smachine",
".",
"state",
"==",
"State",
".",
"CLOSED",
":",
"return",
"if",
"self",
".",
"_smachine",
".",
"state",
"==",
"State",
".",
"READY",
":",
"self",
".",
"_smachine",
".",
"state",
... | Abort the stream by writing an EOF if possible and closing the
transport.
The transport is closed using :meth:`asyncio.BaseTransport.close`, so
buffered data is sent, but no more data will be received. The stream is
in :attr:`State.CLOSED` state afterwards.
This also works if t... | [
"Abort",
"the",
"stream",
"by",
"writing",
"an",
"EOF",
"if",
"possible",
"and",
"closing",
"the",
"transport",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L634-L657 |
787 | horazont/aioxmpp | aioxmpp/protocol.py | XMLStream.starttls | def starttls(self, ssl_context, post_handshake_callback=None):
"""
Start TLS on the transport and wait for it to complete.
The `ssl_context` and `post_handshake_callback` arguments are forwarded
to the transports
:meth:`aioopenssl.STARTTLSTransport.starttls` coroutine method.
... | python | def starttls(self, ssl_context, post_handshake_callback=None):
self._require_connection()
if not self.can_starttls():
raise RuntimeError("starttls not available on transport")
yield from self._transport.starttls(ssl_context,
post_handshake... | [
"def",
"starttls",
"(",
"self",
",",
"ssl_context",
",",
"post_handshake_callback",
"=",
"None",
")",
":",
"self",
".",
"_require_connection",
"(",
")",
"if",
"not",
"self",
".",
"can_starttls",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"starttls not avai... | Start TLS on the transport and wait for it to complete.
The `ssl_context` and `post_handshake_callback` arguments are forwarded
to the transports
:meth:`aioopenssl.STARTTLSTransport.starttls` coroutine method.
If the transport does not support starttls, :class:`RuntimeError` is
... | [
"Start",
"TLS",
"on",
"the",
"transport",
"and",
"wait",
"for",
"it",
"to",
"complete",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L699-L722 |
788 | horazont/aioxmpp | aioxmpp/protocol.py | XMLStream.error_future | def error_future(self):
"""
Return a future which will receive the next XML stream error as
exception.
It is safe to cancel the future at any time.
"""
fut = asyncio.Future(loop=self._loop)
self._error_futures.append(fut)
return fut | python | def error_future(self):
fut = asyncio.Future(loop=self._loop)
self._error_futures.append(fut)
return fut | [
"def",
"error_future",
"(",
"self",
")",
":",
"fut",
"=",
"asyncio",
".",
"Future",
"(",
"loop",
"=",
"self",
".",
"_loop",
")",
"self",
".",
"_error_futures",
".",
"append",
"(",
"fut",
")",
"return",
"fut"
] | Return a future which will receive the next XML stream error as
exception.
It is safe to cancel the future at any time. | [
"Return",
"a",
"future",
"which",
"will",
"receive",
"the",
"next",
"XML",
"stream",
"error",
"as",
"exception",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L724-L733 |
789 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_features | def get_features(self, jid):
"""
Return the features supported by a service.
:param jid: Address of the PubSub service to query.
:type jid: :class:`aioxmpp.JID`
:return: Set of supported features
:rtype: set containing :class:`~.pubsub.xso.Feature` enumeration
... | python | def get_features(self, jid):
response = yield from self._disco.query_info(jid)
result = set()
for feature in response.features:
try:
result.add(pubsub_xso.Feature(feature))
except ValueError:
continue
return result | [
"def",
"get_features",
"(",
"self",
",",
"jid",
")",
":",
"response",
"=",
"yield",
"from",
"self",
".",
"_disco",
".",
"query_info",
"(",
"jid",
")",
"result",
"=",
"set",
"(",
")",
"for",
"feature",
"in",
"response",
".",
"features",
":",
"try",
":... | Return the features supported by a service.
:param jid: Address of the PubSub service to query.
:type jid: :class:`aioxmpp.JID`
:return: Set of supported features
:rtype: set containing :class:`~.pubsub.xso.Feature` enumeration
members.
This simply uses service ... | [
"Return",
"the",
"features",
"supported",
"by",
"a",
"service",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L274-L300 |
790 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.subscribe | def subscribe(self, jid, node=None, *,
subscription_jid=None,
config=None):
"""
Subscribe to a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to subscribe to.
:type... | python | def subscribe(self, jid, node=None, *,
subscription_jid=None,
config=None):
subscription_jid = subscription_jid or self.client.local_jid.bare()
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.SET)
iq.payload = pubsub_xso.Request(
pubsu... | [
"def",
"subscribe",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
",",
"*",
",",
"subscription_jid",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"subscription_jid",
"=",
"subscription_jid",
"or",
"self",
".",
"client",
".",
"local_jid",
".",
... | Subscribe to a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to subscribe to.
:type node: :class:`str`
:param subscription_jid: The address to subscribe to the service.
:type subscription_jid: :class... | [
"Subscribe",
"to",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L303-L354 |
791 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.unsubscribe | def unsubscribe(self, jid, node=None, *,
subscription_jid=None,
subid=None):
"""
Unsubscribe from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to unsubscribe from.
... | python | def unsubscribe(self, jid, node=None, *,
subscription_jid=None,
subid=None):
subscription_jid = subscription_jid or self.client.local_jid.bare()
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.SET)
iq.payload = pubsub_xso.Request(
... | [
"def",
"unsubscribe",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
",",
"*",
",",
"subscription_jid",
"=",
"None",
",",
"subid",
"=",
"None",
")",
":",
"subscription_jid",
"=",
"subscription_jid",
"or",
"self",
".",
"client",
".",
"local_jid",
".",... | Unsubscribe from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to unsubscribe from.
:type node: :class:`str`
:param subscription_jid: The address to subscribe from the service.
:type subscription_j... | [
"Unsubscribe",
"from",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L357-L390 |
792 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_subscription_config | def get_subscription_config(self, jid, node=None, *,
subscription_jid=None,
subid=None):
"""
Request the current configuration of a subscription.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
... | python | def get_subscription_config(self, jid, node=None, *,
subscription_jid=None,
subid=None):
subscription_jid = subscription_jid or self.client.local_jid.bare()
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.GET)
iq.payloa... | [
"def",
"get_subscription_config",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
",",
"*",
",",
"subscription_jid",
"=",
"None",
",",
"subid",
"=",
"None",
")",
":",
"subscription_jid",
"=",
"subscription_jid",
"or",
"self",
".",
"client",
".",
"local_... | Request the current configuration of a subscription.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:param subscription_jid: The address to query the configuration for.
:t... | [
"Request",
"the",
"current",
"configuration",
"of",
"a",
"subscription",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L393-L433 |
793 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_default_config | def get_default_config(self, jid, node=None):
"""
Request the default configuration of a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:raises aioxmpp.error... | python | def get_default_config(self, jid, node=None):
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.GET)
iq.payload = pubsub_xso.Request(
pubsub_xso.Default(node=node)
)
response = yield from self.client.send(iq)
return response.payload.data | [
"def",
"get_default_config",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"to",
"=",
"jid",
",",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"GET",
")",
"iq",
"... | Request the default configuration of a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:raises aioxmpp.errors.XMPPError: as returned by the service
:return: The defau... | [
"Request",
"the",
"default",
"configuration",
"of",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L480-L504 |
794 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_node_config | def get_node_config(self, jid, node=None):
"""
Request the configuration of a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:raises aioxmpp.errors.XMPPError... | python | def get_node_config(self, jid, node=None):
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.GET)
iq.payload = pubsub_xso.OwnerRequest(
pubsub_xso.OwnerConfigure(node=node)
)
response = yield from self.client.send(iq)
return response.payload.data | [
"def",
"get_node_config",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"to",
"=",
"jid",
",",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"GET",
")",
"iq",
".",... | Request the configuration of a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:raises aioxmpp.errors.XMPPError: as returned by the service
:return: The configuration... | [
"Request",
"the",
"configuration",
"of",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L507-L531 |
795 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.set_node_config | def set_node_config(self, jid, config, node=None):
"""
Update the configuration of a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param config: Configuration form
:type config: :class:`aioxmpp.forms.Data`
:param node: Name of ... | python | def set_node_config(self, jid, config, node=None):
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.SET)
iq.payload = pubsub_xso.OwnerRequest(
pubsub_xso.OwnerConfigure(node=node)
)
iq.payload.payload.data = config
yield from self.client.send(iq) | [
"def",
"set_node_config",
"(",
"self",
",",
"jid",
",",
"config",
",",
"node",
"=",
"None",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"to",
"=",
"jid",
",",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"SET",
... | Update the configuration of a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param config: Configuration form
:type config: :class:`aioxmpp.forms.Data`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:rai... | [
"Update",
"the",
"configuration",
"of",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L534-L559 |
796 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_items | def get_items(self, jid, node, *, max_items=None):
"""
Request the most recent items from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:param max_items: ... | python | def get_items(self, jid, node, *, max_items=None):
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.GET)
iq.payload = pubsub_xso.Request(
pubsub_xso.Items(node, max_items=max_items)
)
return (yield from self.client.send(iq)) | [
"def",
"get_items",
"(",
"self",
",",
"jid",
",",
"node",
",",
"*",
",",
"max_items",
"=",
"None",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"to",
"=",
"jid",
",",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
... | Request the most recent items from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:param max_items: Number of items to return at most.
:type max_items: :class:`int... | [
"Request",
"the",
"most",
"recent",
"items",
"from",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L562-L589 |
797 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_items_by_id | def get_items_by_id(self, jid, node, ids):
"""
Request specific items by their IDs from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:param ids: The item... | python | def get_items_by_id(self, jid, node, ids):
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.GET)
iq.payload = pubsub_xso.Request(
pubsub_xso.Items(node)
)
iq.payload.payload.items = [
pubsub_xso.Item(id_)
for id_ in ids
]
i... | [
"def",
"get_items_by_id",
"(",
"self",
",",
"jid",
",",
"node",
",",
"ids",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"to",
"=",
"jid",
",",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"GET",
")",
"iq",
".",
... | Request specific items by their IDs from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:param ids: The item IDs to return.
:type ids: :class:`~collections.abc.Ite... | [
"Request",
"specific",
"items",
"by",
"their",
"IDs",
"from",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L592-L628 |
798 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_subscriptions | def get_subscriptions(self, jid, node=None):
"""
Return all subscriptions of the local entity to a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:raises aio... | python | def get_subscriptions(self, jid, node=None):
iq = aioxmpp.stanza.IQ(to=jid, type_=aioxmpp.structs.IQType.GET)
iq.payload = pubsub_xso.Request(
pubsub_xso.Subscriptions(node=node)
)
response = yield from self.client.send(iq)
return response.payload | [
"def",
"get_subscriptions",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"to",
"=",
"jid",
",",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"GET",
")",
"iq",
".... | Return all subscriptions of the local entity to a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to query.
:type node: :class:`str`
:raises aioxmpp.errors.XMPPError: as returned by the service
:return... | [
"Return",
"all",
"subscriptions",
"of",
"the",
"local",
"entity",
"to",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L631-L653 |
799 | horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.publish | def publish(self, jid, node, payload, *,
id_=None,
publish_options=None):
"""
Publish an item to a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to publish to.
:type n... | python | def publish(self, jid, node, payload, *,
id_=None,
publish_options=None):
publish = pubsub_xso.Publish()
publish.node = node
if payload is not None:
item = pubsub_xso.Item()
item.id_ = id_
item.registered_payload = payload
... | [
"def",
"publish",
"(",
"self",
",",
"jid",
",",
"node",
",",
"payload",
",",
"*",
",",
"id_",
"=",
"None",
",",
"publish_options",
"=",
"None",
")",
":",
"publish",
"=",
"pubsub_xso",
".",
"Publish",
"(",
")",
"publish",
".",
"node",
"=",
"node",
"... | Publish an item to a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to publish to.
:type node: :class:`str`
:param payload: Registered payload to publish.
:type payload: :class:`aioxmpp.xso.XSO`
... | [
"Publish",
"an",
"item",
"to",
"a",
"node",
"."
] | 22a68e5e1d23f2a4dee470092adbd4672f9ef061 | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L656-L730 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.