_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q600 | MockRedis._hincrby | train | def _hincrby(self, hashkey, attribute, command, type_, increment):
"""Shared hincrby and hincrbyfloat routine"""
redis_hash = self._get_hash(hashkey, command, create=True)
attribute = self._encode(attribute)
| python | {
"resource": ""
} |
q601 | MockRedis.lrange | train | def lrange(self, key, start, stop):
"""Emulate lrange."""
redis_list = self._get_list(key, 'LRANGE')
| python | {
"resource": ""
} |
q602 | MockRedis.lindex | train | def lindex(self, key, index):
"""Emulate lindex."""
redis_list = self._get_list(key, 'LINDEX')
if self._encode(key) not in self.redis:
return None
try:
| python | {
"resource": ""
} |
q603 | MockRedis._blocking_pop | train | def _blocking_pop(self, pop_func, keys, timeout):
"""Emulate blocking pop functionality"""
if not isinstance(timeout, (int, long)):
raise RuntimeError('timeout is not an integer or out of range')
if timeout is None or timeout == 0:
timeout = self.blocking_timeout
... | python | {
"resource": ""
} |
q604 | MockRedis.lpush | train | def lpush(self, key, *args):
"""Emulate lpush."""
redis_list = self._get_list(key, 'LPUSH', create=True)
# Creates the list at this key if it doesn't exist, and appends args to its beginning
args_reversed = [self._encode(arg) for arg in args]
args_reversed.reverse()
upda... | python | {
"resource": ""
} |
q605 | MockRedis.rpop | train | def rpop(self, key):
"""Emulate lpop."""
redis_list = self._get_list(key, 'RPOP')
if self._encode(key) not in self.redis:
return None
| python | {
"resource": ""
} |
q606 | MockRedis.rpush | train | def rpush(self, key, *args):
"""Emulate rpush."""
redis_list = self._get_list(key, 'RPUSH', create=True)
# Creates the list at this key if it doesn't exist, and appends args to it
| python | {
"resource": ""
} |
q607 | MockRedis.lrem | train | def lrem(self, key, value, count=0):
"""Emulate lrem."""
value = self._encode(value)
redis_list = self._get_list(key, 'LREM')
removed_count = 0
if self._encode(key) in self.redis:
if count == 0:
# Remove all ocurrences
while redis_list.... | python | {
"resource": ""
} |
q608 | MockRedis.ltrim | train | def ltrim(self, key, start, stop):
"""Emulate ltrim."""
redis_list = self._get_list(key, 'LTRIM')
if redis_list:
start, stop = self._translate_range(len(redis_list), start, | python | {
"resource": ""
} |
q609 | MockRedis.lset | train | def lset(self, key, index, value):
"""Emulate lset."""
redis_list = self._get_list(key, 'LSET')
if redis_list is None:
raise ResponseError("no such key")
try:
| python | {
"resource": ""
} |
q610 | MockRedis._common_scan | train | def _common_scan(self, values_function, cursor='0', match=None, count=10, key=None):
"""
Common scanning skeleton.
:param key: optional function used to identify what 'match' is applied to
"""
if count is None:
count = 10
cursor = int(cursor)
count = ... | python | {
"resource": ""
} |
q611 | MockRedis.scan | train | def scan(self, cursor='0', match=None, count=10):
"""Emulate scan."""
def value_function():
return sorted(self.redis.keys()) # sorted list for consistent order
| python | {
"resource": ""
} |
q612 | MockRedis.sscan | train | def sscan(self, name, cursor='0', match=None, count=10):
"""Emulate sscan."""
def value_function():
members = list(self.smembers(name)) | python | {
"resource": ""
} |
q613 | MockRedis.zscan | train | def zscan(self, name, cursor='0', match=None, count=10):
"""Emulate zscan."""
def value_function():
values = self.zrange(name, 0, -1, withscores=True)
values.sort(key=lambda x: x[1]) # sort for consistent order
| python | {
"resource": ""
} |
q614 | MockRedis.hscan | train | def hscan(self, name, cursor='0', match=None, count=10):
"""Emulate hscan."""
def value_function():
values = self.hgetall(name)
values = list(values.items()) # list of tuples for sorting and matching
values.sort(key=lambda x: x[0]) # sort for consistent order
... | python | {
"resource": ""
} |
q615 | MockRedis.hscan_iter | train | def hscan_iter(self, name, match=None, count=10):
"""Emulate hscan_iter."""
cursor = '0'
while cursor != 0:
cursor, data = self.hscan(name, cursor=cursor,
| python | {
"resource": ""
} |
q616 | MockRedis.sadd | train | def sadd(self, key, *values):
"""Emulate sadd."""
if len(values) == 0:
raise ResponseError("wrong number of arguments for 'sadd' command")
| python | {
"resource": ""
} |
q617 | MockRedis.sdiff | train | def sdiff(self, keys, *args):
"""Emulate sdiff."""
func = lambda left, right: left.difference(right)
| python | {
"resource": ""
} |
q618 | MockRedis.sdiffstore | train | def sdiffstore(self, dest, keys, *args):
"""Emulate sdiffstore."""
result = self.sdiff(keys, *args)
| python | {
"resource": ""
} |
q619 | MockRedis.sinter | train | def sinter(self, keys, *args):
"""Emulate sinter."""
func = lambda left, right: left.intersection(right)
| python | {
"resource": ""
} |
q620 | MockRedis.sinterstore | train | def sinterstore(self, dest, keys, *args):
"""Emulate sinterstore."""
result = self.sinter(keys, *args)
| python | {
"resource": ""
} |
q621 | MockRedis.sismember | train | def sismember(self, name, value):
"""Emulate sismember."""
redis_set = self._get_set(name, 'SISMEMBER')
| python | {
"resource": ""
} |
q622 | MockRedis.smove | train | def smove(self, src, dst, value):
"""Emulate smove."""
src_set = self._get_set(src, 'SMOVE')
dst_set = self._get_set(dst, 'SMOVE')
value = self._encode(value)
if value not in src_set:
return False
| python | {
"resource": ""
} |
q623 | MockRedis.spop | train | def spop(self, name):
"""Emulate spop."""
redis_set = self._get_set(name, 'SPOP')
if not redis_set:
| python | {
"resource": ""
} |
q624 | MockRedis.srandmember | train | def srandmember(self, name, number=None):
"""Emulate srandmember."""
redis_set = self._get_set(name, 'SRANDMEMBER')
if not redis_set:
return None if number is None else []
if number is None:
return choice(list(redis_set))
| python | {
"resource": ""
} |
q625 | MockRedis.srem | train | def srem(self, key, *values):
"""Emulate srem."""
redis_set = self._get_set(key, 'SREM')
if not redis_set:
return 0
before_count = len(redis_set)
for value in values:
redis_set.discard(self._encode(value))
after_count | python | {
"resource": ""
} |
q626 | MockRedis.sunion | train | def sunion(self, keys, *args):
"""Emulate sunion."""
func = lambda left, right: left.union(right)
| python | {
"resource": ""
} |
q627 | MockRedis.sunionstore | train | def sunionstore(self, dest, keys, *args):
"""Emulate sunionstore."""
result = self.sunion(keys, *args)
| python | {
"resource": ""
} |
q628 | MockRedis.call | train | def call(self, command, *args):
"""
Sends call to the function, whose name is specified by command.
Used by Script invocations and normalizes calls using standard
Redis arguments to use the | python | {
"resource": ""
} |
q629 | MockRedis._normalize_command_args | train | def _normalize_command_args(self, command, *args):
"""
Modifies the command arguments to match the
strictness of the redis client.
"""
if command == 'zadd' and not self.strict and len(args) >= 3:
# Reorder score and name
zadd_args = [x for tup in zip(args[... | python | {
"resource": ""
} |
q630 | MockRedis.config_get | train | def config_get(self, pattern='*'):
"""
Get one or more configuration parameters.
"""
result = {}
for name, value in self.redis_config.items():
if fnmatch.fnmatch(name, pattern):
try:
| python | {
"resource": ""
} |
q631 | MockRedis._translate_range | train | def _translate_range(self, len_, start, end):
"""
Translate range to valid bounds.
"""
if start < 0:
start += len_
start = max(0, min(start, len_))
| python | {
"resource": ""
} |
q632 | MockRedis._translate_limit | train | def _translate_limit(self, len_, start, num):
"""
Translate limit to valid bounds.
"""
| python | {
"resource": ""
} |
q633 | MockRedis._aggregate_func | train | def _aggregate_func(self, aggregate):
"""
Return a suitable aggregate score function.
"""
funcs = {"sum": add, "min": min, "max": max}
func_name = aggregate.lower() if aggregate else 'sum'
try:
| python | {
"resource": ""
} |
q634 | MockRedis._apply_to_sets | train | def _apply_to_sets(self, func, operation, keys, *args):
"""Helper function for sdiff, sinter, and sunion"""
keys = self._list_or_args(keys, args)
if not keys:
raise TypeError("{} takes at least two arguments".format(operation.lower()))
| python | {
"resource": ""
} |
q635 | MockRedis._list_or_args | train | def _list_or_args(self, keys, args):
"""
Shamelessly copied from redis-py.
"""
# returns a single list combining keys and args
try:
iter(keys)
# a string can be iterated, but indicates
# keys wasn't passed | python | {
"resource": ""
} |
q636 | MockRedis._encode | train | def _encode(self, value):
"Return a bytestring representation of the value. Taken from redis-py connection.py"
if isinstance(value, bytes):
return value
elif isinstance(value, (int, long)):
value = str(value).encode('utf-8')
elif isinstance(value, float):
| python | {
"resource": ""
} |
q637 | MockRedisPipeline.watch | train | def watch(self, *keys):
"""
Put the pipeline into immediate execution mode.
Does not actually watch any keys.
"""
if self.explicit_transaction:
raise RedisError("Cannot issue a WATCH after a MULTI")
self.watching = True
| python | {
"resource": ""
} |
q638 | MockRedisPipeline.execute | train | def execute(self):
"""
Execute all of the saved commands and return results.
"""
try:
for key, value in self._watched_keys.items():
if self.mock_redis.redis.get(self.mock_redis._encode(key)) != value:
| python | {
"resource": ""
} |
q639 | MockRedisPipeline._reset | train | def _reset(self):
"""
Reset instance variables.
"""
self.commands = []
self.watching = False
| python | {
"resource": ""
} |
q640 | Language.convert_to_duckling_language_id | train | def convert_to_duckling_language_id(cls, lang):
"""Ensure a language identifier has the correct duckling format and is supported."""
if lang is not None and cls.is_supported(lang):
return lang
elif lang is not None and cls.is_supported(lang + "$core"): # Support ISO 639-1 Language... | python | {
"resource": ""
} |
q641 | Duckling.load | train | def load(self, languages=[]):
"""Loads the Duckling corpus.
Languages can be specified, defaults to all.
Args:
languages: Optional parameter to specify languages,
e.g. [Duckling.ENGLISH, Duckling.FRENCH] or supported ISO 639-1 Codes (e.g. ["en", "fr"])
"""
... | python | {
"resource": ""
} |
q642 | DucklingWrapper.parse_time | train | def parse_time(self, input_str, reference_time=''):
"""Parses input with Duckling for occurences of times.
Args:
input_str: An input string, e.g. 'Let's meet at 11:45am'.
reference_time: Optional reference time for Duckling.
Returns:
A preprocessed list of r... | python | {
"resource": ""
} |
q643 | AdHocClient.get_commands | train | def get_commands(self, peer_jid):
"""
Return the list of commands offered by the peer.
:param peer_jid: JID of the peer to query
:type peer_jid: :class:`~aioxmpp.JID`
:rtype: :class:`list` of :class:`~.disco.xso.Item`
:return: List of command items
In the return... | python | {
"resource": ""
} |
q644 | AdHocClient.get_command_info | train | def get_command_info(self, peer_jid, command_name):
"""
Obtain information about a command.
:param peer_jid: JID of the peer to query
:type peer_jid: :class:`~aioxmpp.JID`
:param command_name: Node name of the command
:type command_name: :class:`str`
:rtype: :cla... | python | {
"resource": ""
} |
q645 | AdHocClient.execute | train | def execute(self, peer_jid, command_name):
"""
Start execution of a command with a peer.
:param peer_jid: JID of the peer to start the command at.
:type peer_jid: :class:`~aioxmpp.JID`
:param command_name: Node name of the command to execute.
:type command_name: :class:`... | python | {
"resource": ""
} |
q646 | AdHocServer.register_stateless_command | train | def register_stateless_command(self, node, name, handler, *,
is_allowed=None,
features={namespaces.xep0004_data}):
"""
Register a handler for a stateless command.
:param node: Name of the command (``node`` in the service disc... | python | {
"resource": ""
} |
q647 | ClientSession.start | train | def start(self):
"""
Initiate the session by starting to execute the command with the peer.
:return: The :attr:`~.xso.Command.first_payload` of the response
This sends an empty command IQ request with the
:attr:`~.ActionType.EXECUTE` action.
The :attr:`status`, :attr:`... | python | {
"resource": ""
} |
q648 | ClientSession.proceed | train | def proceed(self, *,
action=adhoc_xso.ActionType.EXECUTE,
payload=None):
"""
Proceed command execution to the next stage.
:param action: Action type for proceeding
:type action: :class:`~.ActionTyp`
:param payload: Payload for the request, or :dat... | python | {
"resource": ""
} |
q649 | IBBTransport.write | train | def write(self, data):
"""
Send `data` over the IBB. If `data` is larger than the block size
is is chunked and sent in chunks.
Chunks from one call of :meth:`write` will always be sent in
| python | {
"resource": ""
} |
q650 | IBBTransport.close | train | def close(self):
"""
Close the session.
"""
if self.is_closing():
return
| python | {
"resource": ""
} |
q651 | IBBService.open_session | train | def open_session(self, protocol_factory, peer_jid, *,
stanza_type=ibb_xso.IBBStanzaType.IQ,
block_size=4096, sid=None):
"""
Establish an in-band bytestream session with `peer_jid` and
return the transport and protocol.
:param protocol_factory: t... | python | {
"resource": ""
} |
q652 | Room.features | train | def features(self):
"""
The set of features supported by this MUC. This may vary depending on
features exported by the MUC service, so be sure to check this for each
individual MUC.
"""
return {
aioxmpp.im.conversation.ConversationFeature.BAN,
aio... | python | {
"resource": ""
} |
q653 | Room.send_message | train | def send_message(self, msg):
"""
Send a message to the MUC.
:param msg: The message to send.
:type msg: :class:`aioxmpp.Message`
:return: The stanza token of the message.
:rtype: :class:`~aioxmpp.stream.StanzaToken`
There is no need to set the address attributes... | python | {
"resource": ""
} |
q654 | Room.send_message_tracked | train | def send_message_tracked(self, msg):
"""
Send a message to the MUC with tracking.
:param msg: The message to send.
:type msg: :class:`aioxmpp.Message`
.. warning::
Please read :ref:`api-tracking-memory`. This is especially relevant
for MUCs because trac... | python | {
"resource": ""
} |
q655 | Room.set_nick | train | def set_nick(self, new_nick):
"""
Change the nick name of the occupant.
:param new_nick: New nickname to use
:type new_nick: :class:`str`
This sends the request to change the nickname and waits for the request
to be sent over the stream.
The nick change may or ... | python | {
"resource": ""
} |
q656 | Room.kick | train | def kick(self, member, reason=None):
"""
Kick an occupant from the MUC.
:param member: The member to kick.
:type member: :class:`Occupant`
:param reason: A reason to show to the members of the conversation
including the kicked member.
:type reason: :class:`st... | python | {
"resource": ""
} |
q657 | Room.muc_set_role | train | def muc_set_role(self, nick, role, *, reason=None):
"""
Change the role of an occupant.
:param nick: The nickname of the occupant whose role shall be changed.
:type nick: :class:`str`
:param role: The new role for the occupant.
:type role: :class:`str`
:param rea... | python | {
"resource": ""
} |
q658 | Room.ban | train | def ban(self, member, reason=None, *, request_kick=True):
"""
Ban an occupant from re-joining the MUC.
:param member: The occupant to ban.
:type member: :class:`Occupant`
:param reason: A reason to show to the members of the conversation
including the banned member.
... | python | {
"resource": ""
} |
q659 | Room.leave | train | def leave(self):
"""
Leave the MUC.
"""
fut = self.on_exit.future()
def cb(**kwargs):
fut.set_result(None)
return True # disconnect
self.on_exit.connect(cb)
presence = aioxmpp.stanza.Presence(
| python | {
"resource": ""
} |
q660 | MUCClient.set_affiliation | train | def set_affiliation(self, mucjid, jid, affiliation, *, reason=None):
"""
Change the affiliation of an entity with a MUC.
:param mucjid: The bare JID identifying the MUC.
:type mucjid: :class:`~aioxmpp.JID`
:param jid: The bare JID of the entity whose affiliation shall be
... | python | {
"resource": ""
} |
q661 | MUCClient.get_room_config | train | def get_room_config(self, mucjid):
"""
Query and return the room configuration form for the given MUC.
:param mucjid: JID of the room to query
:type mucjid: bare :class:`~.JID`
:return: data form template for the room configuration
:rtype: :class:`aioxmpp.forms.Data`
... | python | {
"resource": ""
} |
q662 | request_slot | train | def request_slot(client,
service: JID,
filename: str,
size: int,
content_type: str):
"""
Request an HTTP upload slot.
:param client: The client to request the slot with.
:type client: :class:`aioxmpp.Client`
:param service: Address... | python | {
"resource": ""
} |
q663 | query_version | train | def query_version(stream: aioxmpp.stream.StanzaStream,
target: aioxmpp.JID) -> version_xso.Query:
"""
Query the software version of an entity.
:param stream: A stanza stream to send the query on.
:type stream: :class:`aioxmpp.stream.StanzaStream`
:param target: The address of the ... | python | {
"resource": ""
} |
q664 | as_bookmark_class | train | def as_bookmark_class(xso_class):
"""
Decorator to register `xso_class` as a custom bookmark class.
This is necessary to store and retrieve such bookmarks.
The registered class must be a subclass of the abstract base class
:class:`Bookmark`.
:raises TypeError: if `xso_class` is not a subclass ... | python | {
"resource": ""
} |
q665 | basic_filter_languages | train | def basic_filter_languages(languages, ranges):
"""
Filter languages using the string-based basic filter algorithm described in
RFC4647.
`languages` must be a sequence of :class:`LanguageTag` instances which are
to be filtered.
`ranges` must be an iterable which represent the basic language ran... | python | {
"resource": ""
} |
q666 | JID.fromstr | train | def fromstr(cls, s, *, strict=True):
"""
Construct a JID out of a string containing it.
:param s: The string to parse.
:type s: :class:`str`
:param strict: Whether to enable strict parsing.
:type strict: :class:`bool`
:raises: See :class:`JID`
:return: Th... | python | {
"resource": ""
} |
q667 | Service.get_conversation | train | def get_conversation(self, peer_jid, *, current_jid=None):
"""
Get or create a new one-to-one conversation with a peer.
:param peer_jid: The JID of the peer to converse with.
:type peer_jid: :class:`aioxmpp.JID`
:param current_jid: The current JID to lock the conversation to (se... | python | {
"resource": ""
} |
q668 | reconfigure_resolver | train | def reconfigure_resolver():
"""
Reset the resolver configured for this thread to a fresh instance. This
essentially re-reads the system-wide resolver configuration.
If a custom resolver has been set using :func:`set_resolver`, the flag
| python | {
"resource": ""
} |
q669 | iq_handler | train | def iq_handler(type_, payload_cls, *, with_send_reply=False):
"""
Register the decorated function or coroutine function as IQ request
handler.
:param type_: IQ type to listen for
:type type_: :class:`~.IQType`
:param payload_cls: Payload XSO class to listen for
:type payload_cls: :class:`~.... | python | {
"resource": ""
} |
q670 | inbound_message_filter | train | 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 | {
"resource": ""
} |
q671 | inbound_presence_filter | train | 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 | {
"resource": ""
} |
q672 | outbound_message_filter | train | 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 | {
"resource": ""
} |
q673 | outbound_presence_filter | train | 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 | {
"resource": ""
} |
q674 | depsignal | train | 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 | {
"resource": ""
} |
q675 | attrsignal | train | 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 | {
"resource": ""
} |
q676 | Descriptor.add_to_stack | train | 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 | {
"resource": ""
} |
q677 | Meta.orders_after | train | def orders_after(self, other, *, visited=None):
"""
Return whether `self` depends on `other` and will be instanciated
later.
| python | {
"resource": ""
} |
q678 | Meta.orders_after_any | train | 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 | {
"resource": ""
} |
q679 | TaskPool.set_limit | train | 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 | {
"resource": ""
} |
q680 | TaskPool.spawn | train | 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 | {
"resource": ""
} |
q681 | CarbonsClient.enable | train | 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
| python | {
"resource": ""
} |
q682 | CarbonsClient.disable | train | 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
| python | {
"resource": ""
} |
q683 | StanzaStream._process_incoming_iq | train | 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 | {
"resource": ""
} |
q684 | StanzaStream._process_incoming_message | train | 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 | {
"resource": ""
} |
q685 | StanzaStream._process_incoming_presence | train | 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 | {
"resource": ""
} |
q686 | StanzaStream._process_incoming | train | 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 | {
"resource": ""
} |
q687 | StanzaStream.flush_incoming | train | 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.
| python | {
"resource": ""
} |
q688 | StanzaStream._send_stanza | train | 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 | {
"resource": ""
} |
q689 | StanzaStream.register_iq_request_handler | train | 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 | {
"resource": ""
} |
q690 | StanzaStream.register_message_callback | train | 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 | {
"resource": ""
} |
q691 | StanzaStream.register_presence_callback | train | 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 | {
"resource": ""
} |
q692 | StanzaStream.wait_stop | train | 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:
| python | {
"resource": ""
} |
q693 | StanzaStream.resume_sm | train | 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 | {
"resource": ""
} |
q694 | StanzaStream._send_immediately | train | 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 | {
"resource": ""
} |
q695 | _process_features | train | 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` | python | {
"resource": ""
} |
q696 | _process_identities | train | 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 | {
"resource": ""
} |
q697 | _process_extensions | train | 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 | {
"resource": ""
} |
q698 | OrderedStateMachine.wait_for | train | 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
| python | {
"resource": ""
} |
q699 | OrderedStateMachine.wait_for_at_least | train | 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):
| python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.