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/service.py
inbound_message_filter
def inbound_message_filter(f): """ Register the decorated function as a service-level inbound message filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. """ ...
python
def inbound_message_filter(f): """ Register the decorated function as a service-level inbound message filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. """ ...
[ "def", "inbound_message_filter", "(", "f", ")", ":", "if", "asyncio", ".", "iscoroutinefunction", "(", "f", ")", ":", "raise", "TypeError", "(", "\"inbound_message_filter must not be a coroutine function\"", ")", "add_handler_spec", "(", "f", ",", "HandlerSpec", "(", ...
Register the decorated function as a service-level inbound message filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters.
[ "Register", "the", "decorated", "function", "as", "a", "service", "-", "level", "inbound", "message", "filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1083-L1107
horazont/aioxmpp
aioxmpp/service.py
inbound_presence_filter
def inbound_presence_filter(f): """ Register the decorated function as a service-level inbound presence filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. """ ...
python
def inbound_presence_filter(f): """ Register the decorated function as a service-level inbound presence filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. """ ...
[ "def", "inbound_presence_filter", "(", "f", ")", ":", "if", "asyncio", ".", "iscoroutinefunction", "(", "f", ")", ":", "raise", "TypeError", "(", "\"inbound_presence_filter must not be a coroutine function\"", ")", "add_handler_spec", "(", "f", ",", "HandlerSpec", "("...
Register the decorated function as a service-level inbound presence filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters.
[ "Register", "the", "decorated", "function", "as", "a", "service", "-", "level", "inbound", "presence", "filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1110-L1134
horazont/aioxmpp
aioxmpp/service.py
outbound_message_filter
def outbound_message_filter(f): """ Register the decorated function as a service-level outbound message filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. """ ...
python
def outbound_message_filter(f): """ Register the decorated function as a service-level outbound message filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. """ ...
[ "def", "outbound_message_filter", "(", "f", ")", ":", "if", "asyncio", ".", "iscoroutinefunction", "(", "f", ")", ":", "raise", "TypeError", "(", "\"outbound_message_filter must not be a coroutine function\"", ")", "add_handler_spec", "(", "f", ",", "HandlerSpec", "("...
Register the decorated function as a service-level outbound message filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters.
[ "Register", "the", "decorated", "function", "as", "a", "service", "-", "level", "outbound", "message", "filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1137-L1161
horazont/aioxmpp
aioxmpp/service.py
outbound_presence_filter
def outbound_presence_filter(f): """ Register the decorated function as a service-level outbound presence filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. "...
python
def outbound_presence_filter(f): """ Register the decorated function as a service-level outbound presence filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters. "...
[ "def", "outbound_presence_filter", "(", "f", ")", ":", "if", "asyncio", ".", "iscoroutinefunction", "(", "f", ")", ":", "raise", "TypeError", "(", "\"outbound_presence_filter must not be a coroutine function\"", ")", "add_handler_spec", "(", "f", ",", "HandlerSpec", "...
Register the decorated function as a service-level outbound presence filter. :raise TypeError: if the decorated object is a coroutine function .. seealso:: :class:`StanzaStream` for important remarks regarding the use of stanza filters.
[ "Register", "the", "decorated", "function", "as", "a", "service", "-", "level", "outbound", "presence", "filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1164-L1189
horazont/aioxmpp
aioxmpp/service.py
depsignal
def depsignal(class_, signal_name, *, defer=False): """ Connect the decorated method or coroutine method to the addressed signal on a class on which the service depends. :param class_: A service class which is listed in the :attr:`~.Meta.ORDER_AFTER` relationship. :type class_: :...
python
def depsignal(class_, signal_name, *, defer=False): """ Connect the decorated method or coroutine method to the addressed signal on a class on which the service depends. :param class_: A service class which is listed in the :attr:`~.Meta.ORDER_AFTER` relationship. :type class_: :...
[ "def", "depsignal", "(", "class_", ",", "signal_name", ",", "*", ",", "defer", "=", "False", ")", ":", "def", "decorator", "(", "f", ")", ":", "add_handler_spec", "(", "f", ",", "_depsignal_spec", "(", "class_", ",", "signal_name", ",", "f", ",", "defe...
Connect the decorated method or coroutine method to the addressed signal on a class on which the service depends. :param class_: A service class which is listed in the :attr:`~.Meta.ORDER_AFTER` relationship. :type class_: :class:`Service` class or one of the special cases below :par...
[ "Connect", "the", "decorated", "method", "or", "coroutine", "method", "to", "the", "addressed", "signal", "on", "a", "class", "on", "which", "the", "service", "depends", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1244-L1293
horazont/aioxmpp
aioxmpp/service.py
attrsignal
def attrsignal(descriptor, signal_name, *, defer=False): """ Connect the decorated method or coroutine method to the addressed signal on a descriptor. :param descriptor: The descriptor to connect to. :type descriptor: :class:`Descriptor` subclass. :param signal_name: Attribute name of the signa...
python
def attrsignal(descriptor, signal_name, *, defer=False): """ Connect the decorated method or coroutine method to the addressed signal on a descriptor. :param descriptor: The descriptor to connect to. :type descriptor: :class:`Descriptor` subclass. :param signal_name: Attribute name of the signa...
[ "def", "attrsignal", "(", "descriptor", ",", "signal_name", ",", "*", ",", "defer", "=", "False", ")", ":", "def", "decorator", "(", "f", ")", ":", "add_handler_spec", "(", "f", ",", "_attrsignal_spec", "(", "descriptor", ",", "signal_name", ",", "f", ",...
Connect the decorated method or coroutine method to the addressed signal on a descriptor. :param descriptor: The descriptor to connect to. :type descriptor: :class:`Descriptor` subclass. :param signal_name: Attribute name of the signal to connect to :type signal_name: :class:`str` :param defer:...
[ "Connect", "the", "decorated", "method", "or", "coroutine", "method", "to", "the", "addressed", "signal", "on", "a", "descriptor", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1314-L1355
horazont/aioxmpp
aioxmpp/service.py
depfilter
def depfilter(class_, filter_name): """ Register the decorated method at the addressed :class:`~.callbacks.Filter` on a class on which the service depends. :param class_: A service class which is listed in the :attr:`~.Meta.ORDER_AFTER` relationship. :type class_: :class:`Service...
python
def depfilter(class_, filter_name): """ Register the decorated method at the addressed :class:`~.callbacks.Filter` on a class on which the service depends. :param class_: A service class which is listed in the :attr:`~.Meta.ORDER_AFTER` relationship. :type class_: :class:`Service...
[ "def", "depfilter", "(", "class_", ",", "filter_name", ")", ":", "spec", "=", "_depfilter_spec", "(", "class_", ",", "filter_name", ")", "def", "decorator", "(", "f", ")", ":", "add_handler_spec", "(", "f", ",", "spec", ",", ")", "return", "f", "return",...
Register the decorated method at the addressed :class:`~.callbacks.Filter` on a class on which the service depends. :param class_: A service class which is listed in the :attr:`~.Meta.ORDER_AFTER` relationship. :type class_: :class:`Service` class or :class:`aioxmpp.str...
[ "Register", "the", "decorated", "method", "at", "the", "addressed", ":", "class", ":", "~", ".", "callbacks", ".", "Filter", "on", "a", "class", "on", "which", "the", "service", "depends", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1376-L1405
horazont/aioxmpp
aioxmpp/service.py
is_iq_handler
def is_iq_handler(type_, payload_cls, coro, *, with_send_reply=False): """ Return true if `coro` has been decorated with :func:`iq_handler` for the given `type_` and `payload_cls` and the specified keyword arguments. """ try: handlers = get_magic_attr(coro) except AttributeError: ...
python
def is_iq_handler(type_, payload_cls, coro, *, with_send_reply=False): """ Return true if `coro` has been decorated with :func:`iq_handler` for the given `type_` and `payload_cls` and the specified keyword arguments. """ try: handlers = get_magic_attr(coro) except AttributeError: ...
[ "def", "is_iq_handler", "(", "type_", ",", "payload_cls", ",", "coro", ",", "*", ",", "with_send_reply", "=", "False", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "coro", ")", "except", "AttributeError", ":", "return", "False", "hs", "=",...
Return true if `coro` has been decorated with :func:`iq_handler` for the given `type_` and `payload_cls` and the specified keyword arguments.
[ "Return", "true", "if", "coro", "has", "been", "decorated", "with", ":", "func", ":", "iq_handler", "for", "the", "given", "type_", "and", "payload_cls", "and", "the", "specified", "keyword", "arguments", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1408-L1426
horazont/aioxmpp
aioxmpp/service.py
is_message_handler
def is_message_handler(type_, from_, cb): """ Deprecated alias of :func:`.dispatcher.is_message_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.is_message_handler(type_, from_, cb)
python
def is_message_handler(type_, from_, cb): """ Deprecated alias of :func:`.dispatcher.is_message_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.is_message_handler(type_, from_, cb)
[ "def", "is_message_handler", "(", "type_", ",", "from_", ",", "cb", ")", ":", "import", "aioxmpp", ".", "dispatcher", "return", "aioxmpp", ".", "dispatcher", ".", "is_message_handler", "(", "type_", ",", "from_", ",", "cb", ")" ]
Deprecated alias of :func:`.dispatcher.is_message_handler`. .. deprecated:: 0.9
[ "Deprecated", "alias", "of", ":", "func", ":", ".", "dispatcher", ".", "is_message_handler", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1429-L1436
horazont/aioxmpp
aioxmpp/service.py
is_presence_handler
def is_presence_handler(type_, from_, cb): """ Deprecated alias of :func:`.dispatcher.is_presence_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.is_presence_handler(type_, from_, cb)
python
def is_presence_handler(type_, from_, cb): """ Deprecated alias of :func:`.dispatcher.is_presence_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.is_presence_handler(type_, from_, cb)
[ "def", "is_presence_handler", "(", "type_", ",", "from_", ",", "cb", ")", ":", "import", "aioxmpp", ".", "dispatcher", "return", "aioxmpp", ".", "dispatcher", ".", "is_presence_handler", "(", "type_", ",", "from_", ",", "cb", ")" ]
Deprecated alias of :func:`.dispatcher.is_presence_handler`. .. deprecated:: 0.9
[ "Deprecated", "alias", "of", ":", "func", ":", ".", "dispatcher", ".", "is_presence_handler", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1439-L1446
horazont/aioxmpp
aioxmpp/service.py
is_inbound_message_filter
def is_inbound_message_filter(cb): """ Return true if `cb` has been decorated with :func:`inbound_message_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_inbound_message_filter, ()) ) return hs in ha...
python
def is_inbound_message_filter(cb): """ Return true if `cb` has been decorated with :func:`inbound_message_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_inbound_message_filter, ()) ) return hs in ha...
[ "def", "is_inbound_message_filter", "(", "cb", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "cb", ")", "except", "AttributeError", ":", "return", "False", "hs", "=", "HandlerSpec", "(", "(", "_apply_inbound_message_filter", ",", "(", ")", ")",...
Return true if `cb` has been decorated with :func:`inbound_message_filter`.
[ "Return", "true", "if", "cb", "has", "been", "decorated", "with", ":", "func", ":", "inbound_message_filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1449-L1463
horazont/aioxmpp
aioxmpp/service.py
is_inbound_presence_filter
def is_inbound_presence_filter(cb): """ Return true if `cb` has been decorated with :func:`inbound_presence_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_inbound_presence_filter, ()) ) return h...
python
def is_inbound_presence_filter(cb): """ Return true if `cb` has been decorated with :func:`inbound_presence_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_inbound_presence_filter, ()) ) return h...
[ "def", "is_inbound_presence_filter", "(", "cb", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "cb", ")", "except", "AttributeError", ":", "return", "False", "hs", "=", "HandlerSpec", "(", "(", "_apply_inbound_presence_filter", ",", "(", ")", ")...
Return true if `cb` has been decorated with :func:`inbound_presence_filter`.
[ "Return", "true", "if", "cb", "has", "been", "decorated", "with", ":", "func", ":", "inbound_presence_filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1466-L1481
horazont/aioxmpp
aioxmpp/service.py
is_outbound_message_filter
def is_outbound_message_filter(cb): """ Return true if `cb` has been decorated with :func:`outbound_message_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_outbound_message_filter, ()) ) return h...
python
def is_outbound_message_filter(cb): """ Return true if `cb` has been decorated with :func:`outbound_message_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_outbound_message_filter, ()) ) return h...
[ "def", "is_outbound_message_filter", "(", "cb", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "cb", ")", "except", "AttributeError", ":", "return", "False", "hs", "=", "HandlerSpec", "(", "(", "_apply_outbound_message_filter", ",", "(", ")", ")...
Return true if `cb` has been decorated with :func:`outbound_message_filter`.
[ "Return", "true", "if", "cb", "has", "been", "decorated", "with", ":", "func", ":", "outbound_message_filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1484-L1499
horazont/aioxmpp
aioxmpp/service.py
is_outbound_presence_filter
def is_outbound_presence_filter(cb): """ Return true if `cb` has been decorated with :func:`outbound_presence_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_outbound_presence_filter, ()) ) retur...
python
def is_outbound_presence_filter(cb): """ Return true if `cb` has been decorated with :func:`outbound_presence_filter`. """ try: handlers = get_magic_attr(cb) except AttributeError: return False hs = HandlerSpec( (_apply_outbound_presence_filter, ()) ) retur...
[ "def", "is_outbound_presence_filter", "(", "cb", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "cb", ")", "except", "AttributeError", ":", "return", "False", "hs", "=", "HandlerSpec", "(", "(", "_apply_outbound_presence_filter", ",", "(", ")", ...
Return true if `cb` has been decorated with :func:`outbound_presence_filter`.
[ "Return", "true", "if", "cb", "has", "been", "decorated", "with", ":", "func", ":", "outbound_presence_filter", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1502-L1517
horazont/aioxmpp
aioxmpp/service.py
is_depsignal_handler
def is_depsignal_handler(class_, signal_name, cb, *, defer=False): """ Return true if `cb` has been decorated with :func:`depsignal` for the given signal, class and connection mode. """ try: handlers = get_magic_attr(cb) except AttributeError: return False return _depsignal_...
python
def is_depsignal_handler(class_, signal_name, cb, *, defer=False): """ Return true if `cb` has been decorated with :func:`depsignal` for the given signal, class and connection mode. """ try: handlers = get_magic_attr(cb) except AttributeError: return False return _depsignal_...
[ "def", "is_depsignal_handler", "(", "class_", ",", "signal_name", ",", "cb", ",", "*", ",", "defer", "=", "False", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "cb", ")", "except", "AttributeError", ":", "return", "False", "return", "_deps...
Return true if `cb` has been decorated with :func:`depsignal` for the given signal, class and connection mode.
[ "Return", "true", "if", "cb", "has", "been", "decorated", "with", ":", "func", ":", "depsignal", "for", "the", "given", "signal", "class", "and", "connection", "mode", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1520-L1530
horazont/aioxmpp
aioxmpp/service.py
is_depfilter_handler
def is_depfilter_handler(class_, filter_name, filter_): """ Return true if `filter_` has been decorated with :func:`depfilter` for the given filter and class. """ try: handlers = get_magic_attr(filter_) except AttributeError: return False return _depfilter_spec(class_, filte...
python
def is_depfilter_handler(class_, filter_name, filter_): """ Return true if `filter_` has been decorated with :func:`depfilter` for the given filter and class. """ try: handlers = get_magic_attr(filter_) except AttributeError: return False return _depfilter_spec(class_, filte...
[ "def", "is_depfilter_handler", "(", "class_", ",", "filter_name", ",", "filter_", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "filter_", ")", "except", "AttributeError", ":", "return", "False", "return", "_depfilter_spec", "(", "class_", ",", ...
Return true if `filter_` has been decorated with :func:`depfilter` for the given filter and class.
[ "Return", "true", "if", "filter_", "has", "been", "decorated", "with", ":", "func", ":", "depfilter", "for", "the", "given", "filter", "and", "class", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1533-L1543
horazont/aioxmpp
aioxmpp/service.py
is_attrsignal_handler
def is_attrsignal_handler(descriptor, signal_name, cb, *, defer=False): """ Return true if `cb` has been decorated with :func:`attrsignal` for the given signal, descriptor and connection mode. """ try: handlers = get_magic_attr(cb) except AttributeError: return False return ...
python
def is_attrsignal_handler(descriptor, signal_name, cb, *, defer=False): """ Return true if `cb` has been decorated with :func:`attrsignal` for the given signal, descriptor and connection mode. """ try: handlers = get_magic_attr(cb) except AttributeError: return False return ...
[ "def", "is_attrsignal_handler", "(", "descriptor", ",", "signal_name", ",", "cb", ",", "*", ",", "defer", "=", "False", ")", ":", "try", ":", "handlers", "=", "get_magic_attr", "(", "cb", ")", "except", "AttributeError", ":", "return", "False", "return", "...
Return true if `cb` has been decorated with :func:`attrsignal` for the given signal, descriptor and connection mode.
[ "Return", "true", "if", "cb", "has", "been", "decorated", "with", ":", "func", ":", "attrsignal", "for", "the", "given", "signal", "descriptor", "and", "connection", "mode", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1546-L1556
horazont/aioxmpp
aioxmpp/service.py
Descriptor.add_to_stack
def add_to_stack(self, instance, stack): """ Get the context manager for the service `instance` and push it to the context manager `stack`. :param instance: The service to get the context manager for. :type instance: :class:`Service` :param stack: The context manager sta...
python
def add_to_stack(self, instance, stack): """ Get the context manager for the service `instance` and push it to the context manager `stack`. :param instance: The service to get the context manager for. :type instance: :class:`Service` :param stack: The context manager sta...
[ "def", "add_to_stack", "(", "self", ",", "instance", ",", "stack", ")", ":", "cm", "=", "self", ".", "init_cm", "(", "instance", ")", "obj", "=", "stack", ".", "enter_context", "(", "cm", ")", "self", ".", "_data", "[", "instance", "]", "=", "cm", ...
Get the context manager for the service `instance` and push it to the context manager `stack`. :param instance: The service to get the context manager for. :type instance: :class:`Service` :param stack: The context manager stack to push the CM onto. :type stack: :class:`contextl...
[ "Get", "the", "context", "manager", "for", "the", "service", "instance", "and", "push", "it", "to", "the", "context", "manager", "stack", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L284-L306
horazont/aioxmpp
aioxmpp/service.py
Meta.orders_after
def orders_after(self, other, *, visited=None): """ Return whether `self` depends on `other` and will be instanciated later. :param other: Another service. :type other: :class:`aioxmpp.service.Service` .. versionadded:: 0.11 """ return self.orders_after_...
python
def orders_after(self, other, *, visited=None): """ Return whether `self` depends on `other` and will be instanciated later. :param other: Another service. :type other: :class:`aioxmpp.service.Service` .. versionadded:: 0.11 """ return self.orders_after_...
[ "def", "orders_after", "(", "self", ",", "other", ",", "*", ",", "visited", "=", "None", ")", ":", "return", "self", ".", "orders_after_any", "(", "frozenset", "(", "[", "other", "]", ")", ",", "visited", "=", "visited", ")" ]
Return whether `self` depends on `other` and will be instanciated later. :param other: Another service. :type other: :class:`aioxmpp.service.Service` .. versionadded:: 0.11
[ "Return", "whether", "self", "depends", "on", "other", "and", "will", "be", "instanciated", "later", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L595-L605
horazont/aioxmpp
aioxmpp/service.py
Meta.orders_after_any
def orders_after_any(self, other, *, visited=None): """ Return whether `self` orders after any of the services in the set `other`. :param other: Another service. :type other: A :class:`set` of :class:`aioxmpp.service.Service` instances .. versionadded:: 0.11 ...
python
def orders_after_any(self, other, *, visited=None): """ Return whether `self` orders after any of the services in the set `other`. :param other: Another service. :type other: A :class:`set` of :class:`aioxmpp.service.Service` instances .. versionadded:: 0.11 ...
[ "def", "orders_after_any", "(", "self", ",", "other", ",", "*", ",", "visited", "=", "None", ")", ":", "if", "not", "other", ":", "return", "False", "if", "visited", "is", "None", ":", "visited", "=", "set", "(", ")", "elif", "self", "in", "visited",...
Return whether `self` orders after any of the services in the set `other`. :param other: Another service. :type other: A :class:`set` of :class:`aioxmpp.service.Service` instances .. versionadded:: 0.11
[ "Return", "whether", "self", "orders", "after", "any", "of", "the", "services", "in", "the", "set", "other", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L607-L632
horazont/aioxmpp
aioxmpp/service.py
Meta.independent_from
def independent_from(self, other): """ Return whether the services are independent (neither depends on the other). :param other: Another service. :type other: :class:`aioxmpp.service.Service` .. versionadded:: 0.11 """ if self is other: retur...
python
def independent_from(self, other): """ Return whether the services are independent (neither depends on the other). :param other: Another service. :type other: :class:`aioxmpp.service.Service` .. versionadded:: 0.11 """ if self is other: retur...
[ "def", "independent_from", "(", "self", ",", "other", ")", ":", "if", "self", "is", "other", ":", "return", "False", "return", "not", "self", ".", "orders_after", "(", "other", ")", "and", "not", "other", ".", "orders_after", "(", "self", ")" ]
Return whether the services are independent (neither depends on the other). :param other: Another service. :type other: :class:`aioxmpp.service.Service` .. versionadded:: 0.11
[ "Return", "whether", "the", "services", "are", "independent", "(", "neither", "depends", "on", "the", "other", ")", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L634-L646
horazont/aioxmpp
aioxmpp/service.py
Service.derive_logger
def derive_logger(self, logger): """ Return a child of `logger` specific for this instance. This is called after :attr:`client` has been set, from the constructor. The child name is calculated by the default implementation in a way specific for aioxmpp services; it is not meant ...
python
def derive_logger(self, logger): """ Return a child of `logger` specific for this instance. This is called after :attr:`client` has been set, from the constructor. The child name is calculated by the default implementation in a way specific for aioxmpp services; it is not meant ...
[ "def", "derive_logger", "(", "self", ",", "logger", ")", ":", "parts", "=", "type", "(", "self", ")", ".", "__module__", ".", "split", "(", "\".\"", ")", "[", "1", ":", "]", "if", "parts", "[", "-", "1", "]", "==", "\"service\"", "and", "len", "(...
Return a child of `logger` specific for this instance. This is called after :attr:`client` has been set, from the constructor. The child name is calculated by the default implementation in a way specific for aioxmpp services; it is not meant to be used by non-:mod:`aioxmpp` classes; do ...
[ "Return", "a", "child", "of", "logger", "specific", "for", "this", "instance", ".", "This", "is", "called", "after", ":", "attr", ":", "client", "has", "been", "set", "from", "the", "constructor", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L739-L755
horazont/aioxmpp
aioxmpp/tasks.py
TaskPool.set_limit
def set_limit(self, group, new_limit): """ Set a new limit on the number of tasks in the `group`. :param group: Group key of the group to modify. :type group: hashable :param new_limit: New limit for the number of tasks running in `group`. :type new_limit: non-negative :...
python
def set_limit(self, group, new_limit): """ Set a new limit on the number of tasks in the `group`. :param group: Group key of the group to modify. :type group: hashable :param new_limit: New limit for the number of tasks running in `group`. :type new_limit: non-negative :...
[ "def", "set_limit", "(", "self", ",", "group", ",", "new_limit", ")", ":", "if", "new_limit", "is", "None", ":", "self", ".", "_group_limits", ".", "pop", "(", "group", ",", "None", ")", "return", "self", ".", "_group_limits", "[", "group", "]", "=", ...
Set a new limit on the number of tasks in the `group`. :param group: Group key of the group to modify. :type group: hashable :param new_limit: New limit for the number of tasks running in `group`. :type new_limit: non-negative :class:`int` or :data:`None` :raise ValueError: if `...
[ "Set", "a", "new", "limit", "on", "the", "number", "of", "tasks", "in", "the", "group", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/tasks.py#L80-L107
horazont/aioxmpp
aioxmpp/tasks.py
TaskPool.spawn
def spawn(self, __groups, __coro_fun, *args, **kwargs): """ Start a new coroutine and add it to the pool atomically. :param groups: The groups the coroutine belongs to. :type groups: :class:`set` of group keys :param coro_fun: Coroutine function to run :param args: Posit...
python
def spawn(self, __groups, __coro_fun, *args, **kwargs): """ Start a new coroutine and add it to the pool atomically. :param groups: The groups the coroutine belongs to. :type groups: :class:`set` of group keys :param coro_fun: Coroutine function to run :param args: Posit...
[ "def", "spawn", "(", "self", ",", "__groups", ",", "__coro_fun", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# ensure the implicit group is included", "__groups", "=", "set", "(", "__groups", ")", "|", "{", "(", ")", "}", "return", "asyncio", "...
Start a new coroutine and add it to the pool atomically. :param groups: The groups the coroutine belongs to. :type groups: :class:`set` of group keys :param coro_fun: Coroutine function to run :param args: Positional arguments to pass to `coro_fun` :param kwargs: Keyword argumen...
[ "Start", "a", "new", "coroutine", "and", "add", "it", "to", "the", "pool", "atomically", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/tasks.py#L165-L200
horazont/aioxmpp
aioxmpp/carbons/service.py
CarbonsClient.enable
def enable(self): """ Enable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Client....
python
def enable(self): """ Enable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Client....
[ "def", "enable", "(", "self", ")", ":", "yield", "from", "self", ".", "_check_for_feature", "(", ")", "iq", "=", "aioxmpp", ".", "IQ", "(", "type_", "=", "aioxmpp", ".", "IQType", ".", "SET", ",", "payload", "=", "carbons_xso", ".", "Enable", "(", ")...
Enable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Client.send`
[ "Enable", "message", "carbons", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/carbons/service.py#L74-L90
horazont/aioxmpp
aioxmpp/carbons/service.py
CarbonsClient.disable
def disable(self): """ Disable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Clien...
python
def disable(self): """ Disable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Clien...
[ "def", "disable", "(", "self", ")", ":", "yield", "from", "self", ".", "_check_for_feature", "(", ")", "iq", "=", "aioxmpp", ".", "IQ", "(", "type_", "=", "aioxmpp", ".", "IQType", ".", "SET", ",", "payload", "=", "carbons_xso", ".", "Disable", "(", ...
Disable message carbons. :raises RuntimeError: if the server does not support message carbons. :raises aioxmpp.XMPPError: if the server responded with an error to the request. :raises: as specified in :meth:`aioxmpp.Client.send`
[ "Disable", "message", "carbons", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/carbons/service.py#L93-L109
horazont/aioxmpp
aioxmpp/stream.py
iq_handler
def iq_handler(stream, type_, payload_cls, coro, *, with_send_reply=False): """ Context manager to temporarily register a coroutine to handle IQ requests on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: IQ ty...
python
def iq_handler(stream, type_, payload_cls, coro, *, with_send_reply=False): """ Context manager to temporarily register a coroutine to handle IQ requests on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: IQ ty...
[ "def", "iq_handler", "(", "stream", ",", "type_", ",", "payload_cls", ",", "coro", ",", "*", ",", "with_send_reply", "=", "False", ")", ":", "stream", ".", "register_iq_request_handler", "(", "type_", ",", "payload_cls", ",", "coro", ",", "with_send_reply", ...
Context manager to temporarily register a coroutine to handle IQ requests on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: IQ type to react to (must be a request type). :type type_: :class:`~aioxmpp.IQType` :...
[ "Context", "manager", "to", "temporarily", "register", "a", "coroutine", "to", "handle", "IQ", "requests", "on", "a", ":", "class", ":", "StanzaStream", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2690-L2729
horazont/aioxmpp
aioxmpp/stream.py
message_handler
def message_handler(stream, type_, from_, cb): """ Context manager to temporarily register a callback to handle messages on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: Message type to listen for, or :data:`...
python
def message_handler(stream, type_, from_, cb): """ Context manager to temporarily register a callback to handle messages on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: Message type to listen for, or :data:`...
[ "def", "message_handler", "(", "stream", ",", "type_", ",", "from_", ",", "cb", ")", ":", "stream", ".", "register_message_callback", "(", "type_", ",", "from_", ",", "cb", ",", ")", "try", ":", "yield", "finally", ":", "stream", ".", "unregister_message_c...
Context manager to temporarily register a callback to handle messages on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: Message type to listen for, or :data:`None` for a wildcard match. :type typ...
[ "Context", "manager", "to", "temporarily", "register", "a", "callback", "to", "handle", "messages", "on", "a", ":", "class", ":", "StanzaStream", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2733-L2765
horazont/aioxmpp
aioxmpp/stream.py
presence_handler
def presence_handler(stream, type_, from_, cb): """ Context manager to temporarily register a callback to handle presence stanzas on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: Presence type to listen for. ...
python
def presence_handler(stream, type_, from_, cb): """ Context manager to temporarily register a callback to handle presence stanzas on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: Presence type to listen for. ...
[ "def", "presence_handler", "(", "stream", ",", "type_", ",", "from_", ",", "cb", ")", ":", "stream", ".", "register_presence_callback", "(", "type_", ",", "from_", ",", "cb", ",", ")", "try", ":", "yield", "finally", ":", "stream", ".", "unregister_presenc...
Context manager to temporarily register a callback to handle presence stanzas on a :class:`StanzaStream`. :param stream: Stanza stream to register the coroutine at :type stream: :class:`StanzaStream` :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: S...
[ "Context", "manager", "to", "temporarily", "register", "a", "callback", "to", "handle", "presence", "stanzas", "on", "a", ":", "class", ":", "StanzaStream", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2769-L2800
horazont/aioxmpp
aioxmpp/stream.py
stanza_filter
def stanza_filter(filter_, func, order=_Undefined): """ This is a deprecated alias of :meth:`aioxmpp.callbacks.Filter.context_register`. .. versionadded:: 0.8 .. deprecated:: 0.9 """ if order is not _Undefined: return filter_.context_register(func, order) else: return f...
python
def stanza_filter(filter_, func, order=_Undefined): """ This is a deprecated alias of :meth:`aioxmpp.callbacks.Filter.context_register`. .. versionadded:: 0.8 .. deprecated:: 0.9 """ if order is not _Undefined: return filter_.context_register(func, order) else: return f...
[ "def", "stanza_filter", "(", "filter_", ",", "func", ",", "order", "=", "_Undefined", ")", ":", "if", "order", "is", "not", "_Undefined", ":", "return", "filter_", ".", "context_register", "(", "func", ",", "order", ")", "else", ":", "return", "filter_", ...
This is a deprecated alias of :meth:`aioxmpp.callbacks.Filter.context_register`. .. versionadded:: 0.8 .. deprecated:: 0.9
[ "This", "is", "a", "deprecated", "alias", "of", ":", "meth", ":", "aioxmpp", ".", "callbacks", ".", "Filter", ".", "context_register", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2806-L2818
horazont/aioxmpp
aioxmpp/stream.py
StanzaToken.abort
def abort(self): """ Abort the stanza. Attempting to call this when the stanza is in any non-:class:`~StanzaState.ACTIVE`, non-:class:`~StanzaState.ABORTED` state results in a :class:`RuntimeError`. When a stanza is aborted, it will reside in the active queue of the stre...
python
def abort(self): """ Abort the stanza. Attempting to call this when the stanza is in any non-:class:`~StanzaState.ACTIVE`, non-:class:`~StanzaState.ABORTED` state results in a :class:`RuntimeError`. When a stanza is aborted, it will reside in the active queue of the stre...
[ "def", "abort", "(", "self", ")", ":", "if", "(", "self", ".", "_state", "!=", "StanzaState", ".", "ACTIVE", "and", "self", ".", "_state", "!=", "StanzaState", ".", "ABORTED", ")", ":", "raise", "RuntimeError", "(", "\"cannot abort stanza (already sent)\"", ...
Abort the stanza. Attempting to call this when the stanza is in any non-:class:`~StanzaState.ACTIVE`, non-:class:`~StanzaState.ABORTED` state results in a :class:`RuntimeError`. When a stanza is aborted, it will reside in the active queue of the stream, not will be sent and instead disc...
[ "Abort", "the", "stanza", ".", "Attempting", "to", "call", "this", "when", "the", "stanza", "is", "in", "any", "non", "-", ":", "class", ":", "~StanzaState", ".", "ACTIVE", "non", "-", ":", "class", ":", "~StanzaState", ".", "ABORTED", "state", "results"...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L436-L448
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._done_handler
def _done_handler(self, task): """ Called when the main task (:meth:`_run`, :attr:`_task`) returns. """ try: task.result() except asyncio.CancelledError: # normal termination pass except Exception as err: try: ...
python
def _done_handler(self, task): """ Called when the main task (:meth:`_run`, :attr:`_task`) returns. """ try: task.result() except asyncio.CancelledError: # normal termination pass except Exception as err: try: ...
[ "def", "_done_handler", "(", "self", ",", "task", ")", ":", "try", ":", "task", ".", "result", "(", ")", "except", "asyncio", ".", "CancelledError", ":", "# normal termination", "pass", "except", "Exception", "as", "err", ":", "try", ":", "if", "self", "...
Called when the main task (:meth:`_run`, :attr:`_task`) returns.
[ "Called", "when", "the", "main", "task", "(", ":", "meth", ":", "_run", ":", "attr", ":", "_task", ")", "returns", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L884-L902
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._destroy_stream_state
def _destroy_stream_state(self, exc): """ Destroy all state which does not make sense to keep after a disconnect (without stream management). """ self._logger.debug("destroying stream state (exc=%r)", exc) self._iq_response_map.close_all(exc) for task in self._iq_...
python
def _destroy_stream_state(self, exc): """ Destroy all state which does not make sense to keep after a disconnect (without stream management). """ self._logger.debug("destroying stream state (exc=%r)", exc) self._iq_response_map.close_all(exc) for task in self._iq_...
[ "def", "_destroy_stream_state", "(", "self", ",", "exc", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"destroying stream state (exc=%r)\"", ",", "exc", ")", "self", ".", "_iq_response_map", ".", "close_all", "(", "exc", ")", "for", "task", "in", "s...
Destroy all state which does not make sense to keep after a disconnect (without stream management).
[ "Destroy", "all", "state", "which", "does", "not", "make", "sense", "to", "keep", "after", "a", "disconnect", "(", "without", "stream", "management", ")", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L908-L925
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._iq_request_coro_done_send_reply
def _iq_request_coro_done_send_reply(self, request, task): """ Called when an IQ request handler coroutine returns. `request` holds the IQ request which triggered the excecution of the coroutine and `task` is the :class:`asyncio.Task` which tracks the running coroutine. Compose ...
python
def _iq_request_coro_done_send_reply(self, request, task): """ Called when an IQ request handler coroutine returns. `request` holds the IQ request which triggered the excecution of the coroutine and `task` is the :class:`asyncio.Task` which tracks the running coroutine. Compose ...
[ "def", "_iq_request_coro_done_send_reply", "(", "self", ",", "request", ",", "task", ")", ":", "try", ":", "payload", "=", "task", ".", "result", "(", ")", "except", "errors", ".", "XMPPError", "as", "err", ":", "self", ".", "_send_iq_reply", "(", "request...
Called when an IQ request handler coroutine returns. `request` holds the IQ request which triggered the excecution of the coroutine and `task` is the :class:`asyncio.Task` which tracks the running coroutine. Compose a response and send that response.
[ "Called", "when", "an", "IQ", "request", "handler", "coroutine", "returns", ".", "request", "holds", "the", "IQ", "request", "which", "triggered", "the", "excecution", "of", "the", "coroutine", "and", "task", "is", "the", ":", "class", ":", "asyncio", ".", ...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L953-L970
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._process_incoming_iq
def _process_incoming_iq(self, stanza_obj): """ Process an incoming IQ stanza `stanza_obj`. Calls the response handler, spawns a request handler coroutine or drops the stanza while logging a warning if no handler can be found. """ self._logger.debug("incoming iq: %r", sta...
python
def _process_incoming_iq(self, stanza_obj): """ Process an incoming IQ stanza `stanza_obj`. Calls the response handler, spawns a request handler coroutine or drops the stanza while logging a warning if no handler can be found. """ self._logger.debug("incoming iq: %r", sta...
[ "def", "_process_incoming_iq", "(", "self", ",", "stanza_obj", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"incoming iq: %r\"", ",", "stanza_obj", ")", "if", "stanza_obj", ".", "type_", ".", "is_response", ":", "# iq response", "self", ".", "_logger...
Process an incoming IQ stanza `stanza_obj`. Calls the response handler, spawns a request handler coroutine or drops the stanza while logging a warning if no handler can be found.
[ "Process", "an", "incoming", "IQ", "stanza", "stanza_obj", ".", "Calls", "the", "response", "handler", "spawns", "a", "request", "handler", "coroutine", "or", "drops", "the", "stanza", "while", "logging", "a", "warning", "if", "no", "handler", "can", "be", "...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L978-L1055
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._process_incoming_message
def _process_incoming_message(self, stanza_obj): """ Process an incoming message stanza `stanza_obj`. """ self._logger.debug("incoming message: %r", stanza_obj) stanza_obj = self.service_inbound_message_filter.filter(stanza_obj) if stanza_obj is None: self._l...
python
def _process_incoming_message(self, stanza_obj): """ Process an incoming message stanza `stanza_obj`. """ self._logger.debug("incoming message: %r", stanza_obj) stanza_obj = self.service_inbound_message_filter.filter(stanza_obj) if stanza_obj is None: self._l...
[ "def", "_process_incoming_message", "(", "self", ",", "stanza_obj", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"incoming message: %r\"", ",", "stanza_obj", ")", "stanza_obj", "=", "self", ".", "service_inbound_message_filter", ".", "filter", "(", "stan...
Process an incoming message stanza `stanza_obj`.
[ "Process", "an", "incoming", "message", "stanza", "stanza_obj", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1057-L1075
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._process_incoming_presence
def _process_incoming_presence(self, stanza_obj): """ Process an incoming presence stanza `stanza_obj`. """ self._logger.debug("incoming presence: %r", stanza_obj) stanza_obj = self.service_inbound_presence_filter.filter(stanza_obj) if stanza_obj is None: sel...
python
def _process_incoming_presence(self, stanza_obj): """ Process an incoming presence stanza `stanza_obj`. """ self._logger.debug("incoming presence: %r", stanza_obj) stanza_obj = self.service_inbound_presence_filter.filter(stanza_obj) if stanza_obj is None: sel...
[ "def", "_process_incoming_presence", "(", "self", ",", "stanza_obj", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"incoming presence: %r\"", ",", "stanza_obj", ")", "stanza_obj", "=", "self", ".", "service_inbound_presence_filter", ".", "filter", "(", "s...
Process an incoming presence stanza `stanza_obj`.
[ "Process", "an", "incoming", "presence", "stanza", "stanza_obj", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1077-L1095
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._process_incoming
def _process_incoming(self, xmlstream, queue_entry): """ Dispatch to the different methods responsible for the different stanza types or handle a non-stanza stream-level element from `stanza_obj`, which has arrived over the given `xmlstream`. """ stanza_obj, exc = queue_...
python
def _process_incoming(self, xmlstream, queue_entry): """ Dispatch to the different methods responsible for the different stanza types or handle a non-stanza stream-level element from `stanza_obj`, which has arrived over the given `xmlstream`. """ stanza_obj, exc = queue_...
[ "def", "_process_incoming", "(", "self", ",", "xmlstream", ",", "queue_entry", ")", ":", "stanza_obj", ",", "exc", "=", "queue_entry", "# first, handle SM stream objects", "if", "isinstance", "(", "stanza_obj", ",", "nonza", ".", "SMAcknowledgement", ")", ":", "se...
Dispatch to the different methods responsible for the different stanza types or handle a non-stanza stream-level element from `stanza_obj`, which has arrived over the given `xmlstream`.
[ "Dispatch", "to", "the", "different", "methods", "responsible", "for", "the", "different", "stanza", "types", "or", "handle", "a", "non", "-", "stanza", "stream", "-", "level", "element", "from", "stanza_obj", "which", "has", "arrived", "over", "the", "given",...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1145-L1193
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.flush_incoming
def flush_incoming(self): """ Flush all incoming queues to the respective processing methods. The handlers are called as usual, thus it may require at least one iteration through the asyncio event loop before effects can be seen. The incoming queues are empty after a call to thi...
python
def flush_incoming(self): """ Flush all incoming queues to the respective processing methods. The handlers are called as usual, thus it may require at least one iteration through the asyncio event loop before effects can be seen. The incoming queues are empty after a call to thi...
[ "def", "flush_incoming", "(", "self", ")", ":", "while", "True", ":", "try", ":", "stanza_obj", "=", "self", ".", "_incoming_queue", ".", "get_nowait", "(", ")", "except", "asyncio", ".", "QueueEmpty", ":", "break", "self", ".", "_process_incoming", "(", "...
Flush all incoming queues to the respective processing methods. The handlers are called as usual, thus it may require at least one iteration through the asyncio event loop before effects can be seen. The incoming queues are empty after a call to this method. It is legal (but pretty use...
[ "Flush", "all", "incoming", "queues", "to", "the", "respective", "processing", "methods", ".", "The", "handlers", "are", "called", "as", "usual", "thus", "it", "may", "require", "at", "least", "one", "iteration", "through", "the", "asyncio", "event", "loop", ...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1195-L1211
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._send_stanza
def _send_stanza(self, xmlstream, token): """ Send a stanza token `token` over the given `xmlstream`. Only sends if the `token` has not been aborted (see :meth:`StanzaToken.abort`). Sends the state of the token acoording to :attr:`sm_enabled`. """ if token.state ...
python
def _send_stanza(self, xmlstream, token): """ Send a stanza token `token` over the given `xmlstream`. Only sends if the `token` has not been aborted (see :meth:`StanzaToken.abort`). Sends the state of the token acoording to :attr:`sm_enabled`. """ if token.state ...
[ "def", "_send_stanza", "(", "self", ",", "xmlstream", ",", "token", ")", ":", "if", "token", ".", "state", "==", "StanzaState", ".", "ABORTED", ":", "return", "stanza_obj", "=", "token", ".", "stanza", "if", "isinstance", "(", "stanza_obj", ",", "stanza", ...
Send a stanza token `token` over the given `xmlstream`. Only sends if the `token` has not been aborted (see :meth:`StanzaToken.abort`). Sends the state of the token acoording to :attr:`sm_enabled`.
[ "Send", "a", "stanza", "token", "token", "over", "the", "given", "xmlstream", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1213-L1263
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._process_outgoing
def _process_outgoing(self, xmlstream, token): """ Process the current outgoing stanza `token` and also any other outgoing stanza which is currently in the active queue. After all stanzas have been processed, use :meth:`_send_ping` to allow an opportunistic ping to be sent. ...
python
def _process_outgoing(self, xmlstream, token): """ Process the current outgoing stanza `token` and also any other outgoing stanza which is currently in the active queue. After all stanzas have been processed, use :meth:`_send_ping` to allow an opportunistic ping to be sent. ...
[ "def", "_process_outgoing", "(", "self", ",", "xmlstream", ",", "token", ")", ":", "self", ".", "_send_stanza", "(", "xmlstream", ",", "token", ")", "# try to send a bulk", "while", "True", ":", "try", ":", "token", "=", "self", ".", "_active_queue", ".", ...
Process the current outgoing stanza `token` and also any other outgoing stanza which is currently in the active queue. After all stanzas have been processed, use :meth:`_send_ping` to allow an opportunistic ping to be sent.
[ "Process", "the", "current", "outgoing", "stanza", "token", "and", "also", "any", "other", "outgoing", "stanza", "which", "is", "currently", "in", "the", "active", "queue", ".", "After", "all", "stanzas", "have", "been", "processed", "use", ":", "meth", ":",...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1265-L1284
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.register_iq_response_callback
def register_iq_response_callback(self, from_, id_, cb): """ Register a callback function `cb` to be called when a IQ stanza with type ``result`` or ``error`` is recieved from the :class:`~aioxmpp.JID` `from_` with the id `id_`. The callback is called at most once. .. n...
python
def register_iq_response_callback(self, from_, id_, cb): """ Register a callback function `cb` to be called when a IQ stanza with type ``result`` or ``error`` is recieved from the :class:`~aioxmpp.JID` `from_` with the id `id_`. The callback is called at most once. .. n...
[ "def", "register_iq_response_callback", "(", "self", ",", "from_", ",", "id_", ",", "cb", ")", ":", "self", ".", "_iq_response_map", ".", "add_listener", "(", "(", "from_", ",", "id_", ")", ",", "callbacks", ".", "OneshotAsyncTagListener", "(", "cb", ",", ...
Register a callback function `cb` to be called when a IQ stanza with type ``result`` or ``error`` is recieved from the :class:`~aioxmpp.JID` `from_` with the id `id_`. The callback is called at most once. .. note:: In contrast to :meth:`register_iq_response_future`, errors ...
[ "Register", "a", "callback", "function", "cb", "to", "be", "called", "when", "a", "IQ", "stanza", "with", "type", "result", "or", "error", "is", "recieved", "from", "the", ":", "class", ":", "~aioxmpp", ".", "JID", "from_", "with", "the", "id", "id_", ...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1286-L1311
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.register_iq_response_future
def register_iq_response_future(self, from_, id_, fut): """ Register a future `fut` for an IQ stanza with type ``result`` or ``error`` from the :class:`~aioxmpp.JID` `from_` with the id `id_`. If the type of the IQ stanza is ``result``, the stanza is set as result to the...
python
def register_iq_response_future(self, from_, id_, fut): """ Register a future `fut` for an IQ stanza with type ``result`` or ``error`` from the :class:`~aioxmpp.JID` `from_` with the id `id_`. If the type of the IQ stanza is ``result``, the stanza is set as result to the...
[ "def", "register_iq_response_future", "(", "self", ",", "from_", ",", "id_", ",", "fut", ")", ":", "self", ".", "_iq_response_map", ".", "add_listener", "(", "(", "from_", ",", "id_", ")", ",", "StanzaErrorAwareListener", "(", "callbacks", ".", "FutureListener...
Register a future `fut` for an IQ stanza with type ``result`` or ``error`` from the :class:`~aioxmpp.JID` `from_` with the id `id_`. If the type of the IQ stanza is ``result``, the stanza is set as result to the future. If the type of the IQ stanza is ``error``, the stanzas erro...
[ "Register", "a", "future", "fut", "for", "an", "IQ", "stanza", "with", "type", "result", "or", "error", "from", "the", ":", "class", ":", "~aioxmpp", ".", "JID", "from_", "with", "the", "id", "id_", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1313-L1360
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.unregister_iq_response
def unregister_iq_response(self, from_, id_): """ Unregister a registered callback or future for the IQ response identified by `from_` and `id_`. See :meth:`register_iq_response_future` or :meth:`register_iq_response_callback` for details on the arguments meanings and how...
python
def unregister_iq_response(self, from_, id_): """ Unregister a registered callback or future for the IQ response identified by `from_` and `id_`. See :meth:`register_iq_response_future` or :meth:`register_iq_response_callback` for details on the arguments meanings and how...
[ "def", "unregister_iq_response", "(", "self", ",", "from_", ",", "id_", ")", ":", "self", ".", "_iq_response_map", ".", "remove_listener", "(", "(", "from_", ",", "id_", ")", ")", "self", ".", "_logger", ".", "debug", "(", "\"iq response unregistered: from=%r,...
Unregister a registered callback or future for the IQ response identified by `from_` and `id_`. See :meth:`register_iq_response_future` or :meth:`register_iq_response_callback` for details on the arguments meanings and how to register futures and callbacks respectively. .. note:...
[ "Unregister", "a", "registered", "callback", "or", "future", "for", "the", "IQ", "response", "identified", "by", "from_", "and", "id_", ".", "See", ":", "meth", ":", "register_iq_response_future", "or", ":", "meth", ":", "register_iq_response_callback", "for", "...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1362-L1377
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.register_iq_request_coro
def register_iq_request_coro(self, type_, payload_cls, coro): """ Alias of :meth:`register_iq_request_handler`. .. deprecated:: 0.10 This alias will be removed in version 1.0. """ warnings.warn( "register_iq_request_coro is a deprecated alias to " ...
python
def register_iq_request_coro(self, type_, payload_cls, coro): """ Alias of :meth:`register_iq_request_handler`. .. deprecated:: 0.10 This alias will be removed in version 1.0. """ warnings.warn( "register_iq_request_coro is a deprecated alias to " ...
[ "def", "register_iq_request_coro", "(", "self", ",", "type_", ",", "payload_cls", ",", "coro", ")", ":", "warnings", ".", "warn", "(", "\"register_iq_request_coro is a deprecated alias to \"", "\"register_iq_request_handler and will be removed in aioxmpp 1.0\"", ",", "Deprecati...
Alias of :meth:`register_iq_request_handler`. .. deprecated:: 0.10 This alias will be removed in version 1.0.
[ "Alias", "of", ":", "meth", ":", "register_iq_request_handler", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1379-L1392
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.register_iq_request_handler
def register_iq_request_handler(self, type_, payload_cls, cb, *, with_send_reply=False): """ Register a coroutine function or a function returning an awaitable to run when an IQ request is received. :param type_: IQ type to react to (must be a request...
python
def register_iq_request_handler(self, type_, payload_cls, cb, *, with_send_reply=False): """ Register a coroutine function or a function returning an awaitable to run when an IQ request is received. :param type_: IQ type to react to (must be a request...
[ "def", "register_iq_request_handler", "(", "self", ",", "type_", ",", "payload_cls", ",", "cb", ",", "*", ",", "with_send_reply", "=", "False", ")", ":", "type_", "=", "self", ".", "_coerce_enum", "(", "type_", ",", "structs", ".", "IQType", ")", "if", "...
Register a coroutine function or a function returning an awaitable to run when an IQ request is received. :param type_: IQ type to react to (must be a request type). :type type_: :class:`~aioxmpp.IQType` :param payload_cls: Payload class to react to (subclass of :class:`~xso...
[ "Register", "a", "coroutine", "function", "or", "a", "function", "returning", "an", "awaitable", "to", "run", "when", "an", "IQ", "request", "is", "received", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1394-L1511
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.unregister_iq_request_handler
def unregister_iq_request_handler(self, type_, payload_cls): """ Unregister a coroutine previously registered with :meth:`register_iq_request_handler`. :param type_: IQ type to react to (must be a request type). :type type_: :class:`~structs.IQType` :param payload_cls: P...
python
def unregister_iq_request_handler(self, type_, payload_cls): """ Unregister a coroutine previously registered with :meth:`register_iq_request_handler`. :param type_: IQ type to react to (must be a request type). :type type_: :class:`~structs.IQType` :param payload_cls: P...
[ "def", "unregister_iq_request_handler", "(", "self", ",", "type_", ",", "payload_cls", ")", ":", "type_", "=", "self", ".", "_coerce_enum", "(", "type_", ",", "structs", ".", "IQType", ")", "del", "self", ".", "_iq_request_map", "[", "type_", ",", "payload_c...
Unregister a coroutine previously registered with :meth:`register_iq_request_handler`. :param type_: IQ type to react to (must be a request type). :type type_: :class:`~structs.IQType` :param payload_cls: Payload class to react to (subclass of :class:`~xso.XSO`) :typ...
[ "Unregister", "a", "coroutine", "previously", "registered", "with", ":", "meth", ":", "register_iq_request_handler", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1522-L1561
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.register_message_callback
def register_message_callback(self, type_, from_, cb): """ Register a callback to be called when a message is received. :param type_: Message type to listen for, or :data:`None` for a wildcard match. :type type_: :class:`~.MessageType` or :data:`None` :para...
python
def register_message_callback(self, type_, from_, cb): """ Register a callback to be called when a message is received. :param type_: Message type to listen for, or :data:`None` for a wildcard match. :type type_: :class:`~.MessageType` or :data:`None` :para...
[ "def", "register_message_callback", "(", "self", ",", "type_", ",", "from_", ",", "cb", ")", ":", "if", "type_", "is", "not", "None", ":", "type_", "=", "self", ".", "_coerce_enum", "(", "type_", ",", "structs", ".", "MessageType", ")", "warnings", ".", ...
Register a callback to be called when a message is received. :param type_: Message type to listen for, or :data:`None` for a wildcard match. :type type_: :class:`~.MessageType` or :data:`None` :param from_: Sender JID to listen for, or :data:`None` for a wildcard ...
[ "Register", "a", "callback", "to", "be", "called", "when", "a", "message", "is", "received", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1563-L1622
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.unregister_message_callback
def unregister_message_callback(self, type_, from_): """ Unregister a callback previously registered with :meth:`register_message_callback`. :param type_: Message type to listen for. :type type_: :class:`~.MessageType` or :data:`None` :param from_: Sender JID to listen f...
python
def unregister_message_callback(self, type_, from_): """ Unregister a callback previously registered with :meth:`register_message_callback`. :param type_: Message type to listen for. :type type_: :class:`~.MessageType` or :data:`None` :param from_: Sender JID to listen f...
[ "def", "unregister_message_callback", "(", "self", ",", "type_", ",", "from_", ")", ":", "if", "type_", "is", "not", "None", ":", "type_", "=", "self", ".", "_coerce_enum", "(", "type_", ",", "structs", ".", "MessageType", ")", "warnings", ".", "warn", "...
Unregister a callback previously registered with :meth:`register_message_callback`. :param type_: Message type to listen for. :type type_: :class:`~.MessageType` or :data:`None` :param from_: Sender JID to listen for. :type from_: :class:`~aioxmpp.JID` or :data:`None` :r...
[ "Unregister", "a", "callback", "previously", "registered", "with", ":", "meth", ":", "register_message_callback", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1624-L1678
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.register_presence_callback
def register_presence_callback(self, type_, from_, cb): """ Register a callback to be called when a presence stanza is received. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data:`None` for a wildcard...
python
def register_presence_callback(self, type_, from_, cb): """ Register a callback to be called when a presence stanza is received. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data:`None` for a wildcard...
[ "def", "register_presence_callback", "(", "self", ",", "type_", ",", "from_", ",", "cb", ")", ":", "type_", "=", "self", ".", "_coerce_enum", "(", "type_", ",", "structs", ".", "PresenceType", ")", "warnings", ".", "warn", "(", "\"register_presence_callback is...
Register a callback to be called when a presence stanza is received. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data:`None` for a wildcard match. :type from_: :class:`~aioxmpp.JID` or ...
[ "Register", "a", "callback", "to", "be", "called", "when", "a", "presence", "stanza", "is", "received", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1680-L1736
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.unregister_presence_callback
def unregister_presence_callback(self, type_, from_): """ Unregister a callback previously registered with :meth:`register_presence_callback`. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data...
python
def unregister_presence_callback(self, type_, from_): """ Unregister a callback previously registered with :meth:`register_presence_callback`. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data...
[ "def", "unregister_presence_callback", "(", "self", ",", "type_", ",", "from_", ")", ":", "type_", "=", "self", ".", "_coerce_enum", "(", "type_", ",", "structs", ".", "PresenceType", ")", "warnings", ".", "warn", "(", "\"unregister_presence_callback is deprecated...
Unregister a callback previously registered with :meth:`register_presence_callback`. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data:`None` for a wildcard match. :type from_: :...
[ "Unregister", "a", "callback", "previously", "registered", "with", ":", "meth", ":", "register_presence_callback", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1738-L1789
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.start
def start(self, xmlstream): """ Start or resume the stanza stream on the given :class:`aioxmpp.protocol.XMLStream` `xmlstream`. This starts the main broker task, registers stanza classes at the `xmlstream` . """ if self.running: raise RuntimeError("a...
python
def start(self, xmlstream): """ Start or resume the stanza stream on the given :class:`aioxmpp.protocol.XMLStream` `xmlstream`. This starts the main broker task, registers stanza classes at the `xmlstream` . """ if self.running: raise RuntimeError("a...
[ "def", "start", "(", "self", ",", "xmlstream", ")", ":", "if", "self", ".", "running", ":", "raise", "RuntimeError", "(", "\"already started\"", ")", "self", ".", "_start_prepare", "(", "xmlstream", ",", "self", ".", "recv_stanza", ")", "self", ".", "_clos...
Start or resume the stanza stream on the given :class:`aioxmpp.protocol.XMLStream` `xmlstream`. This starts the main broker task, registers stanza classes at the `xmlstream` .
[ "Start", "or", "resume", "the", "stanza", "stream", "on", "the", "given", ":", "class", ":", "aioxmpp", ".", "protocol", ".", "XMLStream", "xmlstream", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1878-L1892
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.stop
def stop(self): """ Send a signal to the main broker task to terminate. You have to check :attr:`running` and possibly wait for it to become :data:`False` --- the task takes at least one loop through the event loop to terminate. It is guarenteed that the task will not attempt to...
python
def stop(self): """ Send a signal to the main broker task to terminate. You have to check :attr:`running` and possibly wait for it to become :data:`False` --- the task takes at least one loop through the event loop to terminate. It is guarenteed that the task will not attempt to...
[ "def", "stop", "(", "self", ")", ":", "if", "not", "self", ".", "running", ":", "return", "self", ".", "_logger", ".", "debug", "(", "\"sending stop signal to task\"", ")", "self", ".", "_task", ".", "cancel", "(", ")" ]
Send a signal to the main broker task to terminate. You have to check :attr:`running` and possibly wait for it to become :data:`False` --- the task takes at least one loop through the event loop to terminate. It is guarenteed that the task will not attempt to send stanzas over the exist...
[ "Send", "a", "signal", "to", "the", "main", "broker", "task", "to", "terminate", ".", "You", "have", "to", "check", ":", "attr", ":", "running", "and", "possibly", "wait", "for", "it", "to", "become", ":", "data", ":", "False", "---", "the", "task", ...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1894-L1909
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.wait_stop
def wait_stop(self): """ Stop the stream and wait for it to stop. See :meth:`stop` for the general stopping conditions. You can assume that :meth:`stop` is the first thing this coroutine calls. """ if not self.running: return self.stop() try: ...
python
def wait_stop(self): """ Stop the stream and wait for it to stop. See :meth:`stop` for the general stopping conditions. You can assume that :meth:`stop` is the first thing this coroutine calls. """ if not self.running: return self.stop() try: ...
[ "def", "wait_stop", "(", "self", ")", ":", "if", "not", "self", ".", "running", ":", "return", "self", ".", "stop", "(", ")", "try", ":", "yield", "from", "self", ".", "_task", "except", "asyncio", ".", "CancelledError", ":", "pass" ]
Stop the stream and wait for it to stop. See :meth:`stop` for the general stopping conditions. You can assume that :meth:`stop` is the first thing this coroutine calls.
[ "Stop", "the", "stream", "and", "wait", "for", "it", "to", "stop", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1912-L1925
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.close
def close(self): """ Close the stream and the underlying XML stream (if any is connected). This is essentially a way of saying "I do not want to use this stream anymore" (until the next call to :meth:`start`). If the stream is currently running, the XML stream is closed graceful...
python
def close(self): """ Close the stream and the underlying XML stream (if any is connected). This is essentially a way of saying "I do not want to use this stream anymore" (until the next call to :meth:`start`). If the stream is currently running, the XML stream is closed graceful...
[ "def", "close", "(", "self", ")", ":", "exc", "=", "DestructionRequested", "(", "\"close() called\"", ")", "if", "self", ".", "running", ":", "if", "self", ".", "sm_enabled", ":", "self", ".", "_xmlstream", ".", "send_xso", "(", "nonza", ".", "SMAcknowledg...
Close the stream and the underlying XML stream (if any is connected). This is essentially a way of saying "I do not want to use this stream anymore" (until the next call to :meth:`start`). If the stream is currently running, the XML stream is closed gracefully (potentially sending an SM...
[ "Close", "the", "stream", "and", "the", "underlying", "XML", "stream", "(", "if", "any", "is", "connected", ")", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1928-L1976
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.start_sm
def start_sm(self, request_resumption=True, resumption_timeout=None): """ Start stream management (version 3). :param request_resumption: Request that the stream shall be resumable. :type request_resumption: :class:`bool` :param resumption_timeout: Maximum time in seconds for a ...
python
def start_sm(self, request_resumption=True, resumption_timeout=None): """ Start stream management (version 3). :param request_resumption: Request that the stream shall be resumable. :type request_resumption: :class:`bool` :param resumption_timeout: Maximum time in seconds for a ...
[ "def", "start_sm", "(", "self", ",", "request_resumption", "=", "True", ",", "resumption_timeout", "=", "None", ")", ":", "if", "not", "self", ".", "running", ":", "raise", "RuntimeError", "(", "\"cannot start Stream Management while\"", "\" StanzaStream is not runnin...
Start stream management (version 3). :param request_resumption: Request that the stream shall be resumable. :type request_resumption: :class:`bool` :param resumption_timeout: Maximum time in seconds for a stream to be resumable. :type resumption_timeout: :class:`int` ...
[ "Start", "stream", "management", "(", "version", "3", ")", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2090-L2210
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._resume_sm
def _resume_sm(self, remote_ctr): """ Version of :meth:`resume_sm` which can be used during slow start. """ self._logger.info("resuming SM stream with remote_ctr=%d", remote_ctr) # remove any acked stanzas self.sm_ack(remote_ctr) # reinsert the remaining stanzas ...
python
def _resume_sm(self, remote_ctr): """ Version of :meth:`resume_sm` which can be used during slow start. """ self._logger.info("resuming SM stream with remote_ctr=%d", remote_ctr) # remove any acked stanzas self.sm_ack(remote_ctr) # reinsert the remaining stanzas ...
[ "def", "_resume_sm", "(", "self", ",", "remote_ctr", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"resuming SM stream with remote_ctr=%d\"", ",", "remote_ctr", ")", "# remove any acked stanzas", "self", ".", "sm_ack", "(", "remote_ctr", ")", "# reinsert the...
Version of :meth:`resume_sm` which can be used during slow start.
[ "Version", "of", ":", "meth", ":", "resume_sm", "which", "can", "be", "used", "during", "slow", "start", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2341-L2351
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.resume_sm
def resume_sm(self, xmlstream): """ Resume an SM-enabled stream using the given `xmlstream`. If the server rejects the attempt to resume stream management, a :class:`.errors.StreamNegotiationFailure` is raised. The stream is then in stopped state and stream management has been s...
python
def resume_sm(self, xmlstream): """ Resume an SM-enabled stream using the given `xmlstream`. If the server rejects the attempt to resume stream management, a :class:`.errors.StreamNegotiationFailure` is raised. The stream is then in stopped state and stream management has been s...
[ "def", "resume_sm", "(", "self", ",", "xmlstream", ")", ":", "if", "self", ".", "running", ":", "raise", "RuntimeError", "(", "\"Cannot resume Stream Management while\"", "\" StanzaStream is running\"", ")", "self", ".", "_start_prepare", "(", "xmlstream", ",", "sel...
Resume an SM-enabled stream using the given `xmlstream`. If the server rejects the attempt to resume stream management, a :class:`.errors.StreamNegotiationFailure` is raised. The stream is then in stopped state and stream management has been stopped. .. warning:: This metho...
[ "Resume", "an", "SM", "-", "enabled", "stream", "using", "the", "given", "xmlstream", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2359-L2434
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._stop_sm
def _stop_sm(self): """ Version of :meth:`stop_sm` which can be called during startup. """ if not self.sm_enabled: raise RuntimeError("Stream Management is not enabled") self._logger.info("stopping SM stream") self._sm_enabled = False del self._sm_out...
python
def _stop_sm(self): """ Version of :meth:`stop_sm` which can be called during startup. """ if not self.sm_enabled: raise RuntimeError("Stream Management is not enabled") self._logger.info("stopping SM stream") self._sm_enabled = False del self._sm_out...
[ "def", "_stop_sm", "(", "self", ")", ":", "if", "not", "self", ".", "sm_enabled", ":", "raise", "RuntimeError", "(", "\"Stream Management is not enabled\"", ")", "self", ".", "_logger", ".", "info", "(", "\"stopping SM stream\"", ")", "self", ".", "_sm_enabled",...
Version of :meth:`stop_sm` which can be called during startup.
[ "Version", "of", ":", "meth", ":", "stop_sm", "which", "can", "be", "called", "during", "startup", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2436-L2452
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.sm_ack
def sm_ack(self, remote_ctr): """ Process the remote stanza counter `remote_ctr`. Any acked stanzas are dropped from :attr:`sm_unacked_list` and put into :attr:`StanzaState.ACKED` state and the counters are increased accordingly. If called with an erroneous remote stanza...
python
def sm_ack(self, remote_ctr): """ Process the remote stanza counter `remote_ctr`. Any acked stanzas are dropped from :attr:`sm_unacked_list` and put into :attr:`StanzaState.ACKED` state and the counters are increased accordingly. If called with an erroneous remote stanza...
[ "def", "sm_ack", "(", "self", ",", "remote_ctr", ")", ":", "if", "not", "self", ".", "_sm_enabled", ":", "raise", "RuntimeError", "(", "\"Stream Management is not enabled\"", ")", "self", ".", "_logger", ".", "debug", "(", "\"sm_ack(%d)\"", ",", "remote_ctr", ...
Process the remote stanza counter `remote_ctr`. Any acked stanzas are dropped from :attr:`sm_unacked_list` and put into :attr:`StanzaState.ACKED` state and the counters are increased accordingly. If called with an erroneous remote stanza counter :class:`.errors.StreamNegotationF...
[ "Process", "the", "remote", "stanza", "counter", "remote_ctr", ".", "Any", "acked", "stanzas", "are", "dropped", "from", ":", "attr", ":", "sm_unacked_list", "and", "put", "into", ":", "attr", ":", "StanzaState", ".", "ACKED", "state", "and", "the", "counter...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2469-L2506
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.send_iq_and_wait_for_reply
def send_iq_and_wait_for_reply(self, iq, *, timeout=None): """ Send an IQ stanza `iq` and wait for the response. If `timeout` is not :data:`None`, it must be the time in seconds for which to wait for a response. If the response is a ``"result"`...
python
def send_iq_and_wait_for_reply(self, iq, *, timeout=None): """ Send an IQ stanza `iq` and wait for the response. If `timeout` is not :data:`None`, it must be the time in seconds for which to wait for a response. If the response is a ``"result"`...
[ "def", "send_iq_and_wait_for_reply", "(", "self", ",", "iq", ",", "*", ",", "timeout", "=", "None", ")", ":", "warnings", ".", "warn", "(", "r\"send_iq_and_wait_for_reply is deprecated and will be removed in\"", "r\" 1.0\"", ",", "DeprecationWarning", ",", "stacklevel",...
Send an IQ stanza `iq` and wait for the response. If `timeout` is not :data:`None`, it must be the time in seconds for which to wait for a response. If the response is a ``"result"`` IQ, the value of the :attr:`~aioxmpp.IQ.payload` attribute is returned. Otherwise, the exception...
[ "Send", "an", "IQ", "stanza", "iq", "and", "wait", "for", "the", "response", ".", "If", "timeout", "is", "not", ":", "data", ":", "None", "it", "must", "be", "the", "time", "in", "seconds", "for", "which", "to", "wait", "for", "a", "response", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2509-L2542
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream.send_and_wait_for_sent
def send_and_wait_for_sent(self, stanza): """ Send the given `stanza` over the given :class:`StanzaStream` `stream`. .. deprecated:: 0.8 This method will be removed in 1.0. Use :meth:`send` instead. """ warnings.warn( r"send_and_wait_for_sent is deprecate...
python
def send_and_wait_for_sent(self, stanza): """ Send the given `stanza` over the given :class:`StanzaStream` `stream`. .. deprecated:: 0.8 This method will be removed in 1.0. Use :meth:`send` instead. """ warnings.warn( r"send_and_wait_for_sent is deprecate...
[ "def", "send_and_wait_for_sent", "(", "self", ",", "stanza", ")", ":", "warnings", ".", "warn", "(", "r\"send_and_wait_for_sent is deprecated and will be removed in 1.0\"", ",", "DeprecationWarning", ",", "stacklevel", "=", "1", ",", ")", "yield", "from", "self", ".",...
Send the given `stanza` over the given :class:`StanzaStream` `stream`. .. deprecated:: 0.8 This method will be removed in 1.0. Use :meth:`send` instead.
[ "Send", "the", "given", "stanza", "over", "the", "given", ":", "class", ":", "StanzaStream", "stream", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2545-L2558
horazont/aioxmpp
aioxmpp/stream.py
StanzaStream._send_immediately
def _send_immediately(self, stanza, *, timeout=None, cb=None): """ Send a stanza without waiting for the stream to be ready to send stanzas. This is only useful from within :class:`aioxmpp.node.Client` before the stream is fully established. """ stanza.autoset_id...
python
def _send_immediately(self, stanza, *, timeout=None, cb=None): """ Send a stanza without waiting for the stream to be ready to send stanzas. This is only useful from within :class:`aioxmpp.node.Client` before the stream is fully established. """ stanza.autoset_id...
[ "def", "_send_immediately", "(", "self", ",", "stanza", ",", "*", ",", "timeout", "=", "None", ",", "cb", "=", "None", ")", ":", "stanza", ".", "autoset_id", "(", ")", "self", ".", "_logger", ".", "debug", "(", "\"sending %r and waiting for it to be sent\"",...
Send a stanza without waiting for the stream to be ready to send stanzas. This is only useful from within :class:`aioxmpp.node.Client` before the stream is fully established.
[ "Send", "a", "stanza", "without", "waiting", "for", "the", "stream", "to", "be", "ready", "to", "send", "stanzas", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L2561-L2673
horazont/aioxmpp
aioxmpp/entitycaps/caps390.py
_process_features
def _process_features(features): """ Generate the `Features String` from an iterable of features. :param features: The features to generate the features string from. :type features: :class:`~collections.abc.Iterable` of :class:`str` :return: The `Features String` :rtype: :class:`bytes` Gen...
python
def _process_features(features): """ Generate the `Features String` from an iterable of features. :param features: The features to generate the features string from. :type features: :class:`~collections.abc.Iterable` of :class:`str` :return: The `Features String` :rtype: :class:`bytes` Gen...
[ "def", "_process_features", "(", "features", ")", ":", "parts", "=", "[", "feature", ".", "encode", "(", "\"utf-8\"", ")", "+", "b\"\\x1f\"", "for", "feature", "in", "features", "]", "parts", ".", "sort", "(", ")", "return", "b\"\"", ".", "join", "(", ...
Generate the `Features String` from an iterable of features. :param features: The features to generate the features string from. :type features: :class:`~collections.abc.Iterable` of :class:`str` :return: The `Features String` :rtype: :class:`bytes` Generate the `Features String` from the given `f...
[ "Generate", "the", "Features", "String", "from", "an", "iterable", "of", "features", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/entitycaps/caps390.py#L33-L50
horazont/aioxmpp
aioxmpp/entitycaps/caps390.py
_process_identities
def _process_identities(identities): """ Generate the `Identities String` from an iterable of identities. :param identities: The identities to generate the features string from. :type identities: :class:`~collections.abc.Iterable` of :class:`~.disco.xso.Identity` :return: The `Identities St...
python
def _process_identities(identities): """ Generate the `Identities String` from an iterable of identities. :param identities: The identities to generate the features string from. :type identities: :class:`~collections.abc.Iterable` of :class:`~.disco.xso.Identity` :return: The `Identities St...
[ "def", "_process_identities", "(", "identities", ")", ":", "parts", "=", "[", "_process_identity", "(", "identity", ")", "for", "identity", "in", "identities", "]", "parts", ".", "sort", "(", ")", "return", "b\"\"", ".", "join", "(", "parts", ")", "+", "...
Generate the `Identities String` from an iterable of identities. :param identities: The identities to generate the features string from. :type identities: :class:`~collections.abc.Iterable` of :class:`~.disco.xso.Identity` :return: The `Identities String` :rtype: :class:`bytes` Generate th...
[ "Generate", "the", "Identities", "String", "from", "an", "iterable", "of", "identities", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/entitycaps/caps390.py#L62-L80
horazont/aioxmpp
aioxmpp/entitycaps/caps390.py
_process_extensions
def _process_extensions(exts): """ Generate the `Extensions String` from an iterable of data forms. :param exts: The data forms to generate the extensions string from. :type exts: :class:`~collections.abc.Iterable` of :class:`~.forms.xso.Data` :return: The `Extensions String` :rtype: :c...
python
def _process_extensions(exts): """ Generate the `Extensions String` from an iterable of data forms. :param exts: The data forms to generate the extensions string from. :type exts: :class:`~collections.abc.Iterable` of :class:`~.forms.xso.Data` :return: The `Extensions String` :rtype: :c...
[ "def", "_process_extensions", "(", "exts", ")", ":", "parts", "=", "[", "_process_form", "(", "form", ")", "for", "form", "in", "exts", "]", "parts", ".", "sort", "(", ")", "return", "b\"\"", ".", "join", "(", "parts", ")", "+", "b\"\\x1c\"" ]
Generate the `Extensions String` from an iterable of data forms. :param exts: The data forms to generate the extensions string from. :type exts: :class:`~collections.abc.Iterable` of :class:`~.forms.xso.Data` :return: The `Extensions String` :rtype: :class:`bytes` Generate the `Extensions ...
[ "Generate", "the", "Extensions", "String", "from", "an", "iterable", "of", "data", "forms", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/entitycaps/caps390.py#L103-L121
horazont/aioxmpp
aioxmpp/xso/query.py
EvaluationContext.set_toplevel_object
def set_toplevel_object(self, instance, class_=None): """ Set the toplevel object to return from :meth:`get_toplevel_object` when asked for `class_` to `instance`. If `class_` is :data:`None`, the :func:`type` of the `instance` is used. """ if class_ is None: ...
python
def set_toplevel_object(self, instance, class_=None): """ Set the toplevel object to return from :meth:`get_toplevel_object` when asked for `class_` to `instance`. If `class_` is :data:`None`, the :func:`type` of the `instance` is used. """ if class_ is None: ...
[ "def", "set_toplevel_object", "(", "self", ",", "instance", ",", "class_", "=", "None", ")", ":", "if", "class_", "is", "None", ":", "class_", "=", "type", "(", "instance", ")", "self", ".", "_toplevels", "[", "class_", "]", "=", "instance" ]
Set the toplevel object to return from :meth:`get_toplevel_object` when asked for `class_` to `instance`. If `class_` is :data:`None`, the :func:`type` of the `instance` is used.
[ "Set", "the", "toplevel", "object", "to", "return", "from", ":", "meth", ":", "get_toplevel_object", "when", "asked", "for", "class_", "to", "instance", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/query.py#L148-L158
horazont/aioxmpp
aioxmpp/xso/query.py
EvaluationContext.eval_bool
def eval_bool(self, expr): """ Evaluate the expression `expr` and return the truthness of its result. A result of an expression is said to be true if it contains at least one value. It has the same semantics as :func:`bool` on sequences.s """ result = expr.eval(self) ...
python
def eval_bool(self, expr): """ Evaluate the expression `expr` and return the truthness of its result. A result of an expression is said to be true if it contains at least one value. It has the same semantics as :func:`bool` on sequences.s """ result = expr.eval(self) ...
[ "def", "eval_bool", "(", "self", ",", "expr", ")", ":", "result", "=", "expr", ".", "eval", "(", "self", ")", "iterator", "=", "iter", "(", "result", ")", "try", ":", "next", "(", "iterator", ")", "except", "StopIteration", ":", "return", "False", "e...
Evaluate the expression `expr` and return the truthness of its result. A result of an expression is said to be true if it contains at least one value. It has the same semantics as :func:`bool` on sequences.s
[ "Evaluate", "the", "expression", "expr", "and", "return", "the", "truthness", "of", "its", "result", ".", "A", "result", "of", "an", "expression", "is", "said", "to", "be", "true", "if", "it", "contains", "at", "least", "one", "value", ".", "It", "has", ...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/query.py#L168-L184
horazont/aioxmpp
aioxmpp/statemachine.py
OrderedStateMachine.rewind
def rewind(self, new_state): """ Rewind can be used as an exceptional way to roll back the state of a :class:`OrderedStateMachine`. Rewinding is not the usual use case for an :class:`OrderedStateMachine`. Usually, if the current state `A` is greater than any given state ...
python
def rewind(self, new_state): """ Rewind can be used as an exceptional way to roll back the state of a :class:`OrderedStateMachine`. Rewinding is not the usual use case for an :class:`OrderedStateMachine`. Usually, if the current state `A` is greater than any given state ...
[ "def", "rewind", "(", "self", ",", "new_state", ")", ":", "if", "new_state", ">", "self", ".", "_state", ":", "raise", "ValueError", "(", "\"cannot forward using rewind \"", "\"({} > {})\"", ".", "format", "(", "new_state", ",", "self", ".", "_state", ")", "...
Rewind can be used as an exceptional way to roll back the state of a :class:`OrderedStateMachine`. Rewinding is not the usual use case for an :class:`OrderedStateMachine`. Usually, if the current state `A` is greater than any given state `B`, it is assumed that state `B` cannot ...
[ "Rewind", "can", "be", "used", "as", "an", "exceptional", "way", "to", "roll", "back", "the", "state", "of", "a", ":", "class", ":", "OrderedStateMachine", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/statemachine.py#L131-L149
horazont/aioxmpp
aioxmpp/statemachine.py
OrderedStateMachine.wait_for
def wait_for(self, new_state): """ Wait for an exact state `new_state` to be reached by the state machine. If the state is skipped, that is, if a state which is greater than `new_state` is written to :attr:`state`, the coroutine raises :class:`OrderedStateSkipped` except...
python
def wait_for(self, new_state): """ Wait for an exact state `new_state` to be reached by the state machine. If the state is skipped, that is, if a state which is greater than `new_state` is written to :attr:`state`, the coroutine raises :class:`OrderedStateSkipped` except...
[ "def", "wait_for", "(", "self", ",", "new_state", ")", ":", "if", "self", ".", "_state", "==", "new_state", ":", "return", "if", "self", ".", "_state", ">", "new_state", ":", "raise", "OrderedStateSkipped", "(", "new_state", ")", "fut", "=", "asyncio", "...
Wait for an exact state `new_state` to be reached by the state machine. If the state is skipped, that is, if a state which is greater than `new_state` is written to :attr:`state`, the coroutine raises :class:`OrderedStateSkipped` exception as it is not possible anymore that it c...
[ "Wait", "for", "an", "exact", "state", "new_state", "to", "be", "reached", "by", "the", "state", "machine", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/statemachine.py#L152-L170
horazont/aioxmpp
aioxmpp/statemachine.py
OrderedStateMachine.wait_for_at_least
def wait_for_at_least(self, new_state): """ Wait for a state to be entered which is greater than or equal to `new_state` and return. """ if not (self._state < new_state): return fut = asyncio.Future(loop=self.loop) self._least_waiters.append((new_stat...
python
def wait_for_at_least(self, new_state): """ Wait for a state to be entered which is greater than or equal to `new_state` and return. """ if not (self._state < new_state): return fut = asyncio.Future(loop=self.loop) self._least_waiters.append((new_stat...
[ "def", "wait_for_at_least", "(", "self", ",", "new_state", ")", ":", "if", "not", "(", "self", ".", "_state", "<", "new_state", ")", ":", "return", "fut", "=", "asyncio", ".", "Future", "(", "loop", "=", "self", ".", "loop", ")", "self", ".", "_least...
Wait for a state to be entered which is greater than or equal to `new_state` and return.
[ "Wait", "for", "a", "state", "to", "be", "entered", "which", "is", "greater", "than", "or", "equal", "to", "new_state", "and", "return", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/statemachine.py#L173-L183
horazont/aioxmpp
aioxmpp/pubsub/xso.py
as_payload_class
def as_payload_class(cls): """ Register the given class `cls` as Publish-Subscribe payload on both :class:`Item` and :class:`EventItem`. Return the class, to allow this to be used as decorator. """ Item.register_child( Item.registered_payload, cls, ) EventItem.register...
python
def as_payload_class(cls): """ Register the given class `cls` as Publish-Subscribe payload on both :class:`Item` and :class:`EventItem`. Return the class, to allow this to be used as decorator. """ Item.register_child( Item.registered_payload, cls, ) EventItem.register...
[ "def", "as_payload_class", "(", "cls", ")", ":", "Item", ".", "register_child", "(", "Item", ".", "registered_payload", ",", "cls", ",", ")", "EventItem", ".", "register_child", "(", "EventItem", ".", "registered_payload", ",", "cls", ",", ")", "return", "cl...
Register the given class `cls` as Publish-Subscribe payload on both :class:`Item` and :class:`EventItem`. Return the class, to allow this to be used as decorator.
[ "Register", "the", "given", "class", "cls", "as", "Publish", "-", "Subscribe", "payload", "on", "both", ":", "class", ":", "Item", "and", ":", "class", ":", "EventItem", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/pubsub/xso.py#L912-L930
horazont/aioxmpp
aioxmpp/presence/service.py
PresenceClient.get_most_available_stanza
def get_most_available_stanza(self, peer_jid): """ Obtain the stanza describing the most-available presence of the contact. :param peer_jid: Bare JID of the contact. :type peer_jid: :class:`aioxmpp.JID` :rtype: :class:`aioxmpp.Presence` or :data:`None` :return: T...
python
def get_most_available_stanza(self, peer_jid): """ Obtain the stanza describing the most-available presence of the contact. :param peer_jid: Bare JID of the contact. :type peer_jid: :class:`aioxmpp.JID` :rtype: :class:`aioxmpp.Presence` or :data:`None` :return: T...
[ "def", "get_most_available_stanza", "(", "self", ",", "peer_jid", ")", ":", "presences", "=", "sorted", "(", "self", ".", "get_peer_resources", "(", "peer_jid", ")", ".", "items", "(", ")", ",", "key", "=", "lambda", "item", ":", "aioxmpp", ".", "structs",...
Obtain the stanza describing the most-available presence of the contact. :param peer_jid: Bare JID of the contact. :type peer_jid: :class:`aioxmpp.JID` :rtype: :class:`aioxmpp.Presence` or :data:`None` :return: The presence stanza of the most available resource or ...
[ "Obtain", "the", "stanza", "describing", "the", "most", "-", "available", "presence", "of", "the", "contact", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L123-L146
horazont/aioxmpp
aioxmpp/presence/service.py
PresenceClient.get_peer_resources
def get_peer_resources(self, peer_jid): """ Return a dict mapping resources of the given bare `peer_jid` to the presence state last received for that resource. Unavailable presence states are not included. If the bare JID is in a error state (i.e. an error presence stanza has be...
python
def get_peer_resources(self, peer_jid): """ Return a dict mapping resources of the given bare `peer_jid` to the presence state last received for that resource. Unavailable presence states are not included. If the bare JID is in a error state (i.e. an error presence stanza has be...
[ "def", "get_peer_resources", "(", "self", ",", "peer_jid", ")", ":", "try", ":", "d", "=", "dict", "(", "self", ".", "_presences", "[", "peer_jid", "]", ")", "d", ".", "pop", "(", "None", ",", "None", ")", "return", "d", "except", "KeyError", ":", ...
Return a dict mapping resources of the given bare `peer_jid` to the presence state last received for that resource. Unavailable presence states are not included. If the bare JID is in a error state (i.e. an error presence stanza has been received), the returned mapping is empty.
[ "Return", "a", "dict", "mapping", "resources", "of", "the", "given", "bare", "peer_jid", "to", "the", "presence", "state", "last", "received", "for", "that", "resource", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L148-L162
horazont/aioxmpp
aioxmpp/presence/service.py
PresenceClient.get_stanza
def get_stanza(self, peer_jid): """ Return the last presence recieved for the given bare or full `peer_jid`. If the last presence was unavailable, the return value is :data:`None`, as if no presence was ever received. If no presence was ever received for the given bare JID, :dat...
python
def get_stanza(self, peer_jid): """ Return the last presence recieved for the given bare or full `peer_jid`. If the last presence was unavailable, the return value is :data:`None`, as if no presence was ever received. If no presence was ever received for the given bare JID, :dat...
[ "def", "get_stanza", "(", "self", ",", "peer_jid", ")", ":", "try", ":", "return", "self", ".", "_presences", "[", "peer_jid", ".", "bare", "(", ")", "]", "[", "peer_jid", ".", "resource", "]", "except", "KeyError", ":", "pass", "try", ":", "return", ...
Return the last presence recieved for the given bare or full `peer_jid`. If the last presence was unavailable, the return value is :data:`None`, as if no presence was ever received. If no presence was ever received for the given bare JID, :data:`None` is returned.
[ "Return", "the", "last", "presence", "recieved", "for", "the", "given", "bare", "or", "full", "peer_jid", ".", "If", "the", "last", "presence", "was", "unavailable", "the", "return", "value", "is", ":", "data", ":", "None", "as", "if", "no", "presence", ...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L164-L180
horazont/aioxmpp
aioxmpp/presence/service.py
PresenceServer.make_stanza
def make_stanza(self): """ Create and return a presence stanza with the current settings. :return: Presence stanza :rtype: :class:`aioxmpp.Presence` """ stanza = aioxmpp.Presence() self._state.apply_to_stanza(stanza) stanza.status.update(self._status) ...
python
def make_stanza(self): """ Create and return a presence stanza with the current settings. :return: Presence stanza :rtype: :class:`aioxmpp.Presence` """ stanza = aioxmpp.Presence() self._state.apply_to_stanza(stanza) stanza.status.update(self._status) ...
[ "def", "make_stanza", "(", "self", ")", ":", "stanza", "=", "aioxmpp", ".", "Presence", "(", ")", "self", ".", "_state", ".", "apply_to_stanza", "(", "stanza", ")", "stanza", ".", "status", ".", "update", "(", "self", ".", "_status", ")", "return", "st...
Create and return a presence stanza with the current settings. :return: Presence stanza :rtype: :class:`aioxmpp.Presence`
[ "Create", "and", "return", "a", "presence", "stanza", "with", "the", "current", "settings", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L344-L354
horazont/aioxmpp
aioxmpp/presence/service.py
PresenceServer.set_presence
def set_presence(self, state, status={}, priority=0): """ Change the presence broadcast by the client. :param state: New presence state to broadcast :type state: :class:`aioxmpp.PresenceState` :param status: New status information to broadcast :type status: :class:`dict`...
python
def set_presence(self, state, status={}, priority=0): """ Change the presence broadcast by the client. :param state: New presence state to broadcast :type state: :class:`aioxmpp.PresenceState` :param status: New status information to broadcast :type status: :class:`dict`...
[ "def", "set_presence", "(", "self", ",", "state", ",", "status", "=", "{", "}", ",", "priority", "=", "0", ")", ":", "if", "not", "isinstance", "(", "priority", ",", "numbers", ".", "Integral", ")", ":", "raise", "TypeError", "(", "\"invalid priority: go...
Change the presence broadcast by the client. :param state: New presence state to broadcast :type state: :class:`aioxmpp.PresenceState` :param status: New status information to broadcast :type status: :class:`dict` or :class:`str` :param priority: New priority for the resource ...
[ "Change", "the", "presence", "broadcast", "by", "the", "client", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L356-L417
horazont/aioxmpp
aioxmpp/presence/service.py
PresenceServer.resend_presence
def resend_presence(self): """ Re-send the currently configured presence. :return: Stanza token of the presence stanza or :data:`None` if the stream is not established. :rtype: :class:`~.stream.StanzaToken` .. note:: :meth:`set_presence` automatical...
python
def resend_presence(self): """ Re-send the currently configured presence. :return: Stanza token of the presence stanza or :data:`None` if the stream is not established. :rtype: :class:`~.stream.StanzaToken` .. note:: :meth:`set_presence` automatical...
[ "def", "resend_presence", "(", "self", ")", ":", "if", "self", ".", "client", ".", "established", ":", "return", "self", ".", "client", ".", "enqueue", "(", "self", ".", "make_stanza", "(", ")", ")" ]
Re-send the currently configured presence. :return: Stanza token of the presence stanza or :data:`None` if the stream is not established. :rtype: :class:`~.stream.StanzaToken` .. note:: :meth:`set_presence` automatically broadcasts the new presence if an...
[ "Re", "-", "send", "the", "currently", "configured", "presence", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/presence/service.py#L419-L434
horazont/aioxmpp
aioxmpp/security_layer.py
extract_python_dict_from_x509
def extract_python_dict_from_x509(x509): """ Extract a python dictionary similar to the return value of :meth:`ssl.SSLSocket.getpeercert` from the given :class:`OpenSSL.crypto.X509` `x509` object. Note that by far not all attributes are included; only those required to use :func:`ssl.match_host...
python
def extract_python_dict_from_x509(x509): """ Extract a python dictionary similar to the return value of :meth:`ssl.SSLSocket.getpeercert` from the given :class:`OpenSSL.crypto.X509` `x509` object. Note that by far not all attributes are included; only those required to use :func:`ssl.match_host...
[ "def", "extract_python_dict_from_x509", "(", "x509", ")", ":", "result", "=", "{", "\"subject\"", ":", "(", "(", "(", "\"commonName\"", ",", "x509", ".", "get_subject", "(", ")", ".", "commonName", ")", ",", ")", ",", ")", "}", "for", "ext_idx", "in", ...
Extract a python dictionary similar to the return value of :meth:`ssl.SSLSocket.getpeercert` from the given :class:`OpenSSL.crypto.X509` `x509` object. Note that by far not all attributes are included; only those required to use :func:`ssl.match_hostname` are extracted and put in the result. In th...
[ "Extract", "a", "python", "dictionary", "similar", "to", "the", "return", "value", "of", ":", "meth", ":", "ssl", ".", "SSLSocket", ".", "getpeercert", "from", "the", "given", ":", "class", ":", "OpenSSL", ".", "crypto", ".", "X509", "x509", "object", "....
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L140-L178
horazont/aioxmpp
aioxmpp/security_layer.py
blob_to_pyasn1
def blob_to_pyasn1(blob): """ Convert an ASN.1 encoded certificate (such as obtained from :func:`extract_blob`) to a :mod:`pyasn1` structure and return the result. """ return pyasn1.codec.der.decoder.decode( blob, asn1Spec=pyasn1_modules.rfc2459.Certificate() )[0]
python
def blob_to_pyasn1(blob): """ Convert an ASN.1 encoded certificate (such as obtained from :func:`extract_blob`) to a :mod:`pyasn1` structure and return the result. """ return pyasn1.codec.der.decoder.decode( blob, asn1Spec=pyasn1_modules.rfc2459.Certificate() )[0]
[ "def", "blob_to_pyasn1", "(", "blob", ")", ":", "return", "pyasn1", ".", "codec", ".", "der", ".", "decoder", ".", "decode", "(", "blob", ",", "asn1Spec", "=", "pyasn1_modules", ".", "rfc2459", ".", "Certificate", "(", ")", ")", "[", "0", "]" ]
Convert an ASN.1 encoded certificate (such as obtained from :func:`extract_blob`) to a :mod:`pyasn1` structure and return the result.
[ "Convert", "an", "ASN", ".", "1", "encoded", "certificate", "(", "such", "as", "obtained", "from", ":", "func", ":", "extract_blob", ")", "to", "a", ":", "mod", ":", "pyasn1", "structure", "and", "return", "the", "result", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L192-L201
horazont/aioxmpp
aioxmpp/security_layer.py
extract_pk_blob_from_pyasn1
def extract_pk_blob_from_pyasn1(pyasn1_struct): """ Extract an ASN.1 encoded public key blob from the given :mod:`pyasn1` structure (which must represent a certificate). """ pk = pyasn1_struct.getComponentByName( "tbsCertificate" ).getComponentByName( "subjectPublicKeyInfo" ...
python
def extract_pk_blob_from_pyasn1(pyasn1_struct): """ Extract an ASN.1 encoded public key blob from the given :mod:`pyasn1` structure (which must represent a certificate). """ pk = pyasn1_struct.getComponentByName( "tbsCertificate" ).getComponentByName( "subjectPublicKeyInfo" ...
[ "def", "extract_pk_blob_from_pyasn1", "(", "pyasn1_struct", ")", ":", "pk", "=", "pyasn1_struct", ".", "getComponentByName", "(", "\"tbsCertificate\"", ")", ".", "getComponentByName", "(", "\"subjectPublicKeyInfo\"", ")", "return", "pyasn1", ".", "codec", ".", "der", ...
Extract an ASN.1 encoded public key blob from the given :mod:`pyasn1` structure (which must represent a certificate).
[ "Extract", "an", "ASN", ".", "1", "encoded", "public", "key", "blob", "from", "the", "given", ":", "mod", ":", "pyasn1", "structure", "(", "which", "must", "represent", "a", "certificate", ")", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L204-L216
horazont/aioxmpp
aioxmpp/security_layer.py
check_x509_hostname
def check_x509_hostname(x509, hostname): """ Check whether the given :class:`OpenSSL.crypto.X509` certificate `x509` matches the given `hostname`. Return :data:`True` if the name matches and :data:`False` otherwise. This uses :func:`ssl.match_hostname` and :func:`extract_python_dict_from_x509`. ...
python
def check_x509_hostname(x509, hostname): """ Check whether the given :class:`OpenSSL.crypto.X509` certificate `x509` matches the given `hostname`. Return :data:`True` if the name matches and :data:`False` otherwise. This uses :func:`ssl.match_hostname` and :func:`extract_python_dict_from_x509`. ...
[ "def", "check_x509_hostname", "(", "x509", ",", "hostname", ")", ":", "cert_structure", "=", "extract_python_dict_from_x509", "(", "x509", ")", "try", ":", "ssl", ".", "match_hostname", "(", "cert_structure", ",", "hostname", ")", "except", "ssl", ".", "Certific...
Check whether the given :class:`OpenSSL.crypto.X509` certificate `x509` matches the given `hostname`. Return :data:`True` if the name matches and :data:`False` otherwise. This uses :func:`ssl.match_hostname` and :func:`extract_python_dict_from_x509`.
[ "Check", "whether", "the", "given", ":", "class", ":", "OpenSSL", ".", "crypto", ".", "X509", "certificate", "x509", "matches", "the", "given", "hostname", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L219-L233
horazont/aioxmpp
aioxmpp/security_layer.py
default_ssl_context
def default_ssl_context(): """ Return a sensibly configured :class:`OpenSSL.SSL.Context` context. The context has SSLv2 and SSLv3 disabled, and supports TLS 1.0+ (depending on the version of the SSL library). Tries to negotiate an XMPP c2s connection via ALPN (:rfc:`7301`). """ ctx = Open...
python
def default_ssl_context(): """ Return a sensibly configured :class:`OpenSSL.SSL.Context` context. The context has SSLv2 and SSLv3 disabled, and supports TLS 1.0+ (depending on the version of the SSL library). Tries to negotiate an XMPP c2s connection via ALPN (:rfc:`7301`). """ ctx = Open...
[ "def", "default_ssl_context", "(", ")", ":", "ctx", "=", "OpenSSL", ".", "SSL", ".", "Context", "(", "OpenSSL", ".", "SSL", ".", "SSLv23_METHOD", ")", "ctx", ".", "set_options", "(", "OpenSSL", ".", "SSL", ".", "OP_NO_SSLv2", "|", "OpenSSL", ".", "SSL", ...
Return a sensibly configured :class:`OpenSSL.SSL.Context` context. The context has SSLv2 and SSLv3 disabled, and supports TLS 1.0+ (depending on the version of the SSL library). Tries to negotiate an XMPP c2s connection via ALPN (:rfc:`7301`).
[ "Return", "a", "sensibly", "configured", ":", "class", ":", "OpenSSL", ".", "SSL", ".", "Context", "context", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L1125-L1138
horazont/aioxmpp
aioxmpp/security_layer.py
negotiate_sasl
def negotiate_sasl(transport, xmlstream, sasl_providers, negotiation_timeout, jid, features): """ Perform SASL authentication on the given :class:`.protocol.XMLStream` `stream`. `transport` must be the :class:`asyncio.Transport` over which the `st...
python
def negotiate_sasl(transport, xmlstream, sasl_providers, negotiation_timeout, jid, features): """ Perform SASL authentication on the given :class:`.protocol.XMLStream` `stream`. `transport` must be the :class:`asyncio.Transport` over which the `st...
[ "def", "negotiate_sasl", "(", "transport", ",", "xmlstream", ",", "sasl_providers", ",", "negotiation_timeout", ",", "jid", ",", "features", ")", ":", "if", "not", "transport", ".", "get_extra_info", "(", "\"sslcontext\"", ")", ":", "transport", "=", "None", "...
Perform SASL authentication on the given :class:`.protocol.XMLStream` `stream`. `transport` must be the :class:`asyncio.Transport` over which the `stream` runs. It is used to detect whether TLS is used and may be required by some SASL mechanisms. `sasl_providers` must be an iterable of :class:`SASLProv...
[ "Perform", "SASL", "authentication", "on", "the", "given", ":", "class", ":", ".", "protocol", ".", "XMLStream", "stream", ".", "transport", "must", "be", "the", ":", "class", ":", "asyncio", ".", "Transport", "over", "which", "the", "stream", "runs", ".",...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L1142-L1204
horazont/aioxmpp
aioxmpp/security_layer.py
security_layer
def security_layer(tls_provider, sasl_providers): """ .. deprecated:: 0.6 Replaced by :class:`SecurityLayer`. Return a configured :class:`SecurityLayer`. `tls_provider` must be a :class:`STARTTLSProvider`. The return value can be passed to the constructor of :class:`~.node.Client`. ...
python
def security_layer(tls_provider, sasl_providers): """ .. deprecated:: 0.6 Replaced by :class:`SecurityLayer`. Return a configured :class:`SecurityLayer`. `tls_provider` must be a :class:`STARTTLSProvider`. The return value can be passed to the constructor of :class:`~.node.Client`. ...
[ "def", "security_layer", "(", "tls_provider", ",", "sasl_providers", ")", ":", "sasl_providers", "=", "tuple", "(", "sasl_providers", ")", "if", "not", "sasl_providers", ":", "raise", "ValueError", "(", "\"At least one SASL provider must be given.\"", ")", "for", "sas...
.. deprecated:: 0.6 Replaced by :class:`SecurityLayer`. Return a configured :class:`SecurityLayer`. `tls_provider` must be a :class:`STARTTLSProvider`. The return value can be passed to the constructor of :class:`~.node.Client`. Some very basic checking on the input is also performed.
[ "..", "deprecated", "::", "0", ".", "6" ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L1224-L1253
horazont/aioxmpp
aioxmpp/security_layer.py
tls_with_password_based_authentication
def tls_with_password_based_authentication( password_provider, ssl_context_factory=default_ssl_context, max_auth_attempts=3, certificate_verifier_factory=PKIXCertificateVerifier): """ Produce a commonly used :class:`SecurityLayer`, which uses TLS and password-based SASL authe...
python
def tls_with_password_based_authentication( password_provider, ssl_context_factory=default_ssl_context, max_auth_attempts=3, certificate_verifier_factory=PKIXCertificateVerifier): """ Produce a commonly used :class:`SecurityLayer`, which uses TLS and password-based SASL authe...
[ "def", "tls_with_password_based_authentication", "(", "password_provider", ",", "ssl_context_factory", "=", "default_ssl_context", ",", "max_auth_attempts", "=", "3", ",", "certificate_verifier_factory", "=", "PKIXCertificateVerifier", ")", ":", "tls_kwargs", "=", "{", "}",...
Produce a commonly used :class:`SecurityLayer`, which uses TLS and password-based SASL authentication. If `ssl_context_factory` is not provided, an SSL context with TLSv1+ is used. `password_provider` must be a coroutine which is called with the jid as first and the number of attempt as second argument...
[ "Produce", "a", "commonly", "used", ":", "class", ":", "SecurityLayer", "which", "uses", "TLS", "and", "password", "-", "based", "SASL", "authentication", ".", "If", "ssl_context_factory", "is", "not", "provided", "an", "SSL", "context", "with", "TLSv1", "+", ...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L1256-L1291
horazont/aioxmpp
aioxmpp/security_layer.py
make
def make( password_provider, *, pin_store=None, pin_type=PinType.PUBLIC_KEY, post_handshake_deferred_failure=None, anonymous=False, ssl_context_factory=default_ssl_context, no_verify=False): """ Construct a :class:`SecurityLayer`. Depending on the ...
python
def make( password_provider, *, pin_store=None, pin_type=PinType.PUBLIC_KEY, post_handshake_deferred_failure=None, anonymous=False, ssl_context_factory=default_ssl_context, no_verify=False): """ Construct a :class:`SecurityLayer`. Depending on the ...
[ "def", "make", "(", "password_provider", ",", "*", ",", "pin_store", "=", "None", ",", "pin_type", "=", "PinType", ".", "PUBLIC_KEY", ",", "post_handshake_deferred_failure", "=", "None", ",", "anonymous", "=", "False", ",", "ssl_context_factory", "=", "default_s...
Construct a :class:`SecurityLayer`. Depending on the arguments passed, different features are enabled or disabled. .. warning:: When using any argument except `password_provider`, be sure to read its documentation below the following overview **carefully**. Many arguments can be used t...
[ "Construct", "a", ":", "class", ":", "SecurityLayer", ".", "Depending", "on", "the", "arguments", "passed", "different", "features", "are", "enabled", "or", "disabled", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L1313-L1520
horazont/aioxmpp
aioxmpp/security_layer.py
AbstractPinStore.pin
def pin(self, hostname, x509): """ Pin an :class:`OpenSSL.crypto.X509` object `x509` for use with the given `hostname`. Which information exactly is used to identify the certificate depends :meth:`_x509_key`. """ key = self._x509_key(x509) self._storage.setdefaul...
python
def pin(self, hostname, x509): """ Pin an :class:`OpenSSL.crypto.X509` object `x509` for use with the given `hostname`. Which information exactly is used to identify the certificate depends :meth:`_x509_key`. """ key = self._x509_key(x509) self._storage.setdefaul...
[ "def", "pin", "(", "self", ",", "hostname", ",", "x509", ")", ":", "key", "=", "self", ".", "_x509_key", "(", "x509", ")", "self", ".", "_storage", ".", "setdefault", "(", "hostname", ",", "set", "(", ")", ")", ".", "add", "(", "key", ")" ]
Pin an :class:`OpenSSL.crypto.X509` object `x509` for use with the given `hostname`. Which information exactly is used to identify the certificate depends :meth:`_x509_key`.
[ "Pin", "an", ":", "class", ":", "OpenSSL", ".", "crypto", ".", "X509", "object", "x509", "for", "use", "with", "the", "given", "hostname", ".", "Which", "information", "exactly", "is", "used", "to", "identify", "the", "certificate", "depends", ":", "meth",...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L541-L549
horazont/aioxmpp
aioxmpp/security_layer.py
AbstractPinStore.query
def query(self, hostname, x509): """ Return true if the given :class:`OpenSSL.crypto.X509` object `x509` has previously been pinned for use with the given `hostname` and :data:`None` otherwise. Returning :data:`None` allows this method to be used with :class:`PinningPKIX...
python
def query(self, hostname, x509): """ Return true if the given :class:`OpenSSL.crypto.X509` object `x509` has previously been pinned for use with the given `hostname` and :data:`None` otherwise. Returning :data:`None` allows this method to be used with :class:`PinningPKIX...
[ "def", "query", "(", "self", ",", "hostname", ",", "x509", ")", ":", "key", "=", "self", ".", "_x509_key", "(", "x509", ")", "try", ":", "pins", "=", "self", ".", "_storage", "[", "hostname", "]", "except", "KeyError", ":", "return", "None", "if", ...
Return true if the given :class:`OpenSSL.crypto.X509` object `x509` has previously been pinned for use with the given `hostname` and :data:`None` otherwise. Returning :data:`None` allows this method to be used with :class:`PinningPKIXCertificateVerifier`.
[ "Return", "true", "if", "the", "given", ":", "class", ":", "OpenSSL", ".", "crypto", ".", "X509", "object", "x509", "has", "previously", "been", "pinned", "for", "use", "with", "the", "given", "hostname", "and", ":", "data", ":", "None", "otherwise", "."...
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L551-L570
horazont/aioxmpp
aioxmpp/security_layer.py
AbstractPinStore.export_to_json
def export_to_json(self): """ Return a JSON dictionary which contains all the pins stored in this store. """ return { hostname: sorted(self._encode_key(key) for key in pins) for hostname, pins in self._storage.items() }
python
def export_to_json(self): """ Return a JSON dictionary which contains all the pins stored in this store. """ return { hostname: sorted(self._encode_key(key) for key in pins) for hostname, pins in self._storage.items() }
[ "def", "export_to_json", "(", "self", ")", ":", "return", "{", "hostname", ":", "sorted", "(", "self", ".", "_encode_key", "(", "key", ")", "for", "key", "in", "pins", ")", "for", "hostname", ",", "pins", "in", "self", ".", "_storage", ".", "items", ...
Return a JSON dictionary which contains all the pins stored in this store.
[ "Return", "a", "JSON", "dictionary", "which", "contains", "all", "the", "pins", "stored", "in", "this", "store", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L584-L593
horazont/aioxmpp
aioxmpp/security_layer.py
AbstractPinStore.import_from_json
def import_from_json(self, data, *, override=False): """ Import a JSON dictionary which must have the same format as exported by :meth:`export`. If *override* is true, the existing data in the pin store will be overriden with the data from `data`. Otherwise, the `data` will be ...
python
def import_from_json(self, data, *, override=False): """ Import a JSON dictionary which must have the same format as exported by :meth:`export`. If *override* is true, the existing data in the pin store will be overriden with the data from `data`. Otherwise, the `data` will be ...
[ "def", "import_from_json", "(", "self", ",", "data", ",", "*", ",", "override", "=", "False", ")", ":", "if", "override", ":", "self", ".", "_storage", "=", "{", "hostname", ":", "set", "(", "self", ".", "_decode_key", "(", "key", ")", "for", "key", ...
Import a JSON dictionary which must have the same format as exported by :meth:`export`. If *override* is true, the existing data in the pin store will be overriden with the data from `data`. Otherwise, the `data` will be merged into the store.
[ "Import", "a", "JSON", "dictionary", "which", "must", "have", "the", "same", "format", "as", "exported", "by", ":", "meth", ":", "export", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L595-L614
horazont/aioxmpp
aioxmpp/security_layer.py
SASLProvider._find_supported
def _find_supported(self, features, mechanism_classes): """ Find the first mechansim class which supports a mechanism announced in the given stream features. :param features: Current XMPP stream features :type features: :class:`~.nonza.StreamFeatures` :param mechanism_cl...
python
def _find_supported(self, features, mechanism_classes): """ Find the first mechansim class which supports a mechanism announced in the given stream features. :param features: Current XMPP stream features :type features: :class:`~.nonza.StreamFeatures` :param mechanism_cl...
[ "def", "_find_supported", "(", "self", ",", "features", ",", "mechanism_classes", ")", ":", "try", ":", "mechanisms", "=", "features", "[", "SASLMechanisms", "]", "except", "KeyError", ":", "logger", ".", "error", "(", "\"No sasl mechanisms: %r\"", ",", "list", ...
Find the first mechansim class which supports a mechanism announced in the given stream features. :param features: Current XMPP stream features :type features: :class:`~.nonza.StreamFeatures` :param mechanism_classes: SASL mechanism classes to use :type mechanism_classes: iterab...
[ "Find", "the", "first", "mechansim", "class", "which", "supports", "a", "mechanism", "announced", "in", "the", "given", "stream", "features", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L764-L804
horazont/aioxmpp
aioxmpp/security_layer.py
SASLProvider._execute
def _execute(self, intf, mechanism, token): """ Execute a SASL authentication process. :param intf: SASL interface to use :type intf: :class:`~.sasl.SASLXMPPInterface` :param mechanism: SASL mechanism to use :type mechanism: :class:`aiosasl.SASLMechanism` :param ...
python
def _execute(self, intf, mechanism, token): """ Execute a SASL authentication process. :param intf: SASL interface to use :type intf: :class:`~.sasl.SASLXMPPInterface` :param mechanism: SASL mechanism to use :type mechanism: :class:`aiosasl.SASLMechanism` :param ...
[ "def", "_execute", "(", "self", ",", "intf", ",", "mechanism", ",", "token", ")", ":", "sm", "=", "aiosasl", ".", "SASLStateMachine", "(", "intf", ")", "try", ":", "yield", "from", "mechanism", ".", "authenticate", "(", "sm", ",", "token", ")", "return...
Execute a SASL authentication process. :param intf: SASL interface to use :type intf: :class:`~.sasl.SASLXMPPInterface` :param mechanism: SASL mechanism to use :type mechanism: :class:`aiosasl.SASLMechanism` :param token: The opaque token argument for the mechanism :type...
[ "Execute", "a", "SASL", "authentication", "process", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L821-L856
horazont/aioxmpp
aioxmpp/connector.py
STARTTLSConnector.connect
def connect(self, loop, metadata, domain: str, host, port, negotiation_timeout, base_logger=None): """ .. seealso:: :meth:`BaseConnector.connect` For general information on the :meth:`connect` method. Connect to `host` at TCP port number `port`. The ...
python
def connect(self, loop, metadata, domain: str, host, port, negotiation_timeout, base_logger=None): """ .. seealso:: :meth:`BaseConnector.connect` For general information on the :meth:`connect` method. Connect to `host` at TCP port number `port`. The ...
[ "def", "connect", "(", "self", ",", "loop", ",", "metadata", ",", "domain", ":", "str", ",", "host", ",", "port", ",", "negotiation_timeout", ",", "base_logger", "=", "None", ")", ":", "features_future", "=", "asyncio", ".", "Future", "(", "loop", "=", ...
.. seealso:: :meth:`BaseConnector.connect` For general information on the :meth:`connect` method. Connect to `host` at TCP port number `port`. The :class:`aioxmpp.security_layer.SecurityLayer` object `metadata` is used to determine the parameters of the TLS connection....
[ "..", "seealso", "::" ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/connector.py#L147-L274
horazont/aioxmpp
aioxmpp/connector.py
XMPPOverTLSConnector.connect
def connect(self, loop, metadata, domain, host, port, negotiation_timeout, base_logger=None): """ .. seealso:: :meth:`BaseConnector.connect` For general information on the :meth:`connect` method. Connect to `host` at TCP port number `port`. The ...
python
def connect(self, loop, metadata, domain, host, port, negotiation_timeout, base_logger=None): """ .. seealso:: :meth:`BaseConnector.connect` For general information on the :meth:`connect` method. Connect to `host` at TCP port number `port`. The ...
[ "def", "connect", "(", "self", ",", "loop", ",", "metadata", ",", "domain", ",", "host", ",", "port", ",", "negotiation_timeout", ",", "base_logger", "=", "None", ")", ":", "features_future", "=", "asyncio", ".", "Future", "(", "loop", "=", "loop", ")", ...
.. seealso:: :meth:`BaseConnector.connect` For general information on the :meth:`connect` method. Connect to `host` at TCP port number `port`. The :class:`aioxmpp.security_layer.SecurityLayer` object `metadata` is used to determine the parameters of the TLS connection....
[ "..", "seealso", "::" ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/connector.py#L314-L384
horazont/aioxmpp
aioxmpp/xso/__init__.py
normalize_tag
def normalize_tag(tag): """ Normalize an XML element tree `tag` into the tuple format. The following input formats are accepted: * ElementTree namespaced string, e.g. ``{uri:bar}foo`` * Unnamespaced tags, e.g. ``foo`` * Two-tuples consisting of `namespace_uri` and `localpart`; `namespace_uri` ...
python
def normalize_tag(tag): """ Normalize an XML element tree `tag` into the tuple format. The following input formats are accepted: * ElementTree namespaced string, e.g. ``{uri:bar}foo`` * Unnamespaced tags, e.g. ``foo`` * Two-tuples consisting of `namespace_uri` and `localpart`; `namespace_uri` ...
[ "def", "normalize_tag", "(", "tag", ")", ":", "if", "isinstance", "(", "tag", ",", "str", ")", ":", "namespace_uri", ",", "sep", ",", "localname", "=", "tag", ".", "partition", "(", "\"}\"", ")", "if", "sep", ":", "if", "not", "namespace_uri", ".", "...
Normalize an XML element tree `tag` into the tuple format. The following input formats are accepted: * ElementTree namespaced string, e.g. ``{uri:bar}foo`` * Unnamespaced tags, e.g. ``foo`` * Two-tuples consisting of `namespace_uri` and `localpart`; `namespace_uri` may be :data:`None` if the tag ...
[ "Normalize", "an", "XML", "element", "tree", "tag", "into", "the", "tuple", "format", ".", "The", "following", "input", "formats", "are", "accepted", ":" ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/__init__.py#L463-L493
horazont/aioxmpp
aioxmpp/im/conversation.py
AbstractConversation.send_message
def send_message(self, body): """ Send a message to the conversation. :param msg: The message to send. :type msg: :class:`aioxmpp.Message` :return: The stanza token obtained from sending. :rtype: :class:`~aioxmpp.stream.StanzaToken` The default implementation si...
python
def send_message(self, body): """ Send a message to the conversation. :param msg: The message to send. :type msg: :class:`aioxmpp.Message` :return: The stanza token obtained from sending. :rtype: :class:`~aioxmpp.stream.StanzaToken` The default implementation si...
[ "def", "send_message", "(", "self", ",", "body", ")", ":", "token", ",", "tracker", "=", "self", ".", "send_message_tracked", "(", "body", ")", "tracker", ".", "cancel", "(", ")", "return", "token" ]
Send a message to the conversation. :param msg: The message to send. :type msg: :class:`aioxmpp.Message` :return: The stanza token obtained from sending. :rtype: :class:`~aioxmpp.stream.StanzaToken` The default implementation simply calls :meth:`send_message_tracked` an...
[ "Send", "a", "message", "to", "the", "conversation", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/im/conversation.py#L680-L712
horazont/aioxmpp
aioxmpp/im/conversation.py
AbstractConversation.invite
def invite(self, address, text=None, *, mode=InviteMode.DIRECT, allow_upgrade=False): """ Invite another entity to the conversation. :param address: The address of the entity to invite. :type address: :class:`aioxmpp.JID` :param text: A reason/accom...
python
def invite(self, address, text=None, *, mode=InviteMode.DIRECT, allow_upgrade=False): """ Invite another entity to the conversation. :param address: The address of the entity to invite. :type address: :class:`aioxmpp.JID` :param text: A reason/accom...
[ "def", "invite", "(", "self", ",", "address", ",", "text", "=", "None", ",", "*", ",", "mode", "=", "InviteMode", ".", "DIRECT", ",", "allow_upgrade", "=", "False", ")", ":", "raise", "self", ".", "_not_implemented_error", "(", "\"inviting entities\"", ")"...
Invite another entity to the conversation. :param address: The address of the entity to invite. :type address: :class:`aioxmpp.JID` :param text: A reason/accompanying text for the invitation. :param mode: The invitation mode to use. :type mode: :class:`~.im.InviteMode` :...
[ "Invite", "another", "entity", "to", "the", "conversation", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/im/conversation.py#L809-L873
horazont/aioxmpp
examples/xmpp_bridge.py
stdout_writer
async def stdout_writer(): """ This is a bit complex, as stdout can be a pipe or a file. If it is a file, we cannot use :meth:`asycnio.BaseEventLoop.connect_write_pipe`. """ if sys.stdout.seekable(): # it’s a file return sys.stdout.buffer.raw if os.isatty(sys.stdin.fileno()...
python
async def stdout_writer(): """ This is a bit complex, as stdout can be a pipe or a file. If it is a file, we cannot use :meth:`asycnio.BaseEventLoop.connect_write_pipe`. """ if sys.stdout.seekable(): # it’s a file return sys.stdout.buffer.raw if os.isatty(sys.stdin.fileno()...
[ "async", "def", "stdout_writer", "(", ")", ":", "if", "sys", ".", "stdout", ".", "seekable", "(", ")", ":", "# it’s a file", "return", "sys", ".", "stdout", ".", "buffer", ".", "raw", "if", "os", ".", "isatty", "(", "sys", ".", "stdin", ".", "fileno"...
This is a bit complex, as stdout can be a pipe or a file. If it is a file, we cannot use :meth:`asycnio.BaseEventLoop.connect_write_pipe`.
[ "This", "is", "a", "bit", "complex", "as", "stdout", "can", "be", "a", "pipe", "or", "a", "file", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/examples/xmpp_bridge.py#L32-L61
horazont/aioxmpp
aioxmpp/hashes.py
hash_from_algo
def hash_from_algo(algo): """ Return a :mod:`hashlib` hash given the :xep:`300` `algo`. :param algo: The algorithm identifier as defined in :xep:`300`. :type algo: :class:`str` :raises NotImplementedError: if the hash algortihm is not supported by :mod:`hashlib`. :raises ValueError: if ...
python
def hash_from_algo(algo): """ Return a :mod:`hashlib` hash given the :xep:`300` `algo`. :param algo: The algorithm identifier as defined in :xep:`300`. :type algo: :class:`str` :raises NotImplementedError: if the hash algortihm is not supported by :mod:`hashlib`. :raises ValueError: if ...
[ "def", "hash_from_algo", "(", "algo", ")", ":", "try", ":", "enabled", ",", "(", "fun_name", ",", "fun_args", ",", "fun_kwargs", ")", "=", "_HASH_ALGO_MAP", "[", "algo", "]", "except", "KeyError", ":", "raise", "NotImplementedError", "(", "\"hash algorithm {!r...
Return a :mod:`hashlib` hash given the :xep:`300` `algo`. :param algo: The algorithm identifier as defined in :xep:`300`. :type algo: :class:`str` :raises NotImplementedError: if the hash algortihm is not supported by :mod:`hashlib`. :raises ValueError: if the hash algorithm MUST NOT be support...
[ "Return", "a", ":", "mod", ":", "hashlib", "hash", "given", "the", ":", "xep", ":", "300", "algo", "." ]
train
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/hashes.py#L141-L175