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_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
locationlabs/mockredis
mockredis/client.py
MockRedis.lset
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: redis_list[index] = self._encode(value) except IndexError: raise ResponseError("index...
python
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: redis_list[index] = self._encode(value) except IndexError: raise ResponseError("index...
Emulate lset.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L792-L800
locationlabs/mockredis
mockredis/client.py
MockRedis._common_scan
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
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 = ...
Common scanning skeleton. :param key: optional function used to identify what 'match' is applied to
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L882-L910
locationlabs/mockredis
mockredis/client.py
MockRedis.scan
def scan(self, cursor='0', match=None, count=10): """Emulate scan.""" def value_function(): return sorted(self.redis.keys()) # sorted list for consistent order return self._common_scan(value_function, cursor=cursor, match=match, count=count)
python
def scan(self, cursor='0', match=None, count=10): """Emulate scan.""" def value_function(): return sorted(self.redis.keys()) # sorted list for consistent order return self._common_scan(value_function, cursor=cursor, match=match, count=count)
Emulate scan.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L912-L916
locationlabs/mockredis
mockredis/client.py
MockRedis.sscan
def sscan(self, name, cursor='0', match=None, count=10): """Emulate sscan.""" def value_function(): members = list(self.smembers(name)) members.sort() # sort for consistent order return members return self._common_scan(value_function, cursor=cursor, match=mat...
python
def sscan(self, name, cursor='0', match=None, count=10): """Emulate sscan.""" def value_function(): members = list(self.smembers(name)) members.sort() # sort for consistent order return members return self._common_scan(value_function, cursor=cursor, match=mat...
Emulate sscan.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L926-L932
locationlabs/mockredis
mockredis/client.py
MockRedis.zscan
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 return values return self._common_scan(value_fun...
python
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 return values return self._common_scan(value_fun...
Emulate zscan.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L943-L949
locationlabs/mockredis
mockredis/client.py
MockRedis.hscan
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
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 ...
Emulate hscan.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L960-L969
locationlabs/mockredis
mockredis/client.py
MockRedis.hscan_iter
def hscan_iter(self, name, match=None, count=10): """Emulate hscan_iter.""" cursor = '0' while cursor != 0: cursor, data = self.hscan(name, cursor=cursor, match=match, count=count) for item in data.items(): yield item
python
def hscan_iter(self, name, match=None, count=10): """Emulate hscan_iter.""" cursor = '0' while cursor != 0: cursor, data = self.hscan(name, cursor=cursor, match=match, count=count) for item in data.items(): yield item
Emulate hscan_iter.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L971-L978
locationlabs/mockredis
mockredis/client.py
MockRedis.sadd
def sadd(self, key, *values): """Emulate sadd.""" if len(values) == 0: raise ResponseError("wrong number of arguments for 'sadd' command") redis_set = self._get_set(key, 'SADD', create=True) before_count = len(redis_set) redis_set.update(map(self._encode, values)) ...
python
def sadd(self, key, *values): """Emulate sadd.""" if len(values) == 0: raise ResponseError("wrong number of arguments for 'sadd' command") redis_set = self._get_set(key, 'SADD', create=True) before_count = len(redis_set) redis_set.update(map(self._encode, values)) ...
Emulate sadd.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L982-L990
locationlabs/mockredis
mockredis/client.py
MockRedis.sdiff
def sdiff(self, keys, *args): """Emulate sdiff.""" func = lambda left, right: left.difference(right) return self._apply_to_sets(func, "SDIFF", keys, *args)
python
def sdiff(self, keys, *args): """Emulate sdiff.""" func = lambda left, right: left.difference(right) return self._apply_to_sets(func, "SDIFF", keys, *args)
Emulate sdiff.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L997-L1000
locationlabs/mockredis
mockredis/client.py
MockRedis.sdiffstore
def sdiffstore(self, dest, keys, *args): """Emulate sdiffstore.""" result = self.sdiff(keys, *args) self.redis[self._encode(dest)] = result return len(result)
python
def sdiffstore(self, dest, keys, *args): """Emulate sdiffstore.""" result = self.sdiff(keys, *args) self.redis[self._encode(dest)] = result return len(result)
Emulate sdiffstore.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1002-L1006
locationlabs/mockredis
mockredis/client.py
MockRedis.sinter
def sinter(self, keys, *args): """Emulate sinter.""" func = lambda left, right: left.intersection(right) return self._apply_to_sets(func, "SINTER", keys, *args)
python
def sinter(self, keys, *args): """Emulate sinter.""" func = lambda left, right: left.intersection(right) return self._apply_to_sets(func, "SINTER", keys, *args)
Emulate sinter.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1008-L1011
locationlabs/mockredis
mockredis/client.py
MockRedis.sinterstore
def sinterstore(self, dest, keys, *args): """Emulate sinterstore.""" result = self.sinter(keys, *args) self.redis[self._encode(dest)] = result return len(result)
python
def sinterstore(self, dest, keys, *args): """Emulate sinterstore.""" result = self.sinter(keys, *args) self.redis[self._encode(dest)] = result return len(result)
Emulate sinterstore.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1013-L1017
locationlabs/mockredis
mockredis/client.py
MockRedis.sismember
def sismember(self, name, value): """Emulate sismember.""" redis_set = self._get_set(name, 'SISMEMBER') if not redis_set: return 0 result = self._encode(value) in redis_set return 1 if result else 0
python
def sismember(self, name, value): """Emulate sismember.""" redis_set = self._get_set(name, 'SISMEMBER') if not redis_set: return 0 result = self._encode(value) in redis_set return 1 if result else 0
Emulate sismember.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1019-L1026
locationlabs/mockredis
mockredis/client.py
MockRedis.smove
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 src_set.discard(value) dst_set.add(value) sel...
python
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 src_set.discard(value) dst_set.add(value) sel...
Emulate smove.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1032-L1044
locationlabs/mockredis
mockredis/client.py
MockRedis.spop
def spop(self, name): """Emulate spop.""" redis_set = self._get_set(name, 'SPOP') if not redis_set: return None member = choice(list(redis_set)) redis_set.remove(member) if len(redis_set) == 0: self.delete(name) return member
python
def spop(self, name): """Emulate spop.""" redis_set = self._get_set(name, 'SPOP') if not redis_set: return None member = choice(list(redis_set)) redis_set.remove(member) if len(redis_set) == 0: self.delete(name) return member
Emulate spop.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1046-L1055
locationlabs/mockredis
mockredis/client.py
MockRedis.srandmember
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)) elif number > 0: retur...
python
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)) elif number > 0: retur...
Emulate srandmember.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1057-L1067
locationlabs/mockredis
mockredis/client.py
MockRedis.srem
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 = len(redis_set) if be...
python
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 = len(redis_set) if be...
Emulate srem.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1069-L1080
locationlabs/mockredis
mockredis/client.py
MockRedis.sunion
def sunion(self, keys, *args): """Emulate sunion.""" func = lambda left, right: left.union(right) return self._apply_to_sets(func, "SUNION", keys, *args)
python
def sunion(self, keys, *args): """Emulate sunion.""" func = lambda left, right: left.union(right) return self._apply_to_sets(func, "SUNION", keys, *args)
Emulate sunion.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1082-L1085
locationlabs/mockredis
mockredis/client.py
MockRedis.sunionstore
def sunionstore(self, dest, keys, *args): """Emulate sunionstore.""" result = self.sunion(keys, *args) self.redis[self._encode(dest)] = result return len(result)
python
def sunionstore(self, dest, keys, *args): """Emulate sunionstore.""" result = self.sunion(keys, *args) self.redis[self._encode(dest)] = result return len(result)
Emulate sunionstore.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1087-L1091
locationlabs/mockredis
mockredis/client.py
MockRedis.eval
def eval(self, script, numkeys, *keys_and_args): """Emulate eval""" sha = self.script_load(script) return self.evalsha(sha, numkeys, *keys_and_args)
python
def eval(self, script, numkeys, *keys_and_args): """Emulate eval""" sha = self.script_load(script) return self.evalsha(sha, numkeys, *keys_and_args)
Emulate eval
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1306-L1309
locationlabs/mockredis
mockredis/client.py
MockRedis.evalsha
def evalsha(self, sha, numkeys, *keys_and_args): """Emulates evalsha""" if not self.script_exists(sha)[0]: raise RedisError("Sha not registered") script_callable = Script(self, self.shas[sha], self.load_lua_dependencies) numkeys = max(numkeys, 0) keys = keys_and_args[...
python
def evalsha(self, sha, numkeys, *keys_and_args): """Emulates evalsha""" if not self.script_exists(sha)[0]: raise RedisError("Sha not registered") script_callable = Script(self, self.shas[sha], self.load_lua_dependencies) numkeys = max(numkeys, 0) keys = keys_and_args[...
Emulates evalsha
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1311-L1319
locationlabs/mockredis
mockredis/client.py
MockRedis.script_load
def script_load(self, script): """Emulate script_load""" sha_digest = sha1(script.encode("utf-8")).hexdigest() self.shas[sha_digest] = script return sha_digest
python
def script_load(self, script): """Emulate script_load""" sha_digest = sha1(script.encode("utf-8")).hexdigest() self.shas[sha_digest] = script return sha_digest
Emulate script_load
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1334-L1338
locationlabs/mockredis
mockredis/client.py
MockRedis.call
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 expected redis-py arguments. """ command = self._normalize_command_name(command) ...
python
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 expected redis-py arguments. """ command = self._normalize_command_name(command) ...
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 expected redis-py arguments.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1344-L1356
locationlabs/mockredis
mockredis/client.py
MockRedis._normalize_command_args
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
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[...
Modifies the command arguments to match the strictness of the redis client.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1369-L1404
locationlabs/mockredis
mockredis/client.py
MockRedis.config_get
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: result[name] = int(value) except ...
python
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: result[name] = int(value) except ...
Get one or more configuration parameters.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1421-L1432
locationlabs/mockredis
mockredis/client.py
MockRedis._get_list
def _get_list(self, key, operation, create=False): """ Get (and maybe create) a list by name. """ return self._get_by_type(key, operation, create, b'list', [])
python
def _get_list(self, key, operation, create=False): """ Get (and maybe create) a list by name. """ return self._get_by_type(key, operation, create, b'list', [])
Get (and maybe create) a list by name.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1441-L1445
locationlabs/mockredis
mockredis/client.py
MockRedis._get_set
def _get_set(self, key, operation, create=False): """ Get (and maybe create) a set by name. """ return self._get_by_type(key, operation, create, b'set', set())
python
def _get_set(self, key, operation, create=False): """ Get (and maybe create) a set by name. """ return self._get_by_type(key, operation, create, b'set', set())
Get (and maybe create) a set by name.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1447-L1451
locationlabs/mockredis
mockredis/client.py
MockRedis._get_hash
def _get_hash(self, name, operation, create=False): """ Get (and maybe create) a hash by name. """ return self._get_by_type(name, operation, create, b'hash', {})
python
def _get_hash(self, name, operation, create=False): """ Get (and maybe create) a hash by name. """ return self._get_by_type(name, operation, create, b'hash', {})
Get (and maybe create) a hash by name.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1453-L1457
locationlabs/mockredis
mockredis/client.py
MockRedis._get_zset
def _get_zset(self, name, operation, create=False): """ Get (and maybe create) a sorted set by name. """ return self._get_by_type(name, operation, create, b'zset', SortedSet(), return_default=False)
python
def _get_zset(self, name, operation, create=False): """ Get (and maybe create) a sorted set by name. """ return self._get_by_type(name, operation, create, b'zset', SortedSet(), return_default=False)
Get (and maybe create) a sorted set by name.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1459-L1463
locationlabs/mockredis
mockredis/client.py
MockRedis._get_by_type
def _get_by_type(self, key, operation, create, type_, default, return_default=True): """ Get (and maybe create) a redis data structure by name and type. """ key = self._encode(key) if self.type(key) in [type_, b'none']: if create: return self.redis.set...
python
def _get_by_type(self, key, operation, create, type_, default, return_default=True): """ Get (and maybe create) a redis data structure by name and type. """ key = self._encode(key) if self.type(key) in [type_, b'none']: if create: return self.redis.set...
Get (and maybe create) a redis data structure by name and type.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1465-L1476
locationlabs/mockredis
mockredis/client.py
MockRedis._translate_range
def _translate_range(self, len_, start, end): """ Translate range to valid bounds. """ if start < 0: start += len_ start = max(0, min(start, len_)) if end < 0: end += len_ end = max(-1, min(end, len_ - 1)) return start, end
python
def _translate_range(self, len_, start, end): """ Translate range to valid bounds. """ if start < 0: start += len_ start = max(0, min(start, len_)) if end < 0: end += len_ end = max(-1, min(end, len_ - 1)) return start, end
Translate range to valid bounds.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1478-L1488
locationlabs/mockredis
mockredis/client.py
MockRedis._translate_limit
def _translate_limit(self, len_, start, num): """ Translate limit to valid bounds. """ if start > len_ or num <= 0: return 0, 0 return min(start, len_), num
python
def _translate_limit(self, len_, start, num): """ Translate limit to valid bounds. """ if start > len_ or num <= 0: return 0, 0 return min(start, len_), num
Translate limit to valid bounds.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1490-L1496
locationlabs/mockredis
mockredis/client.py
MockRedis._range_func
def _range_func(self, withscores, score_cast_func): """ Return a suitable function from (score, member) """ if withscores: return lambda score_member: (score_member[1], score_cast_func(self._encode(score_member[0]))) # noqa else: return lambda score_membe...
python
def _range_func(self, withscores, score_cast_func): """ Return a suitable function from (score, member) """ if withscores: return lambda score_member: (score_member[1], score_cast_func(self._encode(score_member[0]))) # noqa else: return lambda score_membe...
Return a suitable function from (score, member)
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1498-L1505
locationlabs/mockredis
mockredis/client.py
MockRedis._aggregate_func
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: return funcs[func_name] except KeyError: raise...
python
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: return funcs[func_name] except KeyError: raise...
Return a suitable aggregate score function.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1507-L1516
locationlabs/mockredis
mockredis/client.py
MockRedis._apply_to_sets
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())) left = self._get_set(keys[0], operation)...
python
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())) left = self._get_set(keys[0], operation)...
Helper function for sdiff, sinter, and sunion
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1518-L1527
locationlabs/mockredis
mockredis/client.py
MockRedis._list_or_args
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 as a list if isinstance(ke...
python
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 as a list if isinstance(ke...
Shamelessly copied from redis-py.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1529-L1544
locationlabs/mockredis
mockredis/client.py
MockRedis._encode
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
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): ...
Return a bytestring representation of the value. Taken from redis-py connection.py
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1551-L1563
locationlabs/mockredis
mockredis/sortedset.py
SortedSet.insert
def insert(self, member, score): """ Identical to __setitem__, but returns whether a member was inserted (True) or updated (False) """ found = self.remove(member) index = bisect_left(self._scores, (score, member)) self._scores.insert(index, (score, member)) ...
python
def insert(self, member, score): """ Identical to __setitem__, but returns whether a member was inserted (True) or updated (False) """ found = self.remove(member) index = bisect_left(self._scores, (score, member)) self._scores.insert(index, (score, member)) ...
Identical to __setitem__, but returns whether a member was inserted (True) or updated (False)
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/sortedset.py#L78-L87
locationlabs/mockredis
mockredis/sortedset.py
SortedSet.remove
def remove(self, member): """ Identical to __delitem__, but returns whether a member was removed. """ if member not in self: return False score = self._members[member] score_index = bisect_left(self._scores, (score, member)) del self._scores[score_inde...
python
def remove(self, member): """ Identical to __delitem__, but returns whether a member was removed. """ if member not in self: return False score = self._members[member] score_index = bisect_left(self._scores, (score, member)) del self._scores[score_inde...
Identical to __delitem__, but returns whether a member was removed.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/sortedset.py#L89-L99
locationlabs/mockredis
mockredis/sortedset.py
SortedSet.rank
def rank(self, member): """ Get the rank (index of a member). """ score = self._members.get(member) if score is None: return None return bisect_left(self._scores, (score, member))
python
def rank(self, member): """ Get the rank (index of a member). """ score = self._members.get(member) if score is None: return None return bisect_left(self._scores, (score, member))
Get the rank (index of a member).
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/sortedset.py#L108-L115
locationlabs/mockredis
mockredis/sortedset.py
SortedSet.range
def range(self, start, end, desc=False): """ Return (score, member) pairs between min and max ranks. """ if not self: return [] if desc: return reversed(self._scores[len(self) - end - 1:len(self) - start]) else: return self._scores[sta...
python
def range(self, start, end, desc=False): """ Return (score, member) pairs between min and max ranks. """ if not self: return [] if desc: return reversed(self._scores[len(self) - end - 1:len(self) - start]) else: return self._scores[sta...
Return (score, member) pairs between min and max ranks.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/sortedset.py#L117-L127
locationlabs/mockredis
mockredis/sortedset.py
SortedSet.scorerange
def scorerange(self, start, end, start_inclusive=True, end_inclusive=True): """ Return (score, member) pairs between min and max scores. """ if not self: return [] left = bisect_left(self._scores, (start,)) right = bisect_right(self._scores, (end,)) ...
python
def scorerange(self, start, end, start_inclusive=True, end_inclusive=True): """ Return (score, member) pairs between min and max scores. """ if not self: return [] left = bisect_left(self._scores, (start,)) right = bisect_right(self._scores, (end,)) ...
Return (score, member) pairs between min and max scores.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/sortedset.py#L129-L147
locationlabs/mockredis
mockredis/pipeline.py
MockRedisPipeline.watch
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 for key in keys: sel...
python
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 for key in keys: sel...
Put the pipeline into immediate execution mode. Does not actually watch any keys.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/pipeline.py#L33-L42
locationlabs/mockredis
mockredis/pipeline.py
MockRedisPipeline.multi
def multi(self): """ Start a transactional block of the pipeline after WATCH commands are issued. End the transactional block with `execute`. """ if self.explicit_transaction: raise RedisError("Cannot issue nested calls to MULTI") if self.commands: ...
python
def multi(self): """ Start a transactional block of the pipeline after WATCH commands are issued. End the transactional block with `execute`. """ if self.explicit_transaction: raise RedisError("Cannot issue nested calls to MULTI") if self.commands: ...
Start a transactional block of the pipeline after WATCH commands are issued. End the transactional block with `execute`.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/pipeline.py#L44-L53
locationlabs/mockredis
mockredis/pipeline.py
MockRedisPipeline.execute
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: raise WatchError("Watched variable chan...
python
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: raise WatchError("Watched variable chan...
Execute all of the saved commands and return results.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/pipeline.py#L55-L65
locationlabs/mockredis
mockredis/pipeline.py
MockRedisPipeline._reset
def _reset(self): """ Reset instance variables. """ self.commands = [] self.watching = False self._watched_keys = {} self.explicit_transaction = False
python
def _reset(self): """ Reset instance variables. """ self.commands = [] self.watching = False self._watched_keys = {} self.explicit_transaction = False
Reset instance variables.
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/pipeline.py#L67-L74
FraBle/python-duckling
duckling/language.py
Language.convert_to_duckling_language_id
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
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...
Ensure a language identifier has the correct duckling format and is supported.
https://github.com/FraBle/python-duckling/blob/e6a34192e35fd4fc287b4bc93c938fcd5c2d9024/duckling/language.py#L51-L60
FraBle/python-duckling
duckling/duckling.py
Duckling.load
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
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"]) """ ...
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"])
https://github.com/FraBle/python-duckling/blob/e6a34192e35fd4fc287b4bc93c938fcd5c2d9024/duckling/duckling.py#L81-L107
FraBle/python-duckling
duckling/duckling.py
Duckling.parse
def parse(self, input_str, language=Language.ENGLISH, dim_filter=None, reference_time=''): """Parses datetime information out of string input. It invokes the Duckling.parse() function in Clojure. A language can be specified, default is English. Args: input_str: The input as...
python
def parse(self, input_str, language=Language.ENGLISH, dim_filter=None, reference_time=''): """Parses datetime information out of string input. It invokes the Duckling.parse() function in Clojure. A language can be specified, default is English. Args: input_str: The input as...
Parses datetime information out of string input. It invokes the Duckling.parse() function in Clojure. A language can be specified, default is English. Args: input_str: The input as string that has to be parsed. language: Optional parameter to specify language, ...
https://github.com/FraBle/python-duckling/blob/e6a34192e35fd4fc287b4bc93c938fcd5c2d9024/duckling/duckling.py#L109-L160
FraBle/python-duckling
duckling/wrapper.py
DucklingWrapper.parse_time
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
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...
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 results (dicts) from Duckling output. For example: ...
https://github.com/FraBle/python-duckling/blob/e6a34192e35fd4fc287b4bc93c938fcd5c2d9024/duckling/wrapper.py#L258-L287
horazont/aioxmpp
aioxmpp/adhoc/service.py
AdHocClient.get_commands
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
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...
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 returned list, each :class:`~.disco.xso.Item` represents one...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L72-L92
horazont/aioxmpp
aioxmpp/adhoc/service.py
AdHocClient.get_command_info
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
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...
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: :class:`~.disco.xso.InfoQuery` :return: Service discovery informatio...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L95-L122
horazont/aioxmpp
aioxmpp/adhoc/service.py
AdHocClient.supports_commands
def supports_commands(self, peer_jid): """ Detect whether a peer supports :xep:`50` Ad-Hoc commands. :param peer_jid: JID of the peer to query :type peer_jid: :class:`aioxmpp.JID` :rtype: :class:`bool` :return: True if the peer supports the Ad-Hoc commands protocol, fals...
python
def supports_commands(self, peer_jid): """ Detect whether a peer supports :xep:`50` Ad-Hoc commands. :param peer_jid: JID of the peer to query :type peer_jid: :class:`aioxmpp.JID` :rtype: :class:`bool` :return: True if the peer supports the Ad-Hoc commands protocol, fals...
Detect whether a peer supports :xep:`50` Ad-Hoc commands. :param peer_jid: JID of the peer to query :type peer_jid: :class:`aioxmpp.JID` :rtype: :class:`bool` :return: True if the peer supports the Ad-Hoc commands protocol, false otherwise. Note that the fact t...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L125-L144
horazont/aioxmpp
aioxmpp/adhoc/service.py
AdHocClient.execute
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
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:`...
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:`str` :rtype: :class:`~.adhoc.service.ClientSession` ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L147-L171
horazont/aioxmpp
aioxmpp/adhoc/service.py
AdHocServer.register_stateless_command
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
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...
Register a handler for a stateless command. :param node: Name of the command (``node`` in the service discovery list). :type node: :class:`str` :param name: Human-readable name of the command :type name: :class:`str` or :class:`~.LanguageMap` :param handler:...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L299-L349
horazont/aioxmpp
aioxmpp/adhoc/service.py
ClientSession.allowed_actions
def allowed_actions(self): """ Shorthand to access :attr:`~.xso.Actions.allowed_actions` of the :attr:`response`. If no response has been received yet or if the response specifies no set of valid actions, this is the minimal set of allowed actions ( :attr:`~.ActionType.E...
python
def allowed_actions(self): """ Shorthand to access :attr:`~.xso.Actions.allowed_actions` of the :attr:`response`. If no response has been received yet or if the response specifies no set of valid actions, this is the minimal set of allowed actions ( :attr:`~.ActionType.E...
Shorthand to access :attr:`~.xso.Actions.allowed_actions` of the :attr:`response`. If no response has been received yet or if the response specifies no set of valid actions, this is the minimal set of allowed actions ( :attr:`~.ActionType.EXECUTE` and :attr:`~.ActionType.CANCEL`).
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L464-L477
horazont/aioxmpp
aioxmpp/adhoc/service.py
ClientSession.start
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
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:`...
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:`response` and related attributes get ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L480-L506
horazont/aioxmpp
aioxmpp/adhoc/service.py
ClientSession.proceed
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
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...
Proceed command execution to the next stage. :param action: Action type for proceeding :type action: :class:`~.ActionTyp` :param payload: Payload for the request, or :data:`None` :return: The :attr:`~.xso.Command.first_payload` of the response `action` must be one of the action...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/adhoc/service.py#L509-L572
horazont/aioxmpp
aioxmpp/ibb/service.py
IBBTransport.write
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 series. """ if self.is_closing(): return self._write_...
python
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 series. """ if self.is_closing(): return self._write_...
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 series.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibb/service.py#L232-L250
horazont/aioxmpp
aioxmpp/ibb/service.py
IBBTransport.close
def close(self): """ Close the session. """ if self.is_closing(): return self._closing = True # make sure the writer wakes up self._can_write.set()
python
def close(self): """ Close the session. """ if self.is_closing(): return self._closing = True # make sure the writer wakes up self._can_write.set()
Close the session.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibb/service.py#L265-L274
horazont/aioxmpp
aioxmpp/ibb/service.py
IBBService.expect_session
def expect_session(self, protocol_factory, peer_jid, sid): """ Whitelist the session with `peer_jid` and the session id `sid` and return it when it is established. This is meant to be used with signalling protocols like Jingle and is the counterpart to :meth:`open_session`. ...
python
def expect_session(self, protocol_factory, peer_jid, sid): """ Whitelist the session with `peer_jid` and the session id `sid` and return it when it is established. This is meant to be used with signalling protocols like Jingle and is the counterpart to :meth:`open_session`. ...
Whitelist the session with `peer_jid` and the session id `sid` and return it when it is established. This is meant to be used with signalling protocols like Jingle and is the counterpart to :meth:`open_session`. :returns: an awaitable object, whose result is the tuple ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibb/service.py#L399-L416
horazont/aioxmpp
aioxmpp/ibb/service.py
IBBService.open_session
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
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...
Establish an in-band bytestream session with `peer_jid` and return the transport and protocol. :param protocol_factory: the protocol factory :type protocol_factory: a nullary callable returning an :class:`asyncio.Protocol` instance :param peer_jid: the JI...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/ibb/service.py#L419-L471
horazont/aioxmpp
docs/sphinx-data/extensions/aioxmppspecific.py
xep_role
def xep_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): """Role for PEP/RFC references that generate an index entry.""" env = inliner.document.settings.env if not typ: typ = env.config.default_role else: typ = typ.lower() has_explicit_title, title, tar...
python
def xep_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): """Role for PEP/RFC references that generate an index entry.""" env = inliner.document.settings.env if not typ: typ = env.config.default_role else: typ = typ.lower() has_explicit_title, title, tar...
Role for PEP/RFC references that generate an index entry.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/docs/sphinx-data/extensions/aioxmppspecific.py#L136-L171
horazont/aioxmpp
aioxmpp/xso/types.py
EnumType
def EnumType(enum_class, nested_type=_Undefined, **kwargs): """ Create and return a :class:`EnumCDataType` or :class:`EnumElementType`, depending on the type of `nested_type`. If `nested_type` is a :class:`AbstractCDataType` or omitted, a :class:`EnumCDataType` is constructed. Otherwise, :class:`En...
python
def EnumType(enum_class, nested_type=_Undefined, **kwargs): """ Create and return a :class:`EnumCDataType` or :class:`EnumElementType`, depending on the type of `nested_type`. If `nested_type` is a :class:`AbstractCDataType` or omitted, a :class:`EnumCDataType` is constructed. Otherwise, :class:`En...
Create and return a :class:`EnumCDataType` or :class:`EnumElementType`, depending on the type of `nested_type`. If `nested_type` is a :class:`AbstractCDataType` or omitted, a :class:`EnumCDataType` is constructed. Otherwise, :class:`EnumElementType` is used. The arguments are forwarded to the resp...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/xso/types.py#L1169-L1196
horazont/aioxmpp
aioxmpp/muc/service.py
_extract_one_pair
def _extract_one_pair(body): """ Extract one language-text pair from a :class:`~.LanguageMap`. This is used for tracking. """ if not body: return None, None try: return None, body[None] except KeyError: return min(body.items(), key=lambda x: x[0])
python
def _extract_one_pair(body): """ Extract one language-text pair from a :class:`~.LanguageMap`. This is used for tracking. """ if not body: return None, None try: return None, body[None] except KeyError: return min(body.items(), key=lambda x: x[0])
Extract one language-text pair from a :class:`~.LanguageMap`. This is used for tracking.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L48-L60
horazont/aioxmpp
aioxmpp/muc/service.py
Room.members
def members(self): """ A copy of the list of occupants. The local user is always the first item in the list, unless the :meth:`on_enter` has not fired yet. """ if self._this_occupant is not None: items = [self._this_occupant] else: items = [] ...
python
def members(self): """ A copy of the list of occupants. The local user is always the first item in the list, unless the :meth:`on_enter` has not fired yet. """ if self._this_occupant is not None: items = [self._this_occupant] else: items = [] ...
A copy of the list of occupants. The local user is always the first item in the list, unless the :meth:`on_enter` has not fired yet.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L986-L997
horazont/aioxmpp
aioxmpp/muc/service.py
Room.features
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
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...
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.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1018-L1035
horazont/aioxmpp
aioxmpp/muc/service.py
Room.send_message
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
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...
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 or the type of the message correctly; th...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1470-L1498
horazont/aioxmpp
aioxmpp/muc/service.py
Room.send_message_tracked
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
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...
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 tracking is not guaranteed to work due to how :xe...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1508-L1610
horazont/aioxmpp
aioxmpp/muc/service.py
Room.set_nick
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
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 ...
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 may not happen, or the service may modify the ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1613-L1638
horazont/aioxmpp
aioxmpp/muc/service.py
Room.kick
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
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...
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:`str` :raises aioxmpp.errors.XMPPError: if the serve...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1641-L1662
horazont/aioxmpp
aioxmpp/muc/service.py
Room.muc_set_role
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
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...
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 reason: An optional reason to show to the occupant (and all oth...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1665-L1708
horazont/aioxmpp
aioxmpp/muc/service.py
Room.ban
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
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. ...
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. :type reason: :class:`str` :param request_kick: A flag indicat...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1711-L1741
horazont/aioxmpp
aioxmpp/muc/service.py
Room.muc_set_affiliation
def muc_set_affiliation(self, jid, affiliation, *, reason=None): """ Convenience wrapper around :meth:`.MUCClient.set_affiliation`. See there for details, and consider its `mucjid` argument to be set to :attr:`mucjid`. """ return (yield from self.service.set_affiliation( ...
python
def muc_set_affiliation(self, jid, affiliation, *, reason=None): """ Convenience wrapper around :meth:`.MUCClient.set_affiliation`. See there for details, and consider its `mucjid` argument to be set to :attr:`mucjid`. """ return (yield from self.service.set_affiliation( ...
Convenience wrapper around :meth:`.MUCClient.set_affiliation`. See there for details, and consider its `mucjid` argument to be set to :attr:`mucjid`.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1744-L1753
horazont/aioxmpp
aioxmpp/muc/service.py
Room.set_topic
def set_topic(self, new_topic): """ Change the (possibly publicly) visible topic of the conversation. :param new_topic: The new topic for the conversation. :type new_topic: :class:`str` Request to set the subject to `new_topic`. `new_topic` must be a mapping which maps ...
python
def set_topic(self, new_topic): """ Change the (possibly publicly) visible topic of the conversation. :param new_topic: The new topic for the conversation. :type new_topic: :class:`str` Request to set the subject to `new_topic`. `new_topic` must be a mapping which maps ...
Change the (possibly publicly) visible topic of the conversation. :param new_topic: The new topic for the conversation. :type new_topic: :class:`str` Request to set the subject to `new_topic`. `new_topic` must be a mapping which maps :class:`~.structs.LanguageTag` tags to strings; ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1756-L1774
horazont/aioxmpp
aioxmpp/muc/service.py
Room.leave
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( type_=aioxmpp.structs.PresenceT...
python
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( type_=aioxmpp.structs.PresenceT...
Leave the MUC.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1777-L1795
horazont/aioxmpp
aioxmpp/muc/service.py
Room.muc_request_voice
def muc_request_voice(self): """ Request voice (participant role) in the room and wait for the request to be sent. The participant role allows occupants to send messages while the room is in moderated mode. There is no guarantee that the request will be granted. To dete...
python
def muc_request_voice(self): """ Request voice (participant role) in the room and wait for the request to be sent. The participant role allows occupants to send messages while the room is in moderated mode. There is no guarantee that the request will be granted. To dete...
Request voice (participant role) in the room and wait for the request to be sent. The participant role allows occupants to send messages while the room is in moderated mode. There is no guarantee that the request will be granted. To detect that voice has been granted, observe t...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L1798-L1838
horazont/aioxmpp
aioxmpp/muc/service.py
MUCClient.join
def join(self, mucjid, nick, *, password=None, history=None, autorejoin=True): """ Join a multi-user chat and create a conversation for it. :param mucjid: The bare JID of the room to join. :type mucjid: :class:`~aioxmpp.JID`. :param nick: The nickname to use in the ...
python
def join(self, mucjid, nick, *, password=None, history=None, autorejoin=True): """ Join a multi-user chat and create a conversation for it. :param mucjid: The bare JID of the room to join. :type mucjid: :class:`~aioxmpp.JID`. :param nick: The nickname to use in the ...
Join a multi-user chat and create a conversation for it. :param mucjid: The bare JID of the room to join. :type mucjid: :class:`~aioxmpp.JID`. :param nick: The nickname to use in the room. :type nick: :class:`str` :param password: The password to join the room, if required. ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L2265-L2379
horazont/aioxmpp
aioxmpp/muc/service.py
MUCClient.set_affiliation
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
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 ...
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 changed. :type jid: :class:`~aioxmpp.JID` :param affiliation: The ne...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L2382-L2435
horazont/aioxmpp
aioxmpp/muc/service.py
MUCClient.get_room_config
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
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` ...
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` .. seealso:: :class:`~.ConfigurationF...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L2438-L2464
horazont/aioxmpp
aioxmpp/muc/service.py
MUCClient.set_room_config
def set_room_config(self, mucjid, data): """ Set the room configuration using a :xep:`4` data form. :param mucjid: JID of the room to query :type mucjid: bare :class:`~.JID` :param data: Filled-out configuration form :type data: :class:`aioxmpp.forms.Data` .. se...
python
def set_room_config(self, mucjid, data): """ Set the room configuration using a :xep:`4` data form. :param mucjid: JID of the room to query :type mucjid: bare :class:`~.JID` :param data: Filled-out configuration form :type data: :class:`aioxmpp.forms.Data` .. se...
Set the room configuration using a :xep:`4` data form. :param mucjid: JID of the room to query :type mucjid: bare :class:`~.JID` :param data: Filled-out configuration form :type data: :class:`aioxmpp.forms.Data` .. seealso:: :class:`~.ConfigurationForm` ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/muc/service.py#L2467-L2499
horazont/aioxmpp
aioxmpp/httpupload/__init__.py
request_slot
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
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...
Request an HTTP upload slot. :param client: The client to request the slot with. :type client: :class:`aioxmpp.Client` :param service: Address of the HTTP upload service. :type service: :class:`~aioxmpp.JID` :param filename: Name of the file (without path), may be used by the server to gene...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/httpupload/__init__.py#L76-L109
horazont/aioxmpp
aioxmpp/version/service.py
query_version
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
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 ...
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 entity to query. :type target: :class:`aioxmpp.JID` :raises OSError: if a connection issue occured before a reply was re...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/version/service.py#L185-L212
horazont/aioxmpp
aioxmpp/bookmarks/xso.py
as_bookmark_class
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
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 ...
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 of :class:`Bookmark`.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/xso.py#L241-L262
horazont/aioxmpp
aioxmpp/structs.py
basic_filter_languages
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
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...
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 ranges to filter with, in priority order. The language ran...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/structs.py#L1228-L1269
horazont/aioxmpp
aioxmpp/structs.py
lookup_language
def lookup_language(languages, ranges): """ Look up a single language in the sequence `languages` using the lookup mechansim described in RFC4647. If no match is found, :data:`None` is returned. Otherwise, the first matching language is returned. `languages` must be a sequence of :class:`LanguageTa...
python
def lookup_language(languages, ranges): """ Look up a single language in the sequence `languages` using the lookup mechansim described in RFC4647. If no match is found, :data:`None` is returned. Otherwise, the first matching language is returned. `languages` must be a sequence of :class:`LanguageTa...
Look up a single language in the sequence `languages` using the lookup mechansim described in RFC4647. If no match is found, :data:`None` is returned. Otherwise, the first matching language is returned. `languages` must be a sequence of :class:`LanguageTag` objects, while `ranges` must be an iterable o...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/structs.py#L1272-L1294
horazont/aioxmpp
aioxmpp/structs.py
JID.replace
def replace(self, **kwargs): """ Construct a new :class:`JID` object, using the values of the current JID. Use the arguments to override specific attributes on the new object. All arguments are keyword arguments. :param localpart: Set the local part of the resulting JID...
python
def replace(self, **kwargs): """ Construct a new :class:`JID` object, using the values of the current JID. Use the arguments to override specific attributes on the new object. All arguments are keyword arguments. :param localpart: Set the local part of the resulting JID...
Construct a new :class:`JID` object, using the values of the current JID. Use the arguments to override specific attributes on the new object. All arguments are keyword arguments. :param localpart: Set the local part of the resulting JID. :param domain: Set the domain of the re...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/structs.py#L689-L754
horazont/aioxmpp
aioxmpp/structs.py
JID.fromstr
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
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...
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: The parsed JID :rtype: :class:`JID` See th...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/structs.py#L792-L815
horazont/aioxmpp
aioxmpp/structs.py
LanguageRange.strip_rightmost
def strip_rightmost(self): """ Strip the rightmost part of the language range. If the new rightmost part is a singleton or ``x`` (i.e. starts an extension or private use part), it is also stripped. Return the newly created :class:`LanguageRange`. """ parts = sel...
python
def strip_rightmost(self): """ Strip the rightmost part of the language range. If the new rightmost part is a singleton or ``x`` (i.e. starts an extension or private use part), it is also stripped. Return the newly created :class:`LanguageRange`. """ parts = sel...
Strip the rightmost part of the language range. If the new rightmost part is a singleton or ``x`` (i.e. starts an extension or private use part), it is also stripped. Return the newly created :class:`LanguageRange`.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/structs.py#L1209-L1222
horazont/aioxmpp
aioxmpp/structs.py
LanguageMap.lookup
def lookup(self, language_ranges): """ Perform an RFC4647 language range lookup on the keys in the dictionary. `language_ranges` must be a sequence of :class:`LanguageRange` instances. Return the entry in the dictionary with a key as produced by `lookup_language`. If `lo...
python
def lookup(self, language_ranges): """ Perform an RFC4647 language range lookup on the keys in the dictionary. `language_ranges` must be a sequence of :class:`LanguageRange` instances. Return the entry in the dictionary with a key as produced by `lookup_language`. If `lo...
Perform an RFC4647 language range lookup on the keys in the dictionary. `language_ranges` must be a sequence of :class:`LanguageRange` instances. Return the entry in the dictionary with a key as produced by `lookup_language`. If `lookup_language` does not find a match and the ma...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/structs.py#L1310-L1328
horazont/aioxmpp
aioxmpp/im/p2p.py
Service.get_conversation
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
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...
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 (see :rfc:`6121`). :type current_jid: :class:`...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/im/p2p.py#L204-L228
horazont/aioxmpp
aioxmpp/network.py
reconfigure_resolver
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 indicating that no automatic re-configuration shall take place ...
python
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 indicating that no automatic re-configuration shall take place ...
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 indicating that no automatic re-configuration shall take place is cleared.
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/network.py#L116-L127
horazont/aioxmpp
aioxmpp/network.py
repeated_query
def repeated_query(qname, rdtype, nattempts=None, resolver=None, require_ad=False, executor=None): """ Repeatedly fire a DNS query until either the number of allowed attempts (`nattempts`) is excedeed or a non-error result is return...
python
def repeated_query(qname, rdtype, nattempts=None, resolver=None, require_ad=False, executor=None): """ Repeatedly fire a DNS query until either the number of allowed attempts (`nattempts`) is excedeed or a non-error result is return...
Repeatedly fire a DNS query until either the number of allowed attempts (`nattempts`) is excedeed or a non-error result is returned (NXDOMAIN is a non-error result). If `nattempts` is :data:`None`, it is set to 3 if `resolver` is :data:`None` and to 2 otherwise. This way, no query is made without a ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/network.py#L146-L291
horazont/aioxmpp
aioxmpp/network.py
lookup_srv
def lookup_srv( domain: bytes, service: str, transport: str = "tcp", **kwargs): """ Query the DNS for SRV records describing how the given `service` over the given `transport` is implemented for the given `domain`. `domain` must be an IDNA-encoded :class:`bytes` object; `...
python
def lookup_srv( domain: bytes, service: str, transport: str = "tcp", **kwargs): """ Query the DNS for SRV records describing how the given `service` over the given `transport` is implemented for the given `domain`. `domain` must be an IDNA-encoded :class:`bytes` object; `...
Query the DNS for SRV records describing how the given `service` over the given `transport` is implemented for the given `domain`. `domain` must be an IDNA-encoded :class:`bytes` object; `service` must be a normal :class:`str`. Keyword arguments are passed to :func:`repeated_query`. Return a list ...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/network.py#L295-L351
horazont/aioxmpp
aioxmpp/network.py
lookup_tlsa
def lookup_tlsa(hostname, port, transport="tcp", require_ad=True, **kwargs): """ Query the DNS for TLSA records describing the certificates and/or keys to expect when contacting `hostname` at the given `port` over the given `transport`. `hostname` must be an IDNA-encoded :class:`bytes` object. The ...
python
def lookup_tlsa(hostname, port, transport="tcp", require_ad=True, **kwargs): """ Query the DNS for TLSA records describing the certificates and/or keys to expect when contacting `hostname` at the given `port` over the given `transport`. `hostname` must be an IDNA-encoded :class:`bytes` object. The ...
Query the DNS for TLSA records describing the certificates and/or keys to expect when contacting `hostname` at the given `port` over the given `transport`. `hostname` must be an IDNA-encoded :class:`bytes` object. The keyword arguments are passed to :func:`repeated_query`; `require_ad` defaults to :dat...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/network.py#L355-L389
horazont/aioxmpp
aioxmpp/network.py
group_and_order_srv_records
def group_and_order_srv_records(all_records, rng=None): """ Order a list of SRV record information (as returned by :func:`lookup_srv`) and group and order them as specified by the RFC. Return an iterable, yielding each ``(hostname, port)`` tuple inside the SRV records in the order specified by the ...
python
def group_and_order_srv_records(all_records, rng=None): """ Order a list of SRV record information (as returned by :func:`lookup_srv`) and group and order them as specified by the RFC. Return an iterable, yielding each ``(hostname, port)`` tuple inside the SRV records in the order specified by the ...
Order a list of SRV record information (as returned by :func:`lookup_srv`) and group and order them as specified by the RFC. Return an iterable, yielding each ``(hostname, port)`` tuple inside the SRV records in the order specified by the RFC. For hosts with the same priority, the given `rng` implement...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/network.py#L392-L428
horazont/aioxmpp
aioxmpp/service.py
add_handler_spec
def add_handler_spec(f, handler_spec, *, kwargs=None): """ Attach a handler specification (see :class:`HandlerSpec`) to a function. :param f: Function to attach the handler specification to. :param handler_spec: Handler specification to attach to the function. :type handler_spec: :class:`HandlerSpe...
python
def add_handler_spec(f, handler_spec, *, kwargs=None): """ Attach a handler specification (see :class:`HandlerSpec`) to a function. :param f: Function to attach the handler specification to. :param handler_spec: Handler specification to attach to the function. :type handler_spec: :class:`HandlerSpe...
Attach a handler specification (see :class:`HandlerSpec`) to a function. :param f: Function to attach the handler specification to. :param handler_spec: Handler specification to attach to the function. :type handler_spec: :class:`HandlerSpec` :param kwargs: additional keyword arguments passed to the fu...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L880-L910
horazont/aioxmpp
aioxmpp/service.py
iq_handler
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
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:`~....
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:`~.XSO` subclass :param with_send_reply: Whether to pass a function to se...
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1001-L1060
horazont/aioxmpp
aioxmpp/service.py
message_handler
def message_handler(type_, from_): """ Deprecated alias of :func:`.dispatcher.message_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.message_handler(type_, from_)
python
def message_handler(type_, from_): """ Deprecated alias of :func:`.dispatcher.message_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.message_handler(type_, from_)
Deprecated alias of :func:`.dispatcher.message_handler`. .. deprecated:: 0.9
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1063-L1070
horazont/aioxmpp
aioxmpp/service.py
presence_handler
def presence_handler(type_, from_): """ Deprecated alias of :func:`.dispatcher.presence_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.presence_handler(type_, from_)
python
def presence_handler(type_, from_): """ Deprecated alias of :func:`.dispatcher.presence_handler`. .. deprecated:: 0.9 """ import aioxmpp.dispatcher return aioxmpp.dispatcher.presence_handler(type_, from_)
Deprecated alias of :func:`.dispatcher.presence_handler`. .. deprecated:: 0.9
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/service.py#L1073-L1080