repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
horazont/aioxmpp | aioxmpp/node.py | _try_options | def _try_options(options, exceptions,
jid, metadata, negotiation_timeout, loop, logger):
"""
Helper function for :func:`connect_xmlstream`.
"""
for host, port, conn in options:
logger.debug(
"domain %s: trying to connect to %r:%s using %r",
jid.domain, ho... | python | def _try_options(options, exceptions,
jid, metadata, negotiation_timeout, loop, logger):
"""
Helper function for :func:`connect_xmlstream`.
"""
for host, port, conn in options:
logger.debug(
"domain %s: trying to connect to %r:%s using %r",
jid.domain, ho... | [
"def",
"_try_options",
"(",
"options",
",",
"exceptions",
",",
"jid",
",",
"metadata",
",",
"negotiation_timeout",
",",
"loop",
",",
"logger",
")",
":",
"for",
"host",
",",
"port",
",",
"conn",
"in",
"options",
":",
"logger",
".",
"debug",
"(",
"\"domain... | Helper function for :func:`connect_xmlstream`. | [
"Helper",
"function",
"for",
":",
"func",
":",
"connect_xmlstream",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L235-L298 |
horazont/aioxmpp | aioxmpp/node.py | connect_xmlstream | def connect_xmlstream(
jid,
metadata,
negotiation_timeout=60.,
override_peer=[],
loop=None,
logger=logger):
"""
Prepare and connect a :class:`aioxmpp.protocol.XMLStream` to a server
responsible for the given `jid` and authenticate against that server using
... | python | def connect_xmlstream(
jid,
metadata,
negotiation_timeout=60.,
override_peer=[],
loop=None,
logger=logger):
"""
Prepare and connect a :class:`aioxmpp.protocol.XMLStream` to a server
responsible for the given `jid` and authenticate against that server using
... | [
"def",
"connect_xmlstream",
"(",
"jid",
",",
"metadata",
",",
"negotiation_timeout",
"=",
"60.",
",",
"override_peer",
"=",
"[",
"]",
",",
"loop",
"=",
"None",
",",
"logger",
"=",
"logger",
")",
":",
"loop",
"=",
"asyncio",
".",
"get_event_loop",
"(",
")... | Prepare and connect a :class:`aioxmpp.protocol.XMLStream` to a server
responsible for the given `jid` and authenticate against that server using
the SASL mechansims described in `metadata`.
:param jid: Address of the user for which the connection is made.
:type jid: :class:`aioxmpp.JID`
:param meta... | [
"Prepare",
"and",
"connect",
"a",
":",
"class",
":",
"aioxmpp",
".",
"protocol",
".",
"XMLStream",
"to",
"a",
"server",
"responsible",
"for",
"the",
"given",
"jid",
"and",
"authenticate",
"against",
"that",
"server",
"using",
"the",
"SASL",
"mechansims",
"de... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L302-L416 |
horazont/aioxmpp | aioxmpp/node.py | Client.start | def start(self):
"""
Start the client. If it is already :attr:`running`,
:class:`RuntimeError` is raised.
While the client is running, it will try to keep an XMPP connection
open to the server associated with :attr:`local_jid`.
"""
if self.running:
ra... | python | def start(self):
"""
Start the client. If it is already :attr:`running`,
:class:`RuntimeError` is raised.
While the client is running, it will try to keep an XMPP connection
open to the server associated with :attr:`local_jid`.
"""
if self.running:
ra... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"running",
":",
"raise",
"RuntimeError",
"(",
"\"client already running\"",
")",
"self",
".",
"_main_task",
"=",
"asyncio",
".",
"ensure_future",
"(",
"self",
".",
"_main",
"(",
")",
",",
"loop",
... | Start the client. If it is already :attr:`running`,
:class:`RuntimeError` is raised.
While the client is running, it will try to keep an XMPP connection
open to the server associated with :attr:`local_jid`. | [
"Start",
"the",
"client",
".",
"If",
"it",
"is",
"already",
":",
"attr",
":",
"running",
":",
"class",
":",
"RuntimeError",
"is",
"raised",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1041-L1056 |
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):
"""
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`.
"""
... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1058-L1071 |
horazont/aioxmpp | aioxmpp/node.py | Client.connected | def connected(self, *, presence=structs.PresenceState(False), **kwargs):
"""
Return a :class:`.node.UseConnected` context manager which does not
modify the presence settings.
The keyword arguments are passed to the :class:`.node.UseConnected`
context manager constructor.
... | python | def connected(self, *, presence=structs.PresenceState(False), **kwargs):
"""
Return a :class:`.node.UseConnected` context manager which does not
modify the presence settings.
The keyword arguments are passed to the :class:`.node.UseConnected`
context manager constructor.
... | [
"def",
"connected",
"(",
"self",
",",
"*",
",",
"presence",
"=",
"structs",
".",
"PresenceState",
"(",
"False",
")",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"UseConnected",
"(",
"self",
",",
"presence",
"=",
"presence",
",",
"*",
"*",
"kwargs",
... | Return a :class:`.node.UseConnected` context manager which does not
modify the presence settings.
The keyword arguments are passed to the :class:`.node.UseConnected`
context manager constructor.
.. versionadded:: 0.8 | [
"Return",
"a",
":",
"class",
":",
".",
"node",
".",
"UseConnected",
"context",
"manager",
"which",
"does",
"not",
"modify",
"the",
"presence",
"settings",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1203-L1213 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1215-L1252 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1255-L1372 |
horazont/aioxmpp | aioxmpp/node.py | PresenceManagedClient.set_presence | def set_presence(self, state, status):
"""
Set the presence `state` and `status` on the client. This has the same
effects as writing `state` to :attr:`presence`, but the status of the
presence is also set at the same time.
`status` must be either a string or something which can ... | python | def set_presence(self, state, status):
"""
Set the presence `state` and `status` on the client. This has the same
effects as writing `state` to :attr:`presence`, but the status of the
presence is also set at the same time.
`status` must be either a string or something which can ... | [
"def",
"set_presence",
"(",
"self",
",",
"state",
",",
"status",
")",
":",
"self",
".",
"_presence_server",
".",
"set_presence",
"(",
"state",
",",
"status",
"=",
"status",
")"
] | Set the presence `state` and `status` on the client. This has the same
effects as writing `state` to :attr:`presence`, but the status of the
presence is also set at the same time.
`status` must be either a string or something which can be passed to
:class:`dict`. If it is a string, the ... | [
"Set",
"the",
"presence",
"state",
"and",
"status",
"on",
"the",
"client",
".",
"This",
"has",
"the",
"same",
"effects",
"as",
"writing",
"state",
"to",
":",
"attr",
":",
"presence",
"but",
"the",
"status",
"of",
"the",
"presence",
"is",
"also",
"set",
... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1472-L1487 |
horazont/aioxmpp | aioxmpp/im/service.py | ConversationService._add_conversation | def _add_conversation(self, conversation):
"""
Add the conversation and fire the :meth:`on_conversation_added` event.
:param conversation: The conversation object to add.
:type conversation: :class:`~.AbstractConversation`
The conversation is added to the internal list of conve... | python | def _add_conversation(self, conversation):
"""
Add the conversation and fire the :meth:`on_conversation_added` event.
:param conversation: The conversation object to add.
:type conversation: :class:`~.AbstractConversation`
The conversation is added to the internal list of conve... | [
"def",
"_add_conversation",
"(",
"self",
",",
"conversation",
")",
":",
"handler",
"=",
"functools",
".",
"partial",
"(",
"self",
".",
"_handle_conversation_exit",
",",
"conversation",
")",
"tokens",
"=",
"[",
"]",
"def",
"linked_token",
"(",
"signal",
",",
... | Add the conversation and fire the :meth:`on_conversation_added` event.
:param conversation: The conversation object to add.
:type conversation: :class:`~.AbstractConversation`
The conversation is added to the internal list of conversations which
can be queried at :attr:`conversations`.... | [
"Add",
"the",
"conversation",
"and",
"fire",
"the",
":",
"meth",
":",
"on_conversation_added",
"event",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/im/service.py#L99-L135 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ping/service.py#L90-L124 |
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):
"""
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])... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/shim/service.py#L71-L81 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/shim/service.py#L83-L93 |
horazont/aioxmpp | aioxmpp/vcard/service.py | VCardService.get_vcard | def get_vcard(self, jid=None):
"""
Get the vCard stored for the jid `jid`. If `jid` is
:data:`None` get the vCard of the connected entity.
:param jid: the object to retrieve.
:returns: the stored vCard.
We mask a :class:`XMPPCancelError` in case it is
``feature-... | python | def get_vcard(self, jid=None):
"""
Get the vCard stored for the jid `jid`. If `jid` is
:data:`None` get the vCard of the connected entity.
:param jid: the object to retrieve.
:returns: the stored vCard.
We mask a :class:`XMPPCancelError` in case it is
``feature-... | [
"def",
"get_vcard",
"(",
"self",
",",
"jid",
"=",
"None",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"IQType",
".",
"GET",
",",
"to",
"=",
"jid",
",",
"payload",
"=",
"vcard_xso",
".",
"VCard",
"(",
")",
",",
... | Get the vCard stored for the jid `jid`. If `jid` is
:data:`None` get the vCard of the connected entity.
:param jid: the object to retrieve.
:returns: the stored vCard.
We mask a :class:`XMPPCancelError` in case it is
``feature-not-implemented`` or ``item-not-found`` and return
... | [
"Get",
"the",
"vCard",
"stored",
"for",
"the",
"jid",
"jid",
".",
"If",
"jid",
"is",
":",
"data",
":",
"None",
"get",
"the",
"vCard",
"of",
"the",
"connected",
"entity",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/vcard/service.py#L40-L68 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/vcard/service.py#L71-L92 |
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):
"""
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
... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/chatstates/utils.py#L111-L139 |
horazont/aioxmpp | aioxmpp/stanza.py | make_application_error | def make_application_error(name, tag):
"""
Create and return a **class** inheriting from :class:`.xso.XSO`. The
:attr:`.xso.XSO.TAG` is set to `tag` and the class’ name will be `name`.
In addition, the class is automatically registered with
:attr:`.Error.application_condition` using
:meth:`~.Er... | python | def make_application_error(name, tag):
"""
Create and return a **class** inheriting from :class:`.xso.XSO`. The
:attr:`.xso.XSO.TAG` is set to `tag` and the class’ name will be `name`.
In addition, the class is automatically registered with
:attr:`.Error.application_condition` using
:meth:`~.Er... | [
"def",
"make_application_error",
"(",
"name",
",",
"tag",
")",
":",
"cls",
"=",
"type",
"(",
"xso",
".",
"XSO",
")",
"(",
"name",
",",
"(",
"xso",
".",
"XSO",
",",
")",
",",
"{",
"\"TAG\"",
":",
"tag",
",",
"}",
")",
"Error",
".",
"as_application... | Create and return a **class** inheriting from :class:`.xso.XSO`. The
:attr:`.xso.XSO.TAG` is set to `tag` and the class’ name will be `name`.
In addition, the class is automatically registered with
:attr:`.Error.application_condition` using
:meth:`~.Error.as_application_condition`.
Keep in mind th... | [
"Create",
"and",
"return",
"a",
"**",
"class",
"**",
"inheriting",
"from",
":",
"class",
":",
".",
"xso",
".",
"XSO",
".",
"The",
":",
"attr",
":",
".",
"xso",
".",
"XSO",
".",
"TAG",
"is",
"set",
"to",
"tag",
"and",
"the",
"class’",
"name",
"wil... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stanza.py#L1037-L1057 |
horazont/aioxmpp | aioxmpp/stanza.py | Error.from_exception | def from_exception(cls, exc):
"""
Construct a new :class:`Error` payload from the attributes of the
exception.
:param exc: The exception to convert
:type exc: :class:`aioxmpp.errors.XMPPError`
:result: Newly constructed error payload
:rtype: :class:`Error`
... | python | def from_exception(cls, exc):
"""
Construct a new :class:`Error` payload from the attributes of the
exception.
:param exc: The exception to convert
:type exc: :class:`aioxmpp.errors.XMPPError`
:result: Newly constructed error payload
:rtype: :class:`Error`
... | [
"def",
"from_exception",
"(",
"cls",
",",
"exc",
")",
":",
"result",
"=",
"cls",
"(",
"condition",
"=",
"exc",
".",
"condition",
",",
"type_",
"=",
"exc",
".",
"TYPE",
",",
"text",
"=",
"exc",
".",
"text",
")",
"result",
".",
"application_condition",
... | Construct a new :class:`Error` payload from the attributes of the
exception.
:param exc: The exception to convert
:type exc: :class:`aioxmpp.errors.XMPPError`
:result: Newly constructed error payload
:rtype: :class:`Error`
.. versionchanged:: 0.10
The :attr... | [
"Construct",
"a",
"new",
":",
"class",
":",
"Error",
"payload",
"from",
"the",
"attributes",
"of",
"the",
"exception",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stanza.py#L356-L377 |
horazont/aioxmpp | aioxmpp/stanza.py | Error.to_exception | def to_exception(self):
"""
Convert the error payload to a :class:`~aioxmpp.errors.XMPPError`
subclass.
:result: Newly constructed exception
:rtype: :class:`aioxmpp.errors.XMPPError`
The exact type of the result depends on the :attr:`type_` (see
:class:`~aioxmpp... | python | def to_exception(self):
"""
Convert the error payload to a :class:`~aioxmpp.errors.XMPPError`
subclass.
:result: Newly constructed exception
:rtype: :class:`aioxmpp.errors.XMPPError`
The exact type of the result depends on the :attr:`type_` (see
:class:`~aioxmpp... | [
"def",
"to_exception",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"application_condition",
",",
"\"to_exception\"",
")",
":",
"result",
"=",
"self",
".",
"application_condition",
".",
"to_exception",
"(",
"self",
".",
"type_",
")",
"if",
"isin... | Convert the error payload to a :class:`~aioxmpp.errors.XMPPError`
subclass.
:result: Newly constructed exception
:rtype: :class:`aioxmpp.errors.XMPPError`
The exact type of the result depends on the :attr:`type_` (see
:class:`~aioxmpp.errors.XMPPError` about the existing subcla... | [
"Convert",
"the",
"error",
"payload",
"to",
"a",
":",
"class",
":",
"~aioxmpp",
".",
"errors",
".",
"XMPPError",
"subclass",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stanza.py#L379-L403 |
horazont/aioxmpp | aioxmpp/stanza.py | StanzaBase.autoset_id | def autoset_id(self):
"""
If the :attr:`id_` already has a non-false (false is also the empty
string!) value, this method is a no-op.
Otherwise, the :attr:`id_` attribute is filled with
:data:`RANDOM_ID_BYTES` of random data, encoded by
:func:`aioxmpp.utils.to_nmtoken`.
... | python | def autoset_id(self):
"""
If the :attr:`id_` already has a non-false (false is also the empty
string!) value, this method is a no-op.
Otherwise, the :attr:`id_` attribute is filled with
:data:`RANDOM_ID_BYTES` of random data, encoded by
:func:`aioxmpp.utils.to_nmtoken`.
... | [
"def",
"autoset_id",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"id_",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"if",
"self",
".",
"id_",
":",
"return",
"self",
".",
"id_",
"=",
"to_nmtoken",
"(",
"random",
".",
"getrandbits",
"(",
... | If the :attr:`id_` already has a non-false (false is also the empty
string!) value, this method is a no-op.
Otherwise, the :attr:`id_` attribute is filled with
:data:`RANDOM_ID_BYTES` of random data, encoded by
:func:`aioxmpp.utils.to_nmtoken`.
.. note::
This method... | [
"If",
"the",
":",
"attr",
":",
"id_",
"already",
"has",
"a",
"non",
"-",
"false",
"(",
"false",
"is",
"also",
"the",
"empty",
"string!",
")",
"value",
"this",
"method",
"is",
"a",
"no",
"-",
"op",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stanza.py#L502-L524 |
horazont/aioxmpp | aioxmpp/stanza.py | StanzaBase.make_error | def make_error(self, error):
"""
Create a new instance of this stanza (this directly uses
``type(self)``, so also works for subclasses without extra care) which
has the given `error` value set as :attr:`error`.
In addition, the :attr:`id_`, :attr:`from_` and :attr:`to` values ar... | python | def make_error(self, error):
"""
Create a new instance of this stanza (this directly uses
``type(self)``, so also works for subclasses without extra care) which
has the given `error` value set as :attr:`error`.
In addition, the :attr:`id_`, :attr:`from_` and :attr:`to` values ar... | [
"def",
"make_error",
"(",
"self",
",",
"error",
")",
":",
"obj",
"=",
"type",
"(",
"self",
")",
"(",
"from_",
"=",
"self",
".",
"to",
",",
"to",
"=",
"self",
".",
"from_",
",",
"# because flat is better than nested (sarcasm)",
"type_",
"=",
"type",
"(",
... | Create a new instance of this stanza (this directly uses
``type(self)``, so also works for subclasses without extra care) which
has the given `error` value set as :attr:`error`.
In addition, the :attr:`id_`, :attr:`from_` and :attr:`to` values are
transferred from the original (with fro... | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"stanza",
"(",
"this",
"directly",
"uses",
"type",
"(",
"self",
")",
"so",
"also",
"works",
"for",
"subclasses",
"without",
"extra",
"care",
")",
"which",
"has",
"the",
"given",
"error",
"value",
"set",
"as... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stanza.py#L533-L551 |
horazont/aioxmpp | aioxmpp/stanza.py | Message.make_reply | def make_reply(self):
"""
Create a reply for the message. The :attr:`id_` attribute is cleared in
the reply. The :attr:`from_` and :attr:`to` are swapped and the
:attr:`type_` attribute is the same as the one of the original
message.
The new :class:`Message` object is re... | python | def make_reply(self):
"""
Create a reply for the message. The :attr:`id_` attribute is cleared in
the reply. The :attr:`from_` and :attr:`to` are swapped and the
:attr:`type_` attribute is the same as the one of the original
message.
The new :class:`Message` object is re... | [
"def",
"make_reply",
"(",
"self",
")",
":",
"obj",
"=",
"super",
"(",
")",
".",
"_make_reply",
"(",
"self",
".",
"type_",
")",
"obj",
".",
"id_",
"=",
"None",
"return",
"obj"
] | Create a reply for the message. The :attr:`id_` attribute is cleared in
the reply. The :attr:`from_` and :attr:`to` are swapped and the
:attr:`type_` attribute is the same as the one of the original
message.
The new :class:`Message` object is returned. | [
"Create",
"a",
"reply",
"for",
"the",
"message",
".",
"The",
":",
"attr",
":",
"id_",
"attribute",
"is",
"cleared",
"in",
"the",
"reply",
".",
"The",
":",
"attr",
":",
"from_",
"and",
":",
"attr",
":",
"to",
"are",
"swapped",
"and",
"the",
":",
"at... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stanza.py#L729-L740 |
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):
"""
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`, ... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L539-L565 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L613-L632 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L634-L657 |
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):
"""
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.
... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L699-L722 |
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):
"""
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 | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/protocol.py#L724-L733 |
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):
"""
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
... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L274-L300 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L303-L354 |
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):
"""
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.
... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L357-L390 |
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):
"""
Request the current configuration of a subscription.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L393-L433 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L480-L504 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L507-L531 |
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):
"""
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 ... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L534-L559 |
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):
"""
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: ... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L562-L589 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L592-L628 |
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):
"""
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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L631-L653 |
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 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... | [
"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",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L656-L730 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.retract | def retract(self, jid, node, id_, *, notify=False):
"""
Retract a previously published item from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to send a notify from.
:type node: :class:`str`
... | python | def retract(self, jid, node, id_, *, notify=False):
"""
Retract a previously published item from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to send a notify from.
:type node: :class:`str`
... | [
"def",
"retract",
"(",
"self",
",",
"jid",
",",
"node",
",",
"id_",
",",
"*",
",",
"notify",
"=",
"False",
")",
":",
"retract",
"=",
"pubsub_xso",
".",
"Retract",
"(",
")",
"retract",
".",
"node",
"=",
"node",
"item",
"=",
"pubsub_xso",
".",
"Item"... | Retract a previously published item from a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to send a notify from.
:type node: :class:`str`
:param id_: The ID of the item to retract.
:type id_: :class:`... | [
"Retract",
"a",
"previously",
"published",
"item",
"from",
"a",
"node",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L749-L782 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.create | def create(self, jid, node=None):
"""
Create a new node at a service.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to create.
:type node: :class:`str` or :data:`None`
:raises aioxmpp.errors.XMPPEr... | python | def create(self, jid, node=None):
"""
Create a new node at a service.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to create.
:type node: :class:`str` or :data:`None`
:raises aioxmpp.errors.XMPPEr... | [
"def",
"create",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
")",
":",
"create",
"=",
"pubsub_xso",
".",
"Create",
"(",
")",
"create",
".",
"node",
"=",
"node",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
... | Create a new node at a service.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to create.
:type node: :class:`str` or :data:`None`
:raises aioxmpp.errors.XMPPError: as returned by the service
:return: The n... | [
"Create",
"a",
"new",
"node",
"at",
"a",
"service",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L785-L817 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.delete | def delete(self, jid, node, *, redirect_uri=None):
"""
Delete an existing node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to delete.
:type node: :class:`str` or :data:`None`
:param redirect_uri... | python | def delete(self, jid, node, *, redirect_uri=None):
"""
Delete an existing node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to delete.
:type node: :class:`str` or :data:`None`
:param redirect_uri... | [
"def",
"delete",
"(",
"self",
",",
"jid",
",",
"node",
",",
"*",
",",
"redirect_uri",
"=",
"None",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"SET",
",",
"to",
"=",
... | Delete an existing node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the PubSub node to delete.
:type node: :class:`str` or :data:`None`
:param redirect_uri: A URI to send to subscribers to indicate a
replacement fo... | [
"Delete",
"an",
"existing",
"node",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L820-L849 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_nodes | def get_nodes(self, jid, node=None):
"""
Request all nodes at a service or collection node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the collection node to query
:type node: :class:`str` or :data:`None`
:rais... | python | def get_nodes(self, jid, node=None):
"""
Request all nodes at a service or collection node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the collection node to query
:type node: :class:`str` or :data:`None`
:rais... | [
"def",
"get_nodes",
"(",
"self",
",",
"jid",
",",
"node",
"=",
"None",
")",
":",
"response",
"=",
"yield",
"from",
"self",
".",
"_disco",
".",
"query_items",
"(",
"jid",
",",
"node",
"=",
"node",
",",
")",
"result",
"=",
"[",
"]",
"for",
"item",
... | Request all nodes at a service or collection node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the collection node to query
:type node: :class:`str` or :data:`None`
:raises aioxmpp.errors.XMPPError: as returned by the service
... | [
"Request",
"all",
"nodes",
"at",
"a",
"service",
"or",
"collection",
"node",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L852-L891 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.get_node_affiliations | def get_node_affiliations(self, jid, node):
"""
Return the affiliations of other jids at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to query
:type node: :class:`str`
:raises aioxmpp.errors.XMPP... | python | def get_node_affiliations(self, jid, node):
"""
Return the affiliations of other jids at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to query
:type node: :class:`str`
:raises aioxmpp.errors.XMPP... | [
"def",
"get_node_affiliations",
"(",
"self",
",",
"jid",
",",
"node",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"GET",
",",
"to",
"=",
"jid",
",",
"payload",
"=",
"pu... | Return the affiliations of other jids at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to query
:type node: :class:`str`
:raises aioxmpp.errors.XMPPError: as returned by the service
:return: The response ... | [
"Return",
"the",
"affiliations",
"of",
"other",
"jids",
"at",
"a",
"node",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L894-L918 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.change_node_affiliations | def change_node_affiliations(self, jid, node, affiliations_to_set):
"""
Update the affiliations at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to modify
:type node: :class:`str`
:param affiliati... | python | def change_node_affiliations(self, jid, node, affiliations_to_set):
"""
Update the affiliations at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to modify
:type node: :class:`str`
:param affiliati... | [
"def",
"change_node_affiliations",
"(",
"self",
",",
"jid",
",",
"node",
",",
"affiliations_to_set",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"SET",
",",
"to",
"=",
"jid... | Update the affiliations at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to modify
:type node: :class:`str`
:param affiliations_to_set: The affiliations to set at the node.
:type affiliations_to_set: :cla... | [
"Update",
"the",
"affiliations",
"at",
"a",
"node",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L948-L982 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.change_node_subscriptions | def change_node_subscriptions(self, jid, node, subscriptions_to_set):
"""
Update the subscriptions at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to modify
:type node: :class:`str`
:param subscr... | python | def change_node_subscriptions(self, jid, node, subscriptions_to_set):
"""
Update the subscriptions at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to modify
:type node: :class:`str`
:param subscr... | [
"def",
"change_node_subscriptions",
"(",
"self",
",",
"jid",
",",
"node",
",",
"subscriptions_to_set",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"SET",
",",
"to",
"=",
"j... | Update the subscriptions at a node.
:param jid: Address of the PubSub service.
:type jid: :class:`aioxmpp.JID`
:param node: Name of the node to modify
:type node: :class:`str`
:param subscriptions_to_set: The subscriptions to set at the node.
:type subscriptions_to_set: ... | [
"Update",
"the",
"subscriptions",
"at",
"a",
"node",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L985-L1020 |
horazont/aioxmpp | aioxmpp/pubsub/service.py | PubSubClient.purge | def purge(self, jid, node):
"""
Delete all items from a node.
:param jid: JID of the PubSub service
:param node: Name of the PubSub node
:type node: :class:`str`
Requires :attr:`.xso.Feature.PURGE`.
"""
iq = aioxmpp.stanza.IQ(
type_=aioxmpp.... | python | def purge(self, jid, node):
"""
Delete all items from a node.
:param jid: JID of the PubSub service
:param node: Name of the PubSub node
:type node: :class:`str`
Requires :attr:`.xso.Feature.PURGE`.
"""
iq = aioxmpp.stanza.IQ(
type_=aioxmpp.... | [
"def",
"purge",
"(",
"self",
",",
"jid",
",",
"node",
")",
":",
"iq",
"=",
"aioxmpp",
".",
"stanza",
".",
"IQ",
"(",
"type_",
"=",
"aioxmpp",
".",
"structs",
".",
"IQType",
".",
"SET",
",",
"to",
"=",
"jid",
",",
"payload",
"=",
"pubsub_xso",
"."... | Delete all items from a node.
:param jid: JID of the PubSub service
:param node: Name of the PubSub node
:type node: :class:`str`
Requires :attr:`.xso.Feature.PURGE`. | [
"Delete",
"all",
"items",
"from",
"a",
"node",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/service.py#L1023-L1044 |
horazont/aioxmpp | aioxmpp/xso/model.py | capture_events | def capture_events(receiver, dest):
"""
Capture all events sent to `receiver` in the sequence `dest`. This is a
generator, and it is best used with ``yield from``. The observable effect
of using this generator with ``yield from`` is identical to the effect of
using `receiver` with ``yield from`` dir... | python | def capture_events(receiver, dest):
"""
Capture all events sent to `receiver` in the sequence `dest`. This is a
generator, and it is best used with ``yield from``. The observable effect
of using this generator with ``yield from`` is identical to the effect of
using `receiver` with ``yield from`` dir... | [
"def",
"capture_events",
"(",
"receiver",
",",
"dest",
")",
":",
"# the following code is a copy of the formal definition of `yield from`",
"# in PEP 380, with modifications to capture the value sent during yield",
"_i",
"=",
"iter",
"(",
"receiver",
")",
"try",
":",
"_y",
"=",... | Capture all events sent to `receiver` in the sequence `dest`. This is a
generator, and it is best used with ``yield from``. The observable effect
of using this generator with ``yield from`` is identical to the effect of
using `receiver` with ``yield from`` directly (including the return value),
but in a... | [
"Capture",
"all",
"events",
"sent",
"to",
"receiver",
"in",
"the",
"sequence",
"dest",
".",
"This",
"is",
"a",
"generator",
"and",
"it",
"is",
"best",
"used",
"with",
"yield",
"from",
".",
"The",
"observable",
"effect",
"of",
"using",
"this",
"generator",
... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L2616-L2678 |
horazont/aioxmpp | aioxmpp/xso/model.py | events_to_sax | def events_to_sax(events, dest):
"""
Convert an iterable `events` of XSO events to SAX events by calling the
matching SAX methods on `dest`
"""
name_stack = []
for ev_type, *ev_args in events:
if ev_type == "start":
name = (ev_args[0], ev_args[1])
dest.startEleme... | python | def events_to_sax(events, dest):
"""
Convert an iterable `events` of XSO events to SAX events by calling the
matching SAX methods on `dest`
"""
name_stack = []
for ev_type, *ev_args in events:
if ev_type == "start":
name = (ev_args[0], ev_args[1])
dest.startEleme... | [
"def",
"events_to_sax",
"(",
"events",
",",
"dest",
")",
":",
"name_stack",
"=",
"[",
"]",
"for",
"ev_type",
",",
"*",
"ev_args",
"in",
"events",
":",
"if",
"ev_type",
"==",
"\"start\"",
":",
"name",
"=",
"(",
"ev_args",
"[",
"0",
"]",
",",
"ev_args"... | Convert an iterable `events` of XSO events to SAX events by calling the
matching SAX methods on `dest` | [
"Convert",
"an",
"iterable",
"events",
"of",
"XSO",
"events",
"to",
"SAX",
"events",
"by",
"calling",
"the",
"matching",
"SAX",
"methods",
"on",
"dest"
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L2681-L2697 |
horazont/aioxmpp | aioxmpp/xso/model.py | XSOList.filter | def filter(self, *, type_=None, lang=None, attrs={}):
"""
Return an iterable which produces a sequence of the elements inside
this :class:`XSOList`, filtered by the criteria given as arguments. The
function starts with a working sequence consisting of the whole list.
If `type_` ... | python | def filter(self, *, type_=None, lang=None, attrs={}):
"""
Return an iterable which produces a sequence of the elements inside
this :class:`XSOList`, filtered by the criteria given as arguments. The
function starts with a working sequence consisting of the whole list.
If `type_` ... | [
"def",
"filter",
"(",
"self",
",",
"*",
",",
"type_",
"=",
"None",
",",
"lang",
"=",
"None",
",",
"attrs",
"=",
"{",
"}",
")",
":",
"result",
"=",
"self",
"if",
"type_",
"is",
"not",
"None",
":",
"result",
"=",
"self",
".",
"_filter_type",
"(",
... | Return an iterable which produces a sequence of the elements inside
this :class:`XSOList`, filtered by the criteria given as arguments. The
function starts with a working sequence consisting of the whole list.
If `type_` is not :data:`None`, elements which are not an instance of
the giv... | [
"Return",
"an",
"iterable",
"which",
"produces",
"a",
"sequence",
"of",
"the",
"elements",
"inside",
"this",
":",
"class",
":",
"XSOList",
"filtered",
"by",
"the",
"criteria",
"given",
"as",
"arguments",
".",
"The",
"function",
"starts",
"with",
"a",
"workin... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L213-L260 |
horazont/aioxmpp | aioxmpp/xso/model.py | XSOList.filtered | def filtered(self, *, type_=None, lang=None, attrs={}):
"""
This method is a convencience wrapper around :meth:`filter` which
evaluates the result into a list and returns that list.
"""
return list(self.filter(type_=type_, lang=lang, attrs=attrs)) | python | def filtered(self, *, type_=None, lang=None, attrs={}):
"""
This method is a convencience wrapper around :meth:`filter` which
evaluates the result into a list and returns that list.
"""
return list(self.filter(type_=type_, lang=lang, attrs=attrs)) | [
"def",
"filtered",
"(",
"self",
",",
"*",
",",
"type_",
"=",
"None",
",",
"lang",
"=",
"None",
",",
"attrs",
"=",
"{",
"}",
")",
":",
"return",
"list",
"(",
"self",
".",
"filter",
"(",
"type_",
"=",
"type_",
",",
"lang",
"=",
"lang",
",",
"attr... | This method is a convencience wrapper around :meth:`filter` which
evaluates the result into a list and returns that list. | [
"This",
"method",
"is",
"a",
"convencience",
"wrapper",
"around",
":",
"meth",
":",
"filter",
"which",
"evaluates",
"the",
"result",
"into",
"a",
"list",
"and",
"returns",
"that",
"list",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L262-L267 |
horazont/aioxmpp | aioxmpp/xso/model.py | Text.from_value | def from_value(self, instance, value):
"""
Convert the given value using the set `type_` and store it into
`instance`’ attribute.
"""
try:
parsed = self.type_.parse(value)
except (TypeError, ValueError):
if self.erroneous_as_absent:
... | python | def from_value(self, instance, value):
"""
Convert the given value using the set `type_` and store it into
`instance`’ attribute.
"""
try:
parsed = self.type_.parse(value)
except (TypeError, ValueError):
if self.erroneous_as_absent:
... | [
"def",
"from_value",
"(",
"self",
",",
"instance",
",",
"value",
")",
":",
"try",
":",
"parsed",
"=",
"self",
".",
"type_",
".",
"parse",
"(",
"value",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"if",
"self",
".",
"erroneous_as_absen... | Convert the given value using the set `type_` and store it into
`instance`’ attribute. | [
"Convert",
"the",
"given",
"value",
"using",
"the",
"set",
"type_",
"and",
"store",
"it",
"into",
"instance",
"’",
"attribute",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L403-L415 |
horazont/aioxmpp | aioxmpp/xso/model.py | Text.to_sax | def to_sax(self, instance, dest):
"""
Assign the formatted value stored at `instance`’ attribute to the text
of `el`.
If the `value` is :data:`None`, no text is generated.
"""
value = self.__get__(instance, type(instance))
if value is None:
return
... | python | def to_sax(self, instance, dest):
"""
Assign the formatted value stored at `instance`’ attribute to the text
of `el`.
If the `value` is :data:`None`, no text is generated.
"""
value = self.__get__(instance, type(instance))
if value is None:
return
... | [
"def",
"to_sax",
"(",
"self",
",",
"instance",
",",
"dest",
")",
":",
"value",
"=",
"self",
".",
"__get__",
"(",
"instance",
",",
"type",
"(",
"instance",
")",
")",
"if",
"value",
"is",
"None",
":",
"return",
"dest",
".",
"characters",
"(",
"self",
... | Assign the formatted value stored at `instance`’ attribute to the text
of `el`.
If the `value` is :data:`None`, no text is generated. | [
"Assign",
"the",
"formatted",
"value",
"stored",
"at",
"instance",
"’",
"attribute",
"to",
"the",
"text",
"of",
"el",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L417-L427 |
horazont/aioxmpp | aioxmpp/xso/model.py | Child.from_events | def from_events(self, instance, ev_args, ctx):
"""
Detect the object to instanciate from the arguments `ev_args` of the
``"start"`` event. The new object is stored at the corresponding
descriptor attribute on `instance`.
This method is suspendable.
"""
obj = yiel... | python | def from_events(self, instance, ev_args, ctx):
"""
Detect the object to instanciate from the arguments `ev_args` of the
``"start"`` event. The new object is stored at the corresponding
descriptor attribute on `instance`.
This method is suspendable.
"""
obj = yiel... | [
"def",
"from_events",
"(",
"self",
",",
"instance",
",",
"ev_args",
",",
"ctx",
")",
":",
"obj",
"=",
"yield",
"from",
"self",
".",
"_process",
"(",
"instance",
",",
"ev_args",
",",
"ctx",
")",
"self",
".",
"__set__",
"(",
"instance",
",",
"obj",
")"... | Detect the object to instanciate from the arguments `ev_args` of the
``"start"`` event. The new object is stored at the corresponding
descriptor attribute on `instance`.
This method is suspendable. | [
"Detect",
"the",
"object",
"to",
"instanciate",
"from",
"the",
"arguments",
"ev_args",
"of",
"the",
"start",
"event",
".",
"The",
"new",
"object",
"is",
"stored",
"at",
"the",
"corresponding",
"descriptor",
"attribute",
"on",
"instance",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L556-L566 |
horazont/aioxmpp | aioxmpp/xso/model.py | Child.to_sax | def to_sax(self, instance, dest):
"""
Take the object associated with this descriptor on `instance` and
serialize it as child into the given :class:`lxml.etree.Element`
`parent`.
If the object is :data:`None`, no content is generated.
"""
obj = self.__get__(insta... | python | def to_sax(self, instance, dest):
"""
Take the object associated with this descriptor on `instance` and
serialize it as child into the given :class:`lxml.etree.Element`
`parent`.
If the object is :data:`None`, no content is generated.
"""
obj = self.__get__(insta... | [
"def",
"to_sax",
"(",
"self",
",",
"instance",
",",
"dest",
")",
":",
"obj",
"=",
"self",
".",
"__get__",
"(",
"instance",
",",
"type",
"(",
"instance",
")",
")",
"if",
"obj",
"is",
"None",
":",
"return",
"obj",
".",
"unparse_to_sax",
"(",
"dest",
... | Take the object associated with this descriptor on `instance` and
serialize it as child into the given :class:`lxml.etree.Element`
`parent`.
If the object is :data:`None`, no content is generated. | [
"Take",
"the",
"object",
"associated",
"with",
"this",
"descriptor",
"on",
"instance",
"and",
"serialize",
"it",
"as",
"child",
"into",
"the",
"given",
":",
"class",
":",
"lxml",
".",
"etree",
".",
"Element",
"parent",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L576-L587 |
horazont/aioxmpp | aioxmpp/xso/model.py | ChildList.from_events | def from_events(self, instance, ev_args, ctx):
"""
Like :meth:`.Child.from_events`, but instead of replacing the attribute
value, the new object is appended to the list.
"""
obj = yield from self._process(instance, ev_args, ctx)
self.__get__(instance, type(instance)).app... | python | def from_events(self, instance, ev_args, ctx):
"""
Like :meth:`.Child.from_events`, but instead of replacing the attribute
value, the new object is appended to the list.
"""
obj = yield from self._process(instance, ev_args, ctx)
self.__get__(instance, type(instance)).app... | [
"def",
"from_events",
"(",
"self",
",",
"instance",
",",
"ev_args",
",",
"ctx",
")",
":",
"obj",
"=",
"yield",
"from",
"self",
".",
"_process",
"(",
"instance",
",",
"ev_args",
",",
"ctx",
")",
"self",
".",
"__get__",
"(",
"instance",
",",
"type",
"(... | Like :meth:`.Child.from_events`, but instead of replacing the attribute
value, the new object is appended to the list. | [
"Like",
":",
"meth",
":",
".",
"Child",
".",
"from_events",
"but",
"instead",
"of",
"replacing",
"the",
"attribute",
"value",
"the",
"new",
"object",
"is",
"appended",
"to",
"the",
"list",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L622-L630 |
horazont/aioxmpp | aioxmpp/xso/model.py | Collector.from_events | def from_events(self, instance, ev_args, ctx):
"""
Collect the events and convert them to a single XML subtree, which then
gets appended to the list at `instance`. `ev_args` must be the
arguments of the ``"start"`` event of the new child.
This method is suspendable.
"""
... | python | def from_events(self, instance, ev_args, ctx):
"""
Collect the events and convert them to a single XML subtree, which then
gets appended to the list at `instance`. `ev_args` must be the
arguments of the ``"start"`` event of the new child.
This method is suspendable.
"""
... | [
"def",
"from_events",
"(",
"self",
",",
"instance",
",",
"ev_args",
",",
"ctx",
")",
":",
"# goal: collect all elements starting with the element for which we got",
"# the start-ev_args in a lxml.etree.Element.",
"def",
"make_from_args",
"(",
"ev_args",
",",
"parent",
")",
... | Collect the events and convert them to a single XML subtree, which then
gets appended to the list at `instance`. `ev_args` must be the
arguments of the ``"start"`` event of the new child.
This method is suspendable. | [
"Collect",
"the",
"events",
"and",
"convert",
"them",
"to",
"a",
"single",
"XML",
"subtree",
"which",
"then",
"gets",
"appended",
"to",
"the",
"list",
"at",
"instance",
".",
"ev_args",
"must",
"be",
"the",
"arguments",
"of",
"the",
"start",
"event",
"of",
... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L687-L730 |
horazont/aioxmpp | aioxmpp/xso/model.py | Attr.handle_missing | def handle_missing(self, instance, ctx):
"""
Handle a missing attribute on `instance`. This is called whenever no
value for the attribute is found during parsing. The call to
:meth:`missing` is independent of the value of `required`.
If the `missing` callback is not :data:`None`... | python | def handle_missing(self, instance, ctx):
"""
Handle a missing attribute on `instance`. This is called whenever no
value for the attribute is found during parsing. The call to
:meth:`missing` is independent of the value of `required`.
If the `missing` callback is not :data:`None`... | [
"def",
"handle_missing",
"(",
"self",
",",
"instance",
",",
"ctx",
")",
":",
"if",
"self",
".",
"missing",
"is",
"not",
"None",
":",
"value",
"=",
"self",
".",
"missing",
"(",
"instance",
",",
"ctx",
")",
"if",
"value",
"is",
"not",
"None",
":",
"s... | Handle a missing attribute on `instance`. This is called whenever no
value for the attribute is found during parsing. The call to
:meth:`missing` is independent of the value of `required`.
If the `missing` callback is not :data:`None`, it is called with the
`instance` and the `ctx` as a... | [
"Handle",
"a",
"missing",
"attribute",
"on",
"instance",
".",
"This",
"is",
"called",
"whenever",
"no",
"value",
"for",
"the",
"attribute",
"is",
"found",
"during",
"parsing",
".",
"The",
"call",
"to",
":",
"meth",
":",
"missing",
"is",
"independent",
"of"... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L812-L838 |
horazont/aioxmpp | aioxmpp/xso/model.py | Attr.to_dict | def to_dict(self, instance, d):
"""
Override the implementation from :class:`Text` by storing the formatted
value in the XML attribute instead of the character data.
If the value is :data:`None`, no element is generated.
"""
value = self.__get__(instance, type(instance)... | python | def to_dict(self, instance, d):
"""
Override the implementation from :class:`Text` by storing the formatted
value in the XML attribute instead of the character data.
If the value is :data:`None`, no element is generated.
"""
value = self.__get__(instance, type(instance)... | [
"def",
"to_dict",
"(",
"self",
",",
"instance",
",",
"d",
")",
":",
"value",
"=",
"self",
".",
"__get__",
"(",
"instance",
",",
"type",
"(",
"instance",
")",
")",
"if",
"value",
"==",
"self",
".",
"default",
":",
"return",
"d",
"[",
"self",
".",
... | Override the implementation from :class:`Text` by storing the formatted
value in the XML attribute instead of the character data.
If the value is :data:`None`, no element is generated. | [
"Override",
"the",
"implementation",
"from",
":",
"class",
":",
"Text",
"by",
"storing",
"the",
"formatted",
"value",
"in",
"the",
"XML",
"attribute",
"instead",
"of",
"the",
"character",
"data",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L850-L862 |
horazont/aioxmpp | aioxmpp/xso/model.py | ChildText.from_events | def from_events(self, instance, ev_args, ctx):
"""
Starting with the element to which the start event information in
`ev_args` belongs, parse text data. If any children are encountered,
:attr:`child_policy` is enforced (see
:class:`UnknownChildPolicy`). Likewise, if the start eve... | python | def from_events(self, instance, ev_args, ctx):
"""
Starting with the element to which the start event information in
`ev_args` belongs, parse text data. If any children are encountered,
:attr:`child_policy` is enforced (see
:class:`UnknownChildPolicy`). Likewise, if the start eve... | [
"def",
"from_events",
"(",
"self",
",",
"instance",
",",
"ev_args",
",",
"ctx",
")",
":",
"# goal: take all text inside the child element and collect it as",
"# attribute value",
"attrs",
"=",
"ev_args",
"[",
"2",
"]",
"if",
"attrs",
"and",
"self",
".",
"attr_policy... | Starting with the element to which the start event information in
`ev_args` belongs, parse text data. If any children are encountered,
:attr:`child_policy` is enforced (see
:class:`UnknownChildPolicy`). Likewise, if the start event contains
attributes, :attr:`attr_policy` is enforced
... | [
"Starting",
"with",
"the",
"element",
"to",
"which",
"the",
"start",
"event",
"information",
"in",
"ev_args",
"belongs",
"parse",
"text",
"data",
".",
"If",
"any",
"children",
"are",
"encountered",
":",
"attr",
":",
"child_policy",
"is",
"enforced",
"(",
"se... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L943-L988 |
horazont/aioxmpp | aioxmpp/xso/model.py | ChildText.to_sax | def to_sax(self, instance, dest):
"""
Create a child node at `parent` with the tag :attr:`tag`. Set the text
contents to the value of the attribute which this descriptor represents
at `instance`.
If the value is :data:`None`, no element is generated.
"""
value =... | python | def to_sax(self, instance, dest):
"""
Create a child node at `parent` with the tag :attr:`tag`. Set the text
contents to the value of the attribute which this descriptor represents
at `instance`.
If the value is :data:`None`, no element is generated.
"""
value =... | [
"def",
"to_sax",
"(",
"self",
",",
"instance",
",",
"dest",
")",
":",
"value",
"=",
"self",
".",
"__get__",
"(",
"instance",
",",
"type",
"(",
"instance",
")",
")",
"if",
"value",
"==",
"self",
".",
"default",
":",
"return",
"if",
"self",
".",
"dec... | Create a child node at `parent` with the tag :attr:`tag`. Set the text
contents to the value of the attribute which this descriptor represents
at `instance`.
If the value is :data:`None`, no element is generated. | [
"Create",
"a",
"child",
"node",
"at",
"parent",
"with",
"the",
"tag",
":",
"attr",
":",
"tag",
".",
"Set",
"the",
"text",
"contents",
"to",
"the",
"value",
"of",
"the",
"attribute",
"which",
"this",
"descriptor",
"represents",
"at",
"instance",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L990-L1011 |
horazont/aioxmpp | aioxmpp/xso/model.py | ChildMap.fill_into_dict | def fill_into_dict(self, items, dest):
"""
Take an iterable of `items` and group it into the given `dest` dict,
using the :attr:`key` function.
The `dest` dict must either already contain the keys which are
generated by the :attr:`key` function for the items in `items`, or must
... | python | def fill_into_dict(self, items, dest):
"""
Take an iterable of `items` and group it into the given `dest` dict,
using the :attr:`key` function.
The `dest` dict must either already contain the keys which are
generated by the :attr:`key` function for the items in `items`, or must
... | [
"def",
"fill_into_dict",
"(",
"self",
",",
"items",
",",
"dest",
")",
":",
"for",
"item",
"in",
"items",
":",
"dest",
"[",
"self",
".",
"key",
"(",
"item",
")",
"]",
".",
"append",
"(",
"item",
")"
] | Take an iterable of `items` and group it into the given `dest` dict,
using the :attr:`key` function.
The `dest` dict must either already contain the keys which are
generated by the :attr:`key` function for the items in `items`, or must
default them suitably. The values of the affected k... | [
"Take",
"an",
"iterable",
"of",
"items",
"and",
"group",
"it",
"into",
"the",
"given",
"dest",
"dict",
"using",
"the",
":",
"attr",
":",
"key",
"function",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L1063-L1075 |
horazont/aioxmpp | aioxmpp/xso/model.py | ChildMap.from_events | def from_events(self, instance, ev_args, ctx):
"""
Like :meth:`.ChildList.from_events`, but the object is appended to the
list associated with its tag in the dict.
"""
tag = ev_args[0], ev_args[1]
cls = self._tag_map[tag]
obj = yield from cls.parse_events(ev_args... | python | def from_events(self, instance, ev_args, ctx):
"""
Like :meth:`.ChildList.from_events`, but the object is appended to the
list associated with its tag in the dict.
"""
tag = ev_args[0], ev_args[1]
cls = self._tag_map[tag]
obj = yield from cls.parse_events(ev_args... | [
"def",
"from_events",
"(",
"self",
",",
"instance",
",",
"ev_args",
",",
"ctx",
")",
":",
"tag",
"=",
"ev_args",
"[",
"0",
"]",
",",
"ev_args",
"[",
"1",
"]",
"cls",
"=",
"self",
".",
"_tag_map",
"[",
"tag",
"]",
"obj",
"=",
"yield",
"from",
"cls... | Like :meth:`.ChildList.from_events`, but the object is appended to the
list associated with its tag in the dict. | [
"Like",
":",
"meth",
":",
".",
"ChildList",
".",
"from_events",
"but",
"the",
"object",
"is",
"appended",
"to",
"the",
"list",
"associated",
"with",
"its",
"tag",
"in",
"the",
"dict",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L1077-L1087 |
horazont/aioxmpp | aioxmpp/xso/model.py | XMLStreamClass.parse_events | def parse_events(cls, ev_args, parent_ctx):
"""
Create an instance of this class, using the events sent into this
function. `ev_args` must be the event arguments of the ``"start"``
event.
.. seealso::
You probably should not call this method directly, but instead use... | python | def parse_events(cls, ev_args, parent_ctx):
"""
Create an instance of this class, using the events sent into this
function. `ev_args` must be the event arguments of the ``"start"``
event.
.. seealso::
You probably should not call this method directly, but instead use... | [
"def",
"parse_events",
"(",
"cls",
",",
"ev_args",
",",
"parent_ctx",
")",
":",
"with",
"parent_ctx",
"as",
"ctx",
":",
"obj",
"=",
"cls",
".",
"__new__",
"(",
"cls",
")",
"attrs",
"=",
"ev_args",
"[",
"2",
"]",
"attr_map",
"=",
"cls",
".",
"ATTR_MAP... | Create an instance of this class, using the events sent into this
function. `ev_args` must be the event arguments of the ``"start"``
event.
.. seealso::
You probably should not call this method directly, but instead use
:class:`XSOParser` with a :class:`SAXDriver`.
... | [
"Create",
"an",
"instance",
"of",
"this",
"class",
"using",
"the",
"events",
"sent",
"into",
"this",
"function",
".",
"ev_args",
"must",
"be",
"the",
"event",
"arguments",
"of",
"the",
"start",
"event",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L1863-L2000 |
horazont/aioxmpp | aioxmpp/xso/model.py | XMLStreamClass.register_child | def register_child(cls, prop, child_cls):
"""
Register a new :class:`XMLStreamClass` instance `child_cls` for a given
:class:`Child` descriptor `prop`.
.. warning::
This method cannot be used after a class has been derived from this
class. This is for consistency:... | python | def register_child(cls, prop, child_cls):
"""
Register a new :class:`XMLStreamClass` instance `child_cls` for a given
:class:`Child` descriptor `prop`.
.. warning::
This method cannot be used after a class has been derived from this
class. This is for consistency:... | [
"def",
"register_child",
"(",
"cls",
",",
"prop",
",",
"child_cls",
")",
":",
"if",
"cls",
".",
"__subclasses__",
"(",
")",
":",
"raise",
"TypeError",
"(",
"\"register_child is forbidden on classes with subclasses\"",
"\" (subclasses: {})\"",
".",
"format",
"(",
"\"... | Register a new :class:`XMLStreamClass` instance `child_cls` for a given
:class:`Child` descriptor `prop`.
.. warning::
This method cannot be used after a class has been derived from this
class. This is for consistency: the method modifies the bookkeeping
attributes of ... | [
"Register",
"a",
"new",
":",
"class",
":",
"XMLStreamClass",
"instance",
"child_cls",
"for",
"a",
"given",
":",
"class",
":",
"Child",
"descriptor",
"prop",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L2002-L2046 |
horazont/aioxmpp | aioxmpp/xso/model.py | CapturingXMLStreamClass.parse_events | def parse_events(cls, ev_args, parent_ctx):
"""
Capture the events sent to :meth:`.XSO.parse_events`,
including the initial `ev_args` to a list and call
:meth:`_set_captured_events` on the result of
:meth:`.XSO.parse_events`.
Like the method it overrides, :meth:`parse_ev... | python | def parse_events(cls, ev_args, parent_ctx):
"""
Capture the events sent to :meth:`.XSO.parse_events`,
including the initial `ev_args` to a list and call
:meth:`_set_captured_events` on the result of
:meth:`.XSO.parse_events`.
Like the method it overrides, :meth:`parse_ev... | [
"def",
"parse_events",
"(",
"cls",
",",
"ev_args",
",",
"parent_ctx",
")",
":",
"dest",
"=",
"[",
"(",
"\"start\"",
",",
")",
"+",
"tuple",
"(",
"ev_args",
")",
"]",
"result",
"=",
"yield",
"from",
"capture_events",
"(",
"super",
"(",
")",
".",
"pars... | Capture the events sent to :meth:`.XSO.parse_events`,
including the initial `ev_args` to a list and call
:meth:`_set_captured_events` on the result of
:meth:`.XSO.parse_events`.
Like the method it overrides, :meth:`parse_events` is suspendable. | [
"Capture",
"the",
"events",
"sent",
"to",
":",
"meth",
":",
".",
"XSO",
".",
"parse_events",
"including",
"the",
"initial",
"ev_args",
"to",
"a",
"list",
"and",
"call",
":",
"meth",
":",
"_set_captured_events",
"on",
"the",
"result",
"of",
":",
"meth",
"... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L2065-L2082 |
horazont/aioxmpp | aioxmpp/xso/model.py | XSOParser.add_class | def add_class(self, cls, callback):
"""
Add a class `cls` for parsing as root level element. When an object of
`cls` type has been completely parsed, `callback` is called with the
object as argument.
"""
if cls.TAG in self._tag_map:
raise ValueError(
... | python | def add_class(self, cls, callback):
"""
Add a class `cls` for parsing as root level element. When an object of
`cls` type has been completely parsed, `callback` is called with the
object as argument.
"""
if cls.TAG in self._tag_map:
raise ValueError(
... | [
"def",
"add_class",
"(",
"self",
",",
"cls",
",",
"callback",
")",
":",
"if",
"cls",
".",
"TAG",
"in",
"self",
".",
"_tag_map",
":",
"raise",
"ValueError",
"(",
"\"duplicate tag: {!r} is already handled by {}\"",
".",
"format",
"(",
"cls",
".",
"TAG",
",",
... | Add a class `cls` for parsing as root level element. When an object of
`cls` type has been completely parsed, `callback` is called with the
object as argument. | [
"Add",
"a",
"class",
"cls",
"for",
"parsing",
"as",
"root",
"level",
"element",
".",
"When",
"an",
"object",
"of",
"cls",
"type",
"has",
"been",
"completely",
"parsed",
"callback",
"is",
"called",
"with",
"the",
"object",
"as",
"argument",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L2496-L2508 |
horazont/aioxmpp | aioxmpp/xso/model.py | XSOParser.remove_class | def remove_class(self, cls):
"""
Remove a XSO class `cls` from parsing. This method raises
:class:`KeyError` with the classes :attr:`TAG` attribute as argument if
removing fails because the class is not registered.
"""
del self._tag_map[cls.TAG]
del self._class_ma... | python | def remove_class(self, cls):
"""
Remove a XSO class `cls` from parsing. This method raises
:class:`KeyError` with the classes :attr:`TAG` attribute as argument if
removing fails because the class is not registered.
"""
del self._tag_map[cls.TAG]
del self._class_ma... | [
"def",
"remove_class",
"(",
"self",
",",
"cls",
")",
":",
"del",
"self",
".",
"_tag_map",
"[",
"cls",
".",
"TAG",
"]",
"del",
"self",
".",
"_class_map",
"[",
"cls",
"]"
] | Remove a XSO class `cls` from parsing. This method raises
:class:`KeyError` with the classes :attr:`TAG` attribute as argument if
removing fails because the class is not registered. | [
"Remove",
"a",
"XSO",
"class",
"cls",
"from",
"parsing",
".",
"This",
"method",
"raises",
":",
"class",
":",
"KeyError",
"with",
"the",
"classes",
":",
"attr",
":",
"TAG",
"attribute",
"as",
"argument",
"if",
"removing",
"fails",
"because",
"the",
"class",... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/model.py#L2536-L2543 |
horazont/aioxmpp | aioxmpp/stringprep.py | check_against_tables | def check_against_tables(chars, tables):
"""
Perform a check against the table predicates in `tables`. `tables` must be
a reusable iterable containing characteristic functions of character sets,
that is, functions which return :data:`True` if the character is in the
table.
The function returns ... | python | def check_against_tables(chars, tables):
"""
Perform a check against the table predicates in `tables`. `tables` must be
a reusable iterable containing characteristic functions of character sets,
that is, functions which return :data:`True` if the character is in the
table.
The function returns ... | [
"def",
"check_against_tables",
"(",
"chars",
",",
"tables",
")",
":",
"for",
"c",
"in",
"chars",
":",
"if",
"any",
"(",
"in_table",
"(",
"c",
")",
"for",
"in_table",
"in",
"tables",
")",
":",
"return",
"c",
"return",
"None"
] | Perform a check against the table predicates in `tables`. `tables` must be
a reusable iterable containing characteristic functions of character sets,
that is, functions which return :data:`True` if the character is in the
table.
The function returns the first character occuring in any of the tables or
... | [
"Perform",
"a",
"check",
"against",
"the",
"table",
"predicates",
"in",
"tables",
".",
"tables",
"must",
"be",
"a",
"reusable",
"iterable",
"containing",
"characteristic",
"functions",
"of",
"character",
"sets",
"that",
"is",
"functions",
"which",
"return",
":",... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stringprep.py#L55-L70 |
horazont/aioxmpp | aioxmpp/stringprep.py | check_bidi | def check_bidi(chars):
"""
Check proper bidirectionality as per stringprep. Operates on a list of
unicode characters provided in `chars`.
"""
# the empty string is valid, as it cannot violate the RandALCat constraints
if not chars:
return
# first_is_RorAL = unicodedata.bidirectiona... | python | def check_bidi(chars):
"""
Check proper bidirectionality as per stringprep. Operates on a list of
unicode characters provided in `chars`.
"""
# the empty string is valid, as it cannot violate the RandALCat constraints
if not chars:
return
# first_is_RorAL = unicodedata.bidirectiona... | [
"def",
"check_bidi",
"(",
"chars",
")",
":",
"# the empty string is valid, as it cannot violate the RandALCat constraints",
"if",
"not",
"chars",
":",
"return",
"# first_is_RorAL = unicodedata.bidirectional(chars[0]) in {\"R\", \"AL\"}",
"# if first_is_RorAL:",
"has_RandALCat",
"=",
... | Check proper bidirectionality as per stringprep. Operates on a list of
unicode characters provided in `chars`. | [
"Check",
"proper",
"bidirectionality",
"as",
"per",
"stringprep",
".",
"Operates",
"on",
"a",
"list",
"of",
"unicode",
"characters",
"provided",
"in",
"chars",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stringprep.py#L81-L104 |
horazont/aioxmpp | aioxmpp/stringprep.py | check_prohibited_output | def check_prohibited_output(chars, bad_tables):
"""
Check against prohibited output, by checking whether any of the characters
from `chars` are in any of the `bad_tables`.
Operates in-place on a list of code points from `chars`.
"""
violator = check_against_tables(chars, bad_tables)
if viol... | python | def check_prohibited_output(chars, bad_tables):
"""
Check against prohibited output, by checking whether any of the characters
from `chars` are in any of the `bad_tables`.
Operates in-place on a list of code points from `chars`.
"""
violator = check_against_tables(chars, bad_tables)
if viol... | [
"def",
"check_prohibited_output",
"(",
"chars",
",",
"bad_tables",
")",
":",
"violator",
"=",
"check_against_tables",
"(",
"chars",
",",
"bad_tables",
")",
"if",
"violator",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Input contains invalid unicode code... | Check against prohibited output, by checking whether any of the characters
from `chars` are in any of the `bad_tables`.
Operates in-place on a list of code points from `chars`. | [
"Check",
"against",
"prohibited",
"output",
"by",
"checking",
"whether",
"any",
"of",
"the",
"characters",
"from",
"chars",
"are",
"in",
"any",
"of",
"the",
"bad_tables",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stringprep.py#L107-L117 |
horazont/aioxmpp | aioxmpp/stringprep.py | check_unassigned | def check_unassigned(chars, bad_tables):
"""
Check that `chars` does not contain any unassigned code points as per
the given list of `bad_tables`.
Operates on a list of unicode code points provided in `chars`.
"""
bad_tables = (
stringprep.in_table_a1,)
violator = check_against_tab... | python | def check_unassigned(chars, bad_tables):
"""
Check that `chars` does not contain any unassigned code points as per
the given list of `bad_tables`.
Operates on a list of unicode code points provided in `chars`.
"""
bad_tables = (
stringprep.in_table_a1,)
violator = check_against_tab... | [
"def",
"check_unassigned",
"(",
"chars",
",",
"bad_tables",
")",
":",
"bad_tables",
"=",
"(",
"stringprep",
".",
"in_table_a1",
",",
")",
"violator",
"=",
"check_against_tables",
"(",
"chars",
",",
"bad_tables",
")",
"if",
"violator",
"is",
"not",
"None",
":... | Check that `chars` does not contain any unassigned code points as per
the given list of `bad_tables`.
Operates on a list of unicode code points provided in `chars`. | [
"Check",
"that",
"chars",
"does",
"not",
"contain",
"any",
"unassigned",
"code",
"points",
"as",
"per",
"the",
"given",
"list",
"of",
"bad_tables",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stringprep.py#L120-L133 |
horazont/aioxmpp | aioxmpp/stringprep.py | nodeprep | def nodeprep(string, allow_unassigned=False):
"""
Process the given `string` using the Nodeprep (`RFC 6122`_) profile. In the
error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError` is
raised.
"""
chars = list(string)
_nodeprep_do_mapping(chars)
do_normalization(chars)
... | python | def nodeprep(string, allow_unassigned=False):
"""
Process the given `string` using the Nodeprep (`RFC 6122`_) profile. In the
error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError` is
raised.
"""
chars = list(string)
_nodeprep_do_mapping(chars)
do_normalization(chars)
... | [
"def",
"nodeprep",
"(",
"string",
",",
"allow_unassigned",
"=",
"False",
")",
":",
"chars",
"=",
"list",
"(",
"string",
")",
"_nodeprep_do_mapping",
"(",
"chars",
")",
"do_normalization",
"(",
"chars",
")",
"check_prohibited_output",
"(",
"chars",
",",
"(",
... | Process the given `string` using the Nodeprep (`RFC 6122`_) profile. In the
error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError` is
raised. | [
"Process",
"the",
"given",
"string",
"using",
"the",
"Nodeprep",
"(",
"RFC",
"6122",
"_",
")",
"profile",
".",
"In",
"the",
"error",
"cases",
"defined",
"in",
"RFC",
"3454",
"_",
"(",
"stringprep",
")",
"a",
":",
"class",
":",
"ValueError",
"is",
"rais... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stringprep.py#L149-L185 |
horazont/aioxmpp | aioxmpp/stringprep.py | resourceprep | def resourceprep(string, allow_unassigned=False):
"""
Process the given `string` using the Resourceprep (`RFC 6122`_) profile. In
the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError`
is raised.
"""
chars = list(string)
_resourceprep_do_mapping(chars)
do_normalizati... | python | def resourceprep(string, allow_unassigned=False):
"""
Process the given `string` using the Resourceprep (`RFC 6122`_) profile. In
the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError`
is raised.
"""
chars = list(string)
_resourceprep_do_mapping(chars)
do_normalizati... | [
"def",
"resourceprep",
"(",
"string",
",",
"allow_unassigned",
"=",
"False",
")",
":",
"chars",
"=",
"list",
"(",
"string",
")",
"_resourceprep_do_mapping",
"(",
"chars",
")",
"do_normalization",
"(",
"chars",
")",
"check_prohibited_output",
"(",
"chars",
",",
... | Process the given `string` using the Resourceprep (`RFC 6122`_) profile. In
the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError`
is raised. | [
"Process",
"the",
"given",
"string",
"using",
"the",
"Resourceprep",
"(",
"RFC",
"6122",
"_",
")",
"profile",
".",
"In",
"the",
"error",
"cases",
"defined",
"in",
"RFC",
"3454",
"_",
"(",
"stringprep",
")",
"a",
":",
"class",
":",
"ValueError",
"is",
"... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stringprep.py#L198-L232 |
horazont/aioxmpp | aioxmpp/avatar/service.py | AvatarSet.add_avatar_image | def add_avatar_image(self, mime_type, *, id_=None,
image_bytes=None, width=None, height=None,
url=None, nbytes=None):
"""
Add a source of the avatar image.
All sources of an avatar image added to an avatar set must be
*the same image*, i... | python | def add_avatar_image(self, mime_type, *, id_=None,
image_bytes=None, width=None, height=None,
url=None, nbytes=None):
"""
Add a source of the avatar image.
All sources of an avatar image added to an avatar set must be
*the same image*, i... | [
"def",
"add_avatar_image",
"(",
"self",
",",
"mime_type",
",",
"*",
",",
"id_",
"=",
"None",
",",
"image_bytes",
"=",
"None",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
",",
"url",
"=",
"None",
",",
"nbytes",
"=",
"None",
")",
":",
"if"... | Add a source of the avatar image.
All sources of an avatar image added to an avatar set must be
*the same image*, in different formats and sizes.
:param mime_type: The MIME type of the avatar image.
:param id_: The SHA1 of the image data.
:param nbytes: The size of the image da... | [
"Add",
"a",
"source",
"of",
"the",
"avatar",
"image",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/avatar/service.py#L95-L183 |
horazont/aioxmpp | aioxmpp/avatar/service.py | AvatarService.get_avatar_metadata | def get_avatar_metadata(self, jid, *, require_fresh=False,
disable_pep=False):
"""
Retrieve a list of avatar descriptors.
:param jid: the JID for which to retrieve the avatar metadata.
:type jid: :class:`aioxmpp.JID`
:param require_fresh: if true, do ... | python | def get_avatar_metadata(self, jid, *, require_fresh=False,
disable_pep=False):
"""
Retrieve a list of avatar descriptors.
:param jid: the JID for which to retrieve the avatar metadata.
:type jid: :class:`aioxmpp.JID`
:param require_fresh: if true, do ... | [
"def",
"get_avatar_metadata",
"(",
"self",
",",
"jid",
",",
"*",
",",
"require_fresh",
"=",
"False",
",",
"disable_pep",
"=",
"False",
")",
":",
"if",
"require_fresh",
":",
"self",
".",
"_metadata_cache",
".",
"pop",
"(",
"jid",
",",
"None",
")",
"else",... | Retrieve a list of avatar descriptors.
:param jid: the JID for which to retrieve the avatar metadata.
:type jid: :class:`aioxmpp.JID`
:param require_fresh: if true, do not return results from the
avatar metadata chache, but retrieve them again from the server.
:type require_... | [
"Retrieve",
"a",
"list",
"of",
"avatar",
"descriptors",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/avatar/service.py#L835-L896 |
horazont/aioxmpp | aioxmpp/avatar/service.py | AvatarService.publish_avatar_set | def publish_avatar_set(self, avatar_set):
"""
Make `avatar_set` the current avatar of the jid associated with this
connection.
If :attr:`synchronize_vcard` is true and PEP is available the
vCard is only synchronized if the PEP update is successful.
This means publishing... | python | def publish_avatar_set(self, avatar_set):
"""
Make `avatar_set` the current avatar of the jid associated with this
connection.
If :attr:`synchronize_vcard` is true and PEP is available the
vCard is only synchronized if the PEP update is successful.
This means publishing... | [
"def",
"publish_avatar_set",
"(",
"self",
",",
"avatar_set",
")",
":",
"id_",
"=",
"avatar_set",
".",
"png_id",
"done",
"=",
"False",
"with",
"(",
"yield",
"from",
"self",
".",
"_publish_lock",
")",
":",
"if",
"(",
"yield",
"from",
"self",
".",
"_pep",
... | Make `avatar_set` the current avatar of the jid associated with this
connection.
If :attr:`synchronize_vcard` is true and PEP is available the
vCard is only synchronized if the PEP update is successful.
This means publishing the ``image/png`` avatar data and the
avatar metadata... | [
"Make",
"avatar_set",
"the",
"current",
"avatar",
"of",
"the",
"jid",
"associated",
"with",
"this",
"connection",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/avatar/service.py#L913-L956 |
horazont/aioxmpp | aioxmpp/avatar/service.py | AvatarService.disable_avatar | def disable_avatar(self):
"""
Temporarily disable the avatar.
If :attr:`synchronize_vcard` is true, the vCard avatar is
disabled (even if disabling the PEP avatar fails).
This is done by setting the avatar metadata node empty and if
:attr:`synchronize_vcard` is true, do... | python | def disable_avatar(self):
"""
Temporarily disable the avatar.
If :attr:`synchronize_vcard` is true, the vCard avatar is
disabled (even if disabling the PEP avatar fails).
This is done by setting the avatar metadata node empty and if
:attr:`synchronize_vcard` is true, do... | [
"def",
"disable_avatar",
"(",
"self",
")",
":",
"with",
"(",
"yield",
"from",
"self",
".",
"_publish_lock",
")",
":",
"todo",
"=",
"[",
"]",
"if",
"self",
".",
"_synchronize_vcard",
":",
"todo",
".",
"append",
"(",
"self",
".",
"_disable_vcard_avatar",
"... | Temporarily disable the avatar.
If :attr:`synchronize_vcard` is true, the vCard avatar is
disabled (even if disabling the PEP avatar fails).
This is done by setting the avatar metadata node empty and if
:attr:`synchronize_vcard` is true, downloading the vCard,
removing the avat... | [
"Temporarily",
"disable",
"the",
"avatar",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/avatar/service.py#L967-L995 |
horazont/aioxmpp | aioxmpp/avatar/service.py | AvatarService.wipe_avatar | def wipe_avatar(self):
"""
Remove all avatar data stored on the server.
If :attr:`synchronize_vcard` is true, the vCard avatar is
disabled even if disabling the PEP avatar fails.
This is equivalent to :meth:`disable_avatar` for vCard-based
avatars, but will also remove ... | python | def wipe_avatar(self):
"""
Remove all avatar data stored on the server.
If :attr:`synchronize_vcard` is true, the vCard avatar is
disabled even if disabling the PEP avatar fails.
This is equivalent to :meth:`disable_avatar` for vCard-based
avatars, but will also remove ... | [
"def",
"wipe_avatar",
"(",
"self",
")",
":",
"@",
"asyncio",
".",
"coroutine",
"def",
"_wipe_pep_avatar",
"(",
")",
":",
"yield",
"from",
"self",
".",
"_pep",
".",
"publish",
"(",
"namespaces",
".",
"xep0084_metadata",
",",
"avatar_xso",
".",
"Metadata",
"... | Remove all avatar data stored on the server.
If :attr:`synchronize_vcard` is true, the vCard avatar is
disabled even if disabling the PEP avatar fails.
This is equivalent to :meth:`disable_avatar` for vCard-based
avatars, but will also remove the data PubSub node for
PEP avatar... | [
"Remove",
"all",
"avatar",
"data",
"stored",
"on",
"the",
"server",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/avatar/service.py#L998-L1034 |
horazont/aioxmpp | aioxmpp/blocking/service.py | BlockingClient.block_jids | def block_jids(self, jids_to_block):
"""
Add the JIDs in the sequence `jids_to_block` to the client's
blocklist.
"""
yield from self._check_for_blocking()
if not jids_to_block:
return
cmd = blocking_xso.BlockCommand(jids_to_block)
iq = aioxmp... | python | def block_jids(self, jids_to_block):
"""
Add the JIDs in the sequence `jids_to_block` to the client's
blocklist.
"""
yield from self._check_for_blocking()
if not jids_to_block:
return
cmd = blocking_xso.BlockCommand(jids_to_block)
iq = aioxmp... | [
"def",
"block_jids",
"(",
"self",
",",
"jids_to_block",
")",
":",
"yield",
"from",
"self",
".",
"_check_for_blocking",
"(",
")",
"if",
"not",
"jids_to_block",
":",
"return",
"cmd",
"=",
"blocking_xso",
".",
"BlockCommand",
"(",
"jids_to_block",
")",
"iq",
"=... | Add the JIDs in the sequence `jids_to_block` to the client's
blocklist. | [
"Add",
"the",
"JIDs",
"in",
"the",
"sequence",
"jids_to_block",
"to",
"the",
"client",
"s",
"blocklist",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/blocking/service.py#L134-L149 |
horazont/aioxmpp | aioxmpp/blocking/service.py | BlockingClient.unblock_jids | def unblock_jids(self, jids_to_unblock):
"""
Remove the JIDs in the sequence `jids_to_block` from the
client's blocklist.
"""
yield from self._check_for_blocking()
if not jids_to_unblock:
return
cmd = blocking_xso.UnblockCommand(jids_to_unblock)
... | python | def unblock_jids(self, jids_to_unblock):
"""
Remove the JIDs in the sequence `jids_to_block` from the
client's blocklist.
"""
yield from self._check_for_blocking()
if not jids_to_unblock:
return
cmd = blocking_xso.UnblockCommand(jids_to_unblock)
... | [
"def",
"unblock_jids",
"(",
"self",
",",
"jids_to_unblock",
")",
":",
"yield",
"from",
"self",
".",
"_check_for_blocking",
"(",
")",
"if",
"not",
"jids_to_unblock",
":",
"return",
"cmd",
"=",
"blocking_xso",
".",
"UnblockCommand",
"(",
"jids_to_unblock",
")",
... | Remove the JIDs in the sequence `jids_to_block` from the
client's blocklist. | [
"Remove",
"the",
"JIDs",
"in",
"the",
"sequence",
"jids_to_block",
"from",
"the",
"client",
"s",
"blocklist",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/blocking/service.py#L152-L167 |
horazont/aioxmpp | aioxmpp/forms/form.py | DescriptorClass._register_descriptor_keys | def _register_descriptor_keys(self, descriptor, keys):
"""
Register the given descriptor keys for the given descriptor at the
class.
:param descriptor: The descriptor for which the `keys` shall be
registered.
:type descriptor: :class:`AbstractDescripto... | python | def _register_descriptor_keys(self, descriptor, keys):
"""
Register the given descriptor keys for the given descriptor at the
class.
:param descriptor: The descriptor for which the `keys` shall be
registered.
:type descriptor: :class:`AbstractDescripto... | [
"def",
"_register_descriptor_keys",
"(",
"self",
",",
"descriptor",
",",
"keys",
")",
":",
"if",
"descriptor",
".",
"root_class",
"is",
"not",
"self",
"or",
"self",
".",
"__subclasses__",
"(",
")",
":",
"raise",
"TypeError",
"(",
"\"descriptors cannot be modifie... | Register the given descriptor keys for the given descriptor at the
class.
:param descriptor: The descriptor for which the `keys` shall be
registered.
:type descriptor: :class:`AbstractDescriptor` instance
:param keys: An iterable of descriptor keys
:ra... | [
"Register",
"the",
"given",
"descriptor",
"keys",
"for",
"the",
"given",
"descriptor",
"at",
"the",
"class",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/form.py#L177-L227 |
horazont/aioxmpp | aioxmpp/forms/form.py | FormClass.from_xso | def from_xso(self, xso):
"""
Construct and return an instance from the given `xso`.
.. note::
This is a static method (classmethod), even though sphinx does not
document it as such.
:param xso: A :xep:`4` data form
:type xso: :class:`~.Data`
:rais... | python | def from_xso(self, xso):
"""
Construct and return an instance from the given `xso`.
.. note::
This is a static method (classmethod), even though sphinx does not
document it as such.
:param xso: A :xep:`4` data form
:type xso: :class:`~.Data`
:rais... | [
"def",
"from_xso",
"(",
"self",
",",
"xso",
")",
":",
"my_form_type",
"=",
"getattr",
"(",
"self",
",",
"\"FORM_TYPE\"",
",",
"None",
")",
"f",
"=",
"self",
"(",
")",
"for",
"field",
"in",
"xso",
".",
"fields",
":",
"if",
"field",
".",
"var",
"==",... | Construct and return an instance from the given `xso`.
.. note::
This is a static method (classmethod), even though sphinx does not
document it as such.
:param xso: A :xep:`4` data form
:type xso: :class:`~.Data`
:raises ValueError: if the ``FORM_TYPE`` mismatche... | [
"Construct",
"and",
"return",
"an",
"instance",
"from",
"the",
"given",
"xso",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/form.py#L231-L307 |
horazont/aioxmpp | aioxmpp/forms/form.py | Form.render_reply | def render_reply(self):
"""
Create a :class:`~.Data` object equal to the object from which the from
was created through :meth:`from_xso`, except that the values of the
fields are exchanged with the values set on the form.
Fields which have no corresponding form descriptor are le... | python | def render_reply(self):
"""
Create a :class:`~.Data` object equal to the object from which the from
was created through :meth:`from_xso`, except that the values of the
fields are exchanged with the values set on the form.
Fields which have no corresponding form descriptor are le... | [
"def",
"render_reply",
"(",
"self",
")",
":",
"data",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"_recv_xso",
")",
"data",
".",
"type_",
"=",
"forms_xso",
".",
"DataType",
".",
"SUBMIT",
"data",
".",
"fields",
"=",
"list",
"(",
"self",
".",
"_recv_x... | Create a :class:`~.Data` object equal to the object from which the from
was created through :meth:`from_xso`, except that the values of the
fields are exchanged with the values set on the form.
Fields which have no corresponding form descriptor are left untouched.
Fields which are acces... | [
"Create",
"a",
":",
"class",
":",
"~",
".",
"Data",
"object",
"equal",
"to",
"the",
"object",
"from",
"which",
"the",
"from",
"was",
"created",
"through",
":",
"meth",
":",
"from_xso",
"except",
"that",
"the",
"values",
"of",
"the",
"fields",
"are",
"e... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/form.py#L389-L425 |
horazont/aioxmpp | aioxmpp/forms/form.py | Form.render_request | def render_request(self):
"""
Create a :class:`Data` object containing all fields known to the
:class:`Form`. If the :class:`Form` has a :attr:`LAYOUT` attribute, it
is used during generation.
"""
data = forms_xso.Data(type_=forms_xso.DataType.FORM)
try:
... | python | def render_request(self):
"""
Create a :class:`Data` object containing all fields known to the
:class:`Form`. If the :class:`Form` has a :attr:`LAYOUT` attribute, it
is used during generation.
"""
data = forms_xso.Data(type_=forms_xso.DataType.FORM)
try:
... | [
"def",
"render_request",
"(",
"self",
")",
":",
"data",
"=",
"forms_xso",
".",
"Data",
"(",
"type_",
"=",
"forms_xso",
".",
"DataType",
".",
"FORM",
")",
"try",
":",
"layout",
"=",
"self",
".",
"LAYOUT",
"except",
"AttributeError",
":",
"layout",
"=",
... | Create a :class:`Data` object containing all fields known to the
:class:`Form`. If the :class:`Form` has a :attr:`LAYOUT` attribute, it
is used during generation. | [
"Create",
"a",
":",
"class",
":",
"Data",
"object",
"containing",
"all",
"fields",
"known",
"to",
"the",
":",
"class",
":",
"Form",
".",
"If",
"the",
":",
"class",
":",
"Form",
"has",
"a",
":",
"attr",
":",
"LAYOUT",
"attribute",
"it",
"is",
"used",
... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/form.py#L427-L460 |
horazont/aioxmpp | aioxmpp/entitycaps/service.py | Cache.lookup | def lookup(self, key):
"""
Look up the given `node` URL using the given `hash_` first in the
database and then by waiting on the futures created with
:meth:`create_query_future` for that node URL and hash.
If the hash is not in the database, :meth:`lookup` iterates as long as
... | python | def lookup(self, key):
"""
Look up the given `node` URL using the given `hash_` first in the
database and then by waiting on the futures created with
:meth:`create_query_future` for that node URL and hash.
If the hash is not in the database, :meth:`lookup` iterates as long as
... | [
"def",
"lookup",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"lookup_in_database",
"(",
"key",
")",
"except",
"KeyError",
":",
"pass",
"else",
":",
"return",
"result",
"while",
"True",
":",
"fut",
"=",
"self",
".",
"_lo... | Look up the given `node` URL using the given `hash_` first in the
database and then by waiting on the futures created with
:meth:`create_query_future` for that node URL and hash.
If the hash is not in the database, :meth:`lookup` iterates as long as
there are pending futures for the giv... | [
"Look",
"up",
"the",
"given",
"node",
"URL",
"using",
"the",
"given",
"hash_",
"first",
"in",
"the",
"database",
"and",
"then",
"by",
"waiting",
"on",
"the",
"futures",
"created",
"with",
":",
"meth",
":",
"create_query_future",
"for",
"that",
"node",
"URL... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/entitycaps/service.py#L134-L160 |
horazont/aioxmpp | aioxmpp/entitycaps/service.py | Cache.create_query_future | def create_query_future(self, key):
"""
Create and return a :class:`asyncio.Future` for the given `hash_`
function and `node` URL. The future is referenced internally and used
by any calls to :meth:`lookup` which are made while the future is
pending. The future is removed from th... | python | def create_query_future(self, key):
"""
Create and return a :class:`asyncio.Future` for the given `hash_`
function and `node` URL. The future is referenced internally and used
by any calls to :meth:`lookup` which are made while the future is
pending. The future is removed from th... | [
"def",
"create_query_future",
"(",
"self",
",",
"key",
")",
":",
"fut",
"=",
"asyncio",
".",
"Future",
"(",
")",
"fut",
".",
"add_done_callback",
"(",
"functools",
".",
"partial",
"(",
"self",
".",
"_erase_future",
",",
"key",
")",
")",
"self",
".",
"_... | Create and return a :class:`asyncio.Future` for the given `hash_`
function and `node` URL. The future is referenced internally and used
by any calls to :meth:`lookup` which are made while the future is
pending. The future is removed from the internal storage automatically
when a result o... | [
"Create",
"and",
"return",
"a",
":",
"class",
":",
"asyncio",
".",
"Future",
"for",
"the",
"given",
"hash_",
"function",
"and",
"node",
"URL",
".",
"The",
"future",
"is",
"referenced",
"internally",
"and",
"used",
"by",
"any",
"calls",
"to",
":",
"meth",... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/entitycaps/service.py#L162-L177 |
horazont/aioxmpp | aioxmpp/entitycaps/service.py | Cache.add_cache_entry | def add_cache_entry(self, key, entry):
"""
Add the given `entry` (which must be a :class:`~.disco.xso.InfoQuery`
instance) to the user-level database keyed with the hash function type
`hash_` and the `node` URL. The `entry` is **not** validated to
actually map to `node` with the ... | python | def add_cache_entry(self, key, entry):
"""
Add the given `entry` (which must be a :class:`~.disco.xso.InfoQuery`
instance) to the user-level database keyed with the hash function type
`hash_` and the `node` URL. The `entry` is **not** validated to
actually map to `node` with the ... | [
"def",
"add_cache_entry",
"(",
"self",
",",
"key",
",",
"entry",
")",
":",
"copied_entry",
"=",
"copy",
".",
"copy",
"(",
"entry",
")",
"self",
".",
"_memory_overlay",
"[",
"key",
"]",
"=",
"copied_entry",
"if",
"self",
".",
"_user_db_path",
"is",
"not",... | Add the given `entry` (which must be a :class:`~.disco.xso.InfoQuery`
instance) to the user-level database keyed with the hash function type
`hash_` and the `node` URL. The `entry` is **not** validated to
actually map to `node` with the given `hash_` function, it is expected
that the cal... | [
"Add",
"the",
"given",
"entry",
"(",
"which",
"must",
"be",
"a",
":",
"class",
":",
"~",
".",
"disco",
".",
"xso",
".",
"InfoQuery",
"instance",
")",
"to",
"the",
"user",
"-",
"level",
"database",
"keyed",
"with",
"the",
"hash",
"function",
"type",
"... | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/entitycaps/service.py#L179-L194 |
horazont/aioxmpp | aioxmpp/pep/service.py | PEPClient.claim_pep_node | def claim_pep_node(self, node_namespace, *,
register_feature=True, notify=False):
"""
Claim node `node_namespace`.
:param node_namespace: the pubsub node whose events shall be
handled.
:param register_feature: Whether to publish the `node_namespace`
... | python | def claim_pep_node(self, node_namespace, *,
register_feature=True, notify=False):
"""
Claim node `node_namespace`.
:param node_namespace: the pubsub node whose events shall be
handled.
:param register_feature: Whether to publish the `node_namespace`
... | [
"def",
"claim_pep_node",
"(",
"self",
",",
"node_namespace",
",",
"*",
",",
"register_feature",
"=",
"True",
",",
"notify",
"=",
"False",
")",
":",
"if",
"node_namespace",
"in",
"self",
".",
"_pep_node_claims",
":",
"raise",
"RuntimeError",
"(",
"\"claiming al... | Claim node `node_namespace`.
:param node_namespace: the pubsub node whose events shall be
handled.
:param register_feature: Whether to publish the `node_namespace`
as feature.
:param notify: Whether to register the ``+notify`` feature to
receive notification ... | [
"Claim",
"node",
"node_namespace",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pep/service.py#L90-L146 |
horazont/aioxmpp | aioxmpp/pep/service.py | PEPClient.available | def available(self):
"""
Check whether we have a PEP identity associated with our account.
"""
disco_info = yield from self._disco_client.query_info(
self.client.local_jid.bare()
)
for item in disco_info.identities.filter(attrs={"category": "pubsub"}):
... | python | def available(self):
"""
Check whether we have a PEP identity associated with our account.
"""
disco_info = yield from self._disco_client.query_info(
self.client.local_jid.bare()
)
for item in disco_info.identities.filter(attrs={"category": "pubsub"}):
... | [
"def",
"available",
"(",
"self",
")",
":",
"disco_info",
"=",
"yield",
"from",
"self",
".",
"_disco_client",
".",
"query_info",
"(",
"self",
".",
"client",
".",
"local_jid",
".",
"bare",
"(",
")",
")",
"for",
"item",
"in",
"disco_info",
".",
"identities"... | Check whether we have a PEP identity associated with our account. | [
"Check",
"whether",
"we",
"have",
"a",
"PEP",
"identity",
"associated",
"with",
"our",
"account",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pep/service.py#L152-L163 |
horazont/aioxmpp | aioxmpp/pep/service.py | PEPClient.publish | def publish(self, node, data, *, id_=None, access_model=None):
"""
Publish an item `data` in the PubSub node `node` on the
PEP service associated with the user's JID.
:param node: The PubSub node to publish to.
:param data: The item to publish.
:type data: An XSO represe... | python | def publish(self, node, data, *, id_=None, access_model=None):
"""
Publish an item `data` in the PubSub node `node` on the
PEP service associated with the user's JID.
:param node: The PubSub node to publish to.
:param data: The item to publish.
:type data: An XSO represe... | [
"def",
"publish",
"(",
"self",
",",
"node",
",",
"data",
",",
"*",
",",
"id_",
"=",
"None",
",",
"access_model",
"=",
"None",
")",
":",
"publish_options",
"=",
"None",
"def",
"autocreate_publish_options",
"(",
")",
":",
"nonlocal",
"publish_options",
"if",... | Publish an item `data` in the PubSub node `node` on the
PEP service associated with the user's JID.
:param node: The PubSub node to publish to.
:param data: The item to publish.
:type data: An XSO representing the paylaod.
:param id_: The id the published item shall have.
... | [
"Publish",
"an",
"item",
"data",
"in",
"the",
"PubSub",
"node",
"node",
"on",
"the",
"PEP",
"service",
"associated",
"with",
"the",
"user",
"s",
"JID",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pep/service.py#L193-L249 |
horazont/aioxmpp | aioxmpp/pep/service.py | RegisteredPEPNode.close | def close(self):
"""
Unclaim the PEP node and unregister the registered features.
It is not necessary to call close if this claim is managed by
:class:`~aioxmpp.pep.register_pep_node`.
"""
if self._closed:
return
self._closed = True
self._pep... | python | def close(self):
"""
Unclaim the PEP node and unregister the registered features.
It is not necessary to call close if this claim is managed by
:class:`~aioxmpp.pep.register_pep_node`.
"""
if self._closed:
return
self._closed = True
self._pep... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"return",
"self",
".",
"_closed",
"=",
"True",
"self",
".",
"_pep_service",
".",
"_unclaim",
"(",
"self",
".",
"node_namespace",
")",
"self",
".",
"_unregister",
"(",
")"
] | Unclaim the PEP node and unregister the registered features.
It is not necessary to call close if this claim is managed by
:class:`~aioxmpp.pep.register_pep_node`. | [
"Unclaim",
"the",
"PEP",
"node",
"and",
"unregister",
"the",
"registered",
"features",
"."
] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pep/service.py#L326-L338 |
neo4j-contrib/django-neomodel | django_neomodel/__init__.py | DjangoNode.full_clean | def full_clean(self, exclude, validate_unique=False):
"""
Validate node, on error raising ValidationErrors which can be handled by django forms
:param exclude:
:param validate_unique: Check if conflicting node exists in the labels indexes
:return:
"""
# validate... | python | def full_clean(self, exclude, validate_unique=False):
"""
Validate node, on error raising ValidationErrors which can be handled by django forms
:param exclude:
:param validate_unique: Check if conflicting node exists in the labels indexes
:return:
"""
# validate... | [
"def",
"full_clean",
"(",
"self",
",",
"exclude",
",",
"validate_unique",
"=",
"False",
")",
":",
"# validate against neomodel",
"try",
":",
"self",
".",
"deflate",
"(",
"self",
".",
"__properties__",
",",
"self",
")",
"except",
"DeflateError",
"as",
"e",
":... | Validate node, on error raising ValidationErrors which can be handled by django forms
:param exclude:
:param validate_unique: Check if conflicting node exists in the labels indexes
:return: | [
"Validate",
"node",
"on",
"error",
"raising",
"ValidationErrors",
"which",
"can",
"be",
"handled",
"by",
"django",
"forms"
] | train | https://github.com/neo4j-contrib/django-neomodel/blob/9bee6708c0df8e4d1b546fe57e1f735e63a29d81/django_neomodel/__init__.py#L148-L163 |
mishbahr/django-users2 | users/models.py | AbstractUser.email_user | def email_user(self, subject, message, from_email=None):
""" Send an email to this User."""
send_mail(subject, message, from_email, [self.email]) | python | def email_user(self, subject, message, from_email=None):
""" Send an email to this User."""
send_mail(subject, message, from_email, [self.email]) | [
"def",
"email_user",
"(",
"self",
",",
"subject",
",",
"message",
",",
"from_email",
"=",
"None",
")",
":",
"send_mail",
"(",
"subject",
",",
"message",
",",
"from_email",
",",
"[",
"self",
".",
"email",
"]",
")"
] | Send an email to this User. | [
"Send",
"an",
"email",
"to",
"this",
"User",
"."
] | train | https://github.com/mishbahr/django-users2/blob/1ee244dc4ca162b2331d2a44d45848fdcb80f329/users/models.py#L47-L49 |
mishbahr/django-users2 | users/admin.py | UserAdmin.activate_users | def activate_users(self, request, queryset):
"""
Activates the selected users, if they are not already
activated.
"""
n = 0
for user in queryset:
if not user.is_active:
user.activate()
n += 1
self.message_user(
... | python | def activate_users(self, request, queryset):
"""
Activates the selected users, if they are not already
activated.
"""
n = 0
for user in queryset:
if not user.is_active:
user.activate()
n += 1
self.message_user(
... | [
"def",
"activate_users",
"(",
"self",
",",
"request",
",",
"queryset",
")",
":",
"n",
"=",
"0",
"for",
"user",
"in",
"queryset",
":",
"if",
"not",
"user",
".",
"is_active",
":",
"user",
".",
"activate",
"(",
")",
"n",
"+=",
"1",
"self",
".",
"messa... | Activates the selected users, if they are not already
activated. | [
"Activates",
"the",
"selected",
"users",
"if",
"they",
"are",
"not",
"already",
"activated",
"."
] | train | https://github.com/mishbahr/django-users2/blob/1ee244dc4ca162b2331d2a44d45848fdcb80f329/users/admin.py#L79-L93 |
mishbahr/django-users2 | users/admin.py | UserAdmin.send_activation_email | def send_activation_email(self, request, queryset):
"""
Send activation emails for the selected users, if they are not already
activated.
"""
n = 0
for user in queryset:
if not user.is_active and settings.USERS_VERIFY_EMAIL:
send_activation_ema... | python | def send_activation_email(self, request, queryset):
"""
Send activation emails for the selected users, if they are not already
activated.
"""
n = 0
for user in queryset:
if not user.is_active and settings.USERS_VERIFY_EMAIL:
send_activation_ema... | [
"def",
"send_activation_email",
"(",
"self",
",",
"request",
",",
"queryset",
")",
":",
"n",
"=",
"0",
"for",
"user",
"in",
"queryset",
":",
"if",
"not",
"user",
".",
"is_active",
"and",
"settings",
".",
"USERS_VERIFY_EMAIL",
":",
"send_activation_email",
"(... | Send activation emails for the selected users, if they are not already
activated. | [
"Send",
"activation",
"emails",
"for",
"the",
"selected",
"users",
"if",
"they",
"are",
"not",
"already",
"activated",
"."
] | train | https://github.com/mishbahr/django-users2/blob/1ee244dc4ca162b2331d2a44d45848fdcb80f329/users/admin.py#L96-L109 |
mishbahr/django-users2 | users/managers.py | UserManager.get_queryset | def get_queryset(self):
"""
Fixes get_query_set vs get_queryset for Django <1.6
"""
try:
qs = super(UserManager, self).get_queryset()
except AttributeError: # pragma: no cover
qs = super(UserManager, self).get_query_set()
return qs | python | def get_queryset(self):
"""
Fixes get_query_set vs get_queryset for Django <1.6
"""
try:
qs = super(UserManager, self).get_queryset()
except AttributeError: # pragma: no cover
qs = super(UserManager, self).get_query_set()
return qs | [
"def",
"get_queryset",
"(",
"self",
")",
":",
"try",
":",
"qs",
"=",
"super",
"(",
"UserManager",
",",
"self",
")",
".",
"get_queryset",
"(",
")",
"except",
"AttributeError",
":",
"# pragma: no cover",
"qs",
"=",
"super",
"(",
"UserManager",
",",
"self",
... | Fixes get_query_set vs get_queryset for Django <1.6 | [
"Fixes",
"get_query_set",
"vs",
"get_queryset",
"for",
"Django",
"<1",
".",
"6"
] | train | https://github.com/mishbahr/django-users2/blob/1ee244dc4ca162b2331d2a44d45848fdcb80f329/users/managers.py#L11-L19 |
eandersson/amqpstorm | amqpstorm/io.py | Poller.is_ready | def is_ready(self):
"""Is Socket Ready.
:rtype: tuple
"""
try:
ready, _, _ = self.select.select([self.fileno], [], [],
POLL_TIMEOUT)
return bool(ready)
except self.select.error as why:
if why.args[0... | python | def is_ready(self):
"""Is Socket Ready.
:rtype: tuple
"""
try:
ready, _, _ = self.select.select([self.fileno], [], [],
POLL_TIMEOUT)
return bool(ready)
except self.select.error as why:
if why.args[0... | [
"def",
"is_ready",
"(",
"self",
")",
":",
"try",
":",
"ready",
",",
"_",
",",
"_",
"=",
"self",
".",
"select",
".",
"select",
"(",
"[",
"self",
".",
"fileno",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"POLL_TIMEOUT",
")",
"return",
"bool",
"(",
... | Is Socket Ready.
:rtype: tuple | [
"Is",
"Socket",
"Ready",
"."
] | train | https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L39-L51 |
eandersson/amqpstorm | amqpstorm/io.py | IO.close | def close(self):
"""Close Socket.
:return:
"""
self._wr_lock.acquire()
self._rd_lock.acquire()
try:
self._running.clear()
if self.socket:
self._close_socket()
if self._inbound_thread:
self._inbound_threa... | python | def close(self):
"""Close Socket.
:return:
"""
self._wr_lock.acquire()
self._rd_lock.acquire()
try:
self._running.clear()
if self.socket:
self._close_socket()
if self._inbound_thread:
self._inbound_threa... | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"_wr_lock",
".",
"acquire",
"(",
")",
"self",
".",
"_rd_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_running",
".",
"clear",
"(",
")",
"if",
"self",
".",
"socket",
":",
"self",
".... | Close Socket.
:return: | [
"Close",
"Socket",
"."
] | train | https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L70-L88 |
eandersson/amqpstorm | amqpstorm/io.py | IO.open | def open(self):
"""Open Socket and establish a connection.
:raises AMQPConnectionError: Raises if the connection
encountered an error.
:return:
"""
self._wr_lock.acquire()
self._rd_lock.acquire()
try:
self.data_in ... | python | def open(self):
"""Open Socket and establish a connection.
:raises AMQPConnectionError: Raises if the connection
encountered an error.
:return:
"""
self._wr_lock.acquire()
self._rd_lock.acquire()
try:
self.data_in ... | [
"def",
"open",
"(",
"self",
")",
":",
"self",
".",
"_wr_lock",
".",
"acquire",
"(",
")",
"self",
".",
"_rd_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"data_in",
"=",
"EMPTY_BUFFER",
"self",
".",
"_running",
".",
"set",
"(",
")",
"soc... | Open Socket and establish a connection.
:raises AMQPConnectionError: Raises if the connection
encountered an error.
:return: | [
"Open",
"Socket",
"and",
"establish",
"a",
"connection",
"."
] | train | https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L90-L109 |
eandersson/amqpstorm | amqpstorm/io.py | IO.write_to_socket | def write_to_socket(self, frame_data):
"""Write data to the socket.
:param str frame_data:
:return:
"""
self._wr_lock.acquire()
try:
total_bytes_written = 0
bytes_to_send = len(frame_data)
while total_bytes_written < bytes_to_send:
... | python | def write_to_socket(self, frame_data):
"""Write data to the socket.
:param str frame_data:
:return:
"""
self._wr_lock.acquire()
try:
total_bytes_written = 0
bytes_to_send = len(frame_data)
while total_bytes_written < bytes_to_send:
... | [
"def",
"write_to_socket",
"(",
"self",
",",
"frame_data",
")",
":",
"self",
".",
"_wr_lock",
".",
"acquire",
"(",
")",
"try",
":",
"total_bytes_written",
"=",
"0",
"bytes_to_send",
"=",
"len",
"(",
"frame_data",
")",
"while",
"total_bytes_written",
"<",
"byt... | Write data to the socket.
:param str frame_data:
:return: | [
"Write",
"data",
"to",
"the",
"socket",
"."
] | train | https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L111-L139 |
eandersson/amqpstorm | amqpstorm/io.py | IO._close_socket | def _close_socket(self):
"""Shutdown and close the Socket.
:return:
"""
try:
self.socket.shutdown(socket.SHUT_RDWR)
except (OSError, socket.error):
pass
self.socket.close() | python | def _close_socket(self):
"""Shutdown and close the Socket.
:return:
"""
try:
self.socket.shutdown(socket.SHUT_RDWR)
except (OSError, socket.error):
pass
self.socket.close() | [
"def",
"_close_socket",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"socket",
".",
"shutdown",
"(",
"socket",
".",
"SHUT_RDWR",
")",
"except",
"(",
"OSError",
",",
"socket",
".",
"error",
")",
":",
"pass",
"self",
".",
"socket",
".",
"close",
"("... | Shutdown and close the Socket.
:return: | [
"Shutdown",
"and",
"close",
"the",
"Socket",
"."
] | train | https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L141-L150 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.