partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Redis.client_pause
Suspend all the Redis clients for the specified amount of time :param timeout: milliseconds to pause clients
redis/client.py
def client_pause(self, timeout): """ Suspend all the Redis clients for the specified amount of time :param timeout: milliseconds to pause clients """ if not isinstance(timeout, (int, long)): raise DataError("CLIENT PAUSE timeout must be an integer") return sel...
def client_pause(self, timeout): """ Suspend all the Redis clients for the specified amount of time :param timeout: milliseconds to pause clients """ if not isinstance(timeout, (int, long)): raise DataError("CLIENT PAUSE timeout must be an integer") return sel...
[ "Suspend", "all", "the", "Redis", "clients", "for", "the", "specified", "amount", "of", "time", ":", "param", "timeout", ":", "milliseconds", "to", "pause", "clients" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L893-L900
[ "def", "client_pause", "(", "self", ",", "timeout", ")", ":", "if", "not", "isinstance", "(", "timeout", ",", "(", "int", ",", "long", ")", ")", ":", "raise", "DataError", "(", "\"CLIENT PAUSE timeout must be an integer\"", ")", "return", "self", ".", "execu...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.flushall
Delete all keys in all databases on the current host. ``asynchronous`` indicates whether the operation is executed asynchronously by the server.
redis/client.py
def flushall(self, asynchronous=False): """ Delete all keys in all databases on the current host. ``asynchronous`` indicates whether the operation is executed asynchronously by the server. """ args = [] if asynchronous: args.append(Token.get_token('AS...
def flushall(self, asynchronous=False): """ Delete all keys in all databases on the current host. ``asynchronous`` indicates whether the operation is executed asynchronously by the server. """ args = [] if asynchronous: args.append(Token.get_token('AS...
[ "Delete", "all", "keys", "in", "all", "databases", "on", "the", "current", "host", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L930-L940
[ "def", "flushall", "(", "self", ",", "asynchronous", "=", "False", ")", ":", "args", "=", "[", "]", "if", "asynchronous", ":", "args", ".", "append", "(", "Token", ".", "get_token", "(", "'ASYNC'", ")", ")", "return", "self", ".", "execute_command", "(...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.migrate
Migrate 1 or more keys from the current Redis server to a different server specified by the ``host``, ``port`` and ``destination_db``. The ``timeout``, specified in milliseconds, indicates the maximum time the connection between the two servers can be idle before the command is interrup...
redis/client.py
def migrate(self, host, port, keys, destination_db, timeout, copy=False, replace=False, auth=None): """ Migrate 1 or more keys from the current Redis server to a different server specified by the ``host``, ``port`` and ``destination_db``. The ``timeout``, specified in mi...
def migrate(self, host, port, keys, destination_db, timeout, copy=False, replace=False, auth=None): """ Migrate 1 or more keys from the current Redis server to a different server specified by the ``host``, ``port`` and ``destination_db``. The ``timeout``, specified in mi...
[ "Migrate", "1", "or", "more", "keys", "from", "the", "current", "Redis", "server", "to", "a", "different", "server", "specified", "by", "the", "host", "port", "and", "destination_db", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L980-L1013
[ "def", "migrate", "(", "self", ",", "host", ",", "port", ",", "keys", ",", "destination_db", ",", "timeout", ",", "copy", "=", "False", ",", "replace", "=", "False", ",", "auth", "=", "None", ")", ":", "keys", "=", "list_or_args", "(", "keys", ",", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.object
Return the encoding, idletime, or refcount about the key
redis/client.py
def object(self, infotype, key): "Return the encoding, idletime, or refcount about the key" return self.execute_command('OBJECT', infotype, key, infotype=infotype)
def object(self, infotype, key): "Return the encoding, idletime, or refcount about the key" return self.execute_command('OBJECT', infotype, key, infotype=infotype)
[ "Return", "the", "encoding", "idletime", "or", "refcount", "about", "the", "key" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1015-L1017
[ "def", "object", "(", "self", ",", "infotype", ",", "key", ")", ":", "return", "self", ".", "execute_command", "(", "'OBJECT'", ",", "infotype", ",", "key", ",", "infotype", "=", "infotype", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.memory_usage
Return the total memory usage for key, its value and associated administrative overheads. For nested data structures, ``samples`` is the number of elements to sample. If left unspecified, the server's default is 5. Use 0 to sample all elements.
redis/client.py
def memory_usage(self, key, samples=None): """ Return the total memory usage for key, its value and associated administrative overheads. For nested data structures, ``samples`` is the number of elements to sample. If left unspecified, the server's default is 5. Use 0 to sample ...
def memory_usage(self, key, samples=None): """ Return the total memory usage for key, its value and associated administrative overheads. For nested data structures, ``samples`` is the number of elements to sample. If left unspecified, the server's default is 5. Use 0 to sample ...
[ "Return", "the", "total", "memory", "usage", "for", "key", "its", "value", "and", "associated", "administrative", "overheads", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1019-L1031
[ "def", "memory_usage", "(", "self", ",", "key", ",", "samples", "=", "None", ")", ":", "args", "=", "[", "]", "if", "isinstance", "(", "samples", ",", "int", ")", ":", "args", ".", "extend", "(", "[", "Token", ".", "get_token", "(", "'SAMPLES'", ")...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.shutdown
Shutdown the Redis server. If Redis has persistence configured, data will be flushed before shutdown. If the "save" option is set, a data flush will be attempted even if there is no persistence configured. If the "nosave" option is set, no data flush will be attempted. The "save" and...
redis/client.py
def shutdown(self, save=False, nosave=False): """Shutdown the Redis server. If Redis has persistence configured, data will be flushed before shutdown. If the "save" option is set, a data flush will be attempted even if there is no persistence configured. If the "nosave" option is set,...
def shutdown(self, save=False, nosave=False): """Shutdown the Redis server. If Redis has persistence configured, data will be flushed before shutdown. If the "save" option is set, a data flush will be attempted even if there is no persistence configured. If the "nosave" option is set,...
[ "Shutdown", "the", "Redis", "server", ".", "If", "Redis", "has", "persistence", "configured", "data", "will", "be", "flushed", "before", "shutdown", ".", "If", "the", "save", "option", "is", "set", "a", "data", "flush", "will", "be", "attempted", "even", "...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1086-L1105
[ "def", "shutdown", "(", "self", ",", "save", "=", "False", ",", "nosave", "=", "False", ")", ":", "if", "save", "and", "nosave", ":", "raise", "DataError", "(", "'SHUTDOWN save and nosave cannot both be set'", ")", "args", "=", "[", "'SHUTDOWN'", "]", "if", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.slaveof
Set the server to be a replicated slave of the instance identified by the ``host`` and ``port``. If called without arguments, the instance is promoted to a master instead.
redis/client.py
def slaveof(self, host=None, port=None): """ Set the server to be a replicated slave of the instance identified by the ``host`` and ``port``. If called without arguments, the instance is promoted to a master instead. """ if host is None and port is None: retur...
def slaveof(self, host=None, port=None): """ Set the server to be a replicated slave of the instance identified by the ``host`` and ``port``. If called without arguments, the instance is promoted to a master instead. """ if host is None and port is None: retur...
[ "Set", "the", "server", "to", "be", "a", "replicated", "slave", "of", "the", "instance", "identified", "by", "the", "host", "and", "port", ".", "If", "called", "without", "arguments", "the", "instance", "is", "promoted", "to", "a", "master", "instead", "."...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1107-L1116
[ "def", "slaveof", "(", "self", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "host", "is", "None", "and", "port", "is", "None", ":", "return", "self", ".", "execute_command", "(", "'SLAVEOF'", ",", "Token", ".", "get_token", "("...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.bitop
Perform a bitwise operation using ``operation`` between ``keys`` and store the result in ``dest``.
redis/client.py
def bitop(self, operation, dest, *keys): """ Perform a bitwise operation using ``operation`` between ``keys`` and store the result in ``dest``. """ return self.execute_command('BITOP', operation, dest, *keys)
def bitop(self, operation, dest, *keys): """ Perform a bitwise operation using ``operation`` between ``keys`` and store the result in ``dest``. """ return self.execute_command('BITOP', operation, dest, *keys)
[ "Perform", "a", "bitwise", "operation", "using", "operation", "between", "keys", "and", "store", "the", "result", "in", "dest", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1182-L1187
[ "def", "bitop", "(", "self", ",", "operation", ",", "dest", ",", "*", "keys", ")", ":", "return", "self", ".", "execute_command", "(", "'BITOP'", ",", "operation", ",", "dest", ",", "*", "keys", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.bitpos
Return the position of the first bit set to 1 or 0 in a string. ``start`` and ``end`` difines search range. The range is interpreted as a range of bytes and not a range of bits, so start=0 and end=2 means to look at the first three bytes.
redis/client.py
def bitpos(self, key, bit, start=None, end=None): """ Return the position of the first bit set to 1 or 0 in a string. ``start`` and ``end`` difines search range. The range is interpreted as a range of bytes and not a range of bits, so start=0 and end=2 means to look at the first ...
def bitpos(self, key, bit, start=None, end=None): """ Return the position of the first bit set to 1 or 0 in a string. ``start`` and ``end`` difines search range. The range is interpreted as a range of bytes and not a range of bits, so start=0 and end=2 means to look at the first ...
[ "Return", "the", "position", "of", "the", "first", "bit", "set", "to", "1", "or", "0", "in", "a", "string", ".", "start", "and", "end", "difines", "search", "range", ".", "The", "range", "is", "interpreted", "as", "a", "range", "of", "bytes", "and", ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1189-L1207
[ "def", "bitpos", "(", "self", ",", "key", ",", "bit", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "if", "bit", "not", "in", "(", "0", ",", "1", ")", ":", "raise", "DataError", "(", "'bit must be 0 or 1'", ")", "params", "=", "["...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.expireat
Set an expire flag on key ``name``. ``when`` can be represented as an integer indicating unix time or a Python datetime object.
redis/client.py
def expireat(self, name, when): """ Set an expire flag on key ``name``. ``when`` can be represented as an integer indicating unix time or a Python datetime object. """ if isinstance(when, datetime.datetime): when = int(mod_time.mktime(when.timetuple())) return...
def expireat(self, name, when): """ Set an expire flag on key ``name``. ``when`` can be represented as an integer indicating unix time or a Python datetime object. """ if isinstance(when, datetime.datetime): when = int(mod_time.mktime(when.timetuple())) return...
[ "Set", "an", "expire", "flag", "on", "key", "name", ".", "when", "can", "be", "represented", "as", "an", "integer", "indicating", "unix", "time", "or", "a", "Python", "datetime", "object", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1253-L1260
[ "def", "expireat", "(", "self", ",", "name", ",", "when", ")", ":", "if", "isinstance", "(", "when", ",", "datetime", ".", "datetime", ")", ":", "when", "=", "int", "(", "mod_time", ".", "mktime", "(", "when", ".", "timetuple", "(", ")", ")", ")", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.mget
Returns a list of values ordered identically to ``keys``
redis/client.py
def mget(self, keys, *args): """ Returns a list of values ordered identically to ``keys`` """ args = list_or_args(keys, args) options = {} if not args: options[EMPTY_RESPONSE] = [] return self.execute_command('MGET', *args, **options)
def mget(self, keys, *args): """ Returns a list of values ordered identically to ``keys`` """ args = list_or_args(keys, args) options = {} if not args: options[EMPTY_RESPONSE] = [] return self.execute_command('MGET', *args, **options)
[ "Returns", "a", "list", "of", "values", "ordered", "identically", "to", "keys" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1323-L1331
[ "def", "mget", "(", "self", ",", "keys", ",", "*", "args", ")", ":", "args", "=", "list_or_args", "(", "keys", ",", "args", ")", "options", "=", "{", "}", "if", "not", "args", ":", "options", "[", "EMPTY_RESPONSE", "]", "=", "[", "]", "return", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.mset
Sets key/values based on a mapping. Mapping is a dictionary of key/value pairs. Both keys and values should be strings or types that can be cast to a string via str().
redis/client.py
def mset(self, mapping): """ Sets key/values based on a mapping. Mapping is a dictionary of key/value pairs. Both keys and values should be strings or types that can be cast to a string via str(). """ items = [] for pair in iteritems(mapping): items.ex...
def mset(self, mapping): """ Sets key/values based on a mapping. Mapping is a dictionary of key/value pairs. Both keys and values should be strings or types that can be cast to a string via str(). """ items = [] for pair in iteritems(mapping): items.ex...
[ "Sets", "key", "/", "values", "based", "on", "a", "mapping", ".", "Mapping", "is", "a", "dictionary", "of", "key", "/", "value", "pairs", ".", "Both", "keys", "and", "values", "should", "be", "strings", "or", "types", "that", "can", "be", "cast", "to",...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1333-L1342
[ "def", "mset", "(", "self", ",", "mapping", ")", ":", "items", "=", "[", "]", "for", "pair", "in", "iteritems", "(", "mapping", ")", ":", "items", ".", "extend", "(", "pair", ")", "return", "self", ".", "execute_command", "(", "'MSET'", ",", "*", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.msetnx
Sets key/values based on a mapping if none of the keys are already set. Mapping is a dictionary of key/value pairs. Both keys and values should be strings or types that can be cast to a string via str(). Returns a boolean indicating if the operation was successful.
redis/client.py
def msetnx(self, mapping): """ Sets key/values based on a mapping if none of the keys are already set. Mapping is a dictionary of key/value pairs. Both keys and values should be strings or types that can be cast to a string via str(). Returns a boolean indicating if the operation...
def msetnx(self, mapping): """ Sets key/values based on a mapping if none of the keys are already set. Mapping is a dictionary of key/value pairs. Both keys and values should be strings or types that can be cast to a string via str(). Returns a boolean indicating if the operation...
[ "Sets", "key", "/", "values", "based", "on", "a", "mapping", "if", "none", "of", "the", "keys", "are", "already", "set", ".", "Mapping", "is", "a", "dictionary", "of", "key", "/", "value", "pairs", ".", "Both", "keys", "and", "values", "should", "be", ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1344-L1354
[ "def", "msetnx", "(", "self", ",", "mapping", ")", ":", "items", "=", "[", "]", "for", "pair", "in", "iteritems", "(", "mapping", ")", ":", "items", ".", "extend", "(", "pair", ")", "return", "self", ".", "execute_command", "(", "'MSETNX'", ",", "*",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.pexpire
Set an expire flag on key ``name`` for ``time`` milliseconds. ``time`` can be represented by an integer or a Python timedelta object.
redis/client.py
def pexpire(self, name, time): """ Set an expire flag on key ``name`` for ``time`` milliseconds. ``time`` can be represented by an integer or a Python timedelta object. """ if isinstance(time, datetime.timedelta): time = int(time.total_seconds() * 1000) ...
def pexpire(self, name, time): """ Set an expire flag on key ``name`` for ``time`` milliseconds. ``time`` can be represented by an integer or a Python timedelta object. """ if isinstance(time, datetime.timedelta): time = int(time.total_seconds() * 1000) ...
[ "Set", "an", "expire", "flag", "on", "key", "name", "for", "time", "milliseconds", ".", "time", "can", "be", "represented", "by", "an", "integer", "or", "a", "Python", "timedelta", "object", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1364-L1372
[ "def", "pexpire", "(", "self", ",", "name", ",", "time", ")", ":", "if", "isinstance", "(", "time", ",", "datetime", ".", "timedelta", ")", ":", "time", "=", "int", "(", "time", ".", "total_seconds", "(", ")", "*", "1000", ")", "return", "self", "....
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.pexpireat
Set an expire flag on key ``name``. ``when`` can be represented as an integer representing unix time in milliseconds (unix time * 1000) or a Python datetime object.
redis/client.py
def pexpireat(self, name, when): """ Set an expire flag on key ``name``. ``when`` can be represented as an integer representing unix time in milliseconds (unix time * 1000) or a Python datetime object. """ if isinstance(when, datetime.datetime): ms = int(when....
def pexpireat(self, name, when): """ Set an expire flag on key ``name``. ``when`` can be represented as an integer representing unix time in milliseconds (unix time * 1000) or a Python datetime object. """ if isinstance(when, datetime.datetime): ms = int(when....
[ "Set", "an", "expire", "flag", "on", "key", "name", ".", "when", "can", "be", "represented", "as", "an", "integer", "representing", "unix", "time", "in", "milliseconds", "(", "unix", "time", "*", "1000", ")", "or", "a", "Python", "datetime", "object", "....
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1374-L1383
[ "def", "pexpireat", "(", "self", ",", "name", ",", "when", ")", ":", "if", "isinstance", "(", "when", ",", "datetime", ".", "datetime", ")", ":", "ms", "=", "int", "(", "when", ".", "microsecond", "/", "1000", ")", "when", "=", "int", "(", "mod_tim...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.psetex
Set the value of key ``name`` to ``value`` that expires in ``time_ms`` milliseconds. ``time_ms`` can be represented by an integer or a Python timedelta object
redis/client.py
def psetex(self, name, time_ms, value): """ Set the value of key ``name`` to ``value`` that expires in ``time_ms`` milliseconds. ``time_ms`` can be represented by an integer or a Python timedelta object """ if isinstance(time_ms, datetime.timedelta): time_ms =...
def psetex(self, name, time_ms, value): """ Set the value of key ``name`` to ``value`` that expires in ``time_ms`` milliseconds. ``time_ms`` can be represented by an integer or a Python timedelta object """ if isinstance(time_ms, datetime.timedelta): time_ms =...
[ "Set", "the", "value", "of", "key", "name", "to", "value", "that", "expires", "in", "time_ms", "milliseconds", ".", "time_ms", "can", "be", "represented", "by", "an", "integer", "or", "a", "Python", "timedelta", "object" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1385-L1393
[ "def", "psetex", "(", "self", ",", "name", ",", "time_ms", ",", "value", ")", ":", "if", "isinstance", "(", "time_ms", ",", "datetime", ".", "timedelta", ")", ":", "time_ms", "=", "int", "(", "time_ms", ".", "total_seconds", "(", ")", "*", "1000", ")...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.restore
Create a key using the provided serialized value, previously obtained using DUMP.
redis/client.py
def restore(self, name, ttl, value, replace=False): """ Create a key using the provided serialized value, previously obtained using DUMP. """ params = [name, ttl, value] if replace: params.append('REPLACE') return self.execute_command('RESTORE', *param...
def restore(self, name, ttl, value, replace=False): """ Create a key using the provided serialized value, previously obtained using DUMP. """ params = [name, ttl, value] if replace: params.append('REPLACE') return self.execute_command('RESTORE', *param...
[ "Create", "a", "key", "using", "the", "provided", "serialized", "value", "previously", "obtained", "using", "DUMP", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1413-L1421
[ "def", "restore", "(", "self", ",", "name", ",", "ttl", ",", "value", ",", "replace", "=", "False", ")", ":", "params", "=", "[", "name", ",", "ttl", ",", "value", "]", "if", "replace", ":", "params", ".", "append", "(", "'REPLACE'", ")", "return",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.set
Set the value at key ``name`` to ``value`` ``ex`` sets an expire flag on key ``name`` for ``ex`` seconds. ``px`` sets an expire flag on key ``name`` for ``px`` milliseconds. ``nx`` if set to True, set the value at key ``name`` to ``value`` only if it does not exist. ``xx`...
redis/client.py
def set(self, name, value, ex=None, px=None, nx=False, xx=False): """ Set the value at key ``name`` to ``value`` ``ex`` sets an expire flag on key ``name`` for ``ex`` seconds. ``px`` sets an expire flag on key ``name`` for ``px`` milliseconds. ``nx`` if set to True, set the va...
def set(self, name, value, ex=None, px=None, nx=False, xx=False): """ Set the value at key ``name`` to ``value`` ``ex`` sets an expire flag on key ``name`` for ``ex`` seconds. ``px`` sets an expire flag on key ``name`` for ``px`` milliseconds. ``nx`` if set to True, set the va...
[ "Set", "the", "value", "at", "key", "name", "to", "value" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1423-L1453
[ "def", "set", "(", "self", ",", "name", ",", "value", ",", "ex", "=", "None", ",", "px", "=", "None", ",", "nx", "=", "False", ",", "xx", "=", "False", ")", ":", "pieces", "=", "[", "name", ",", "value", "]", "if", "ex", "is", "not", "None", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.setbit
Flag the ``offset`` in ``name`` as ``value``. Returns a boolean indicating the previous value of ``offset``.
redis/client.py
def setbit(self, name, offset, value): """ Flag the ``offset`` in ``name`` as ``value``. Returns a boolean indicating the previous value of ``offset``. """ value = value and 1 or 0 return self.execute_command('SETBIT', name, offset, value)
def setbit(self, name, offset, value): """ Flag the ``offset`` in ``name`` as ``value``. Returns a boolean indicating the previous value of ``offset``. """ value = value and 1 or 0 return self.execute_command('SETBIT', name, offset, value)
[ "Flag", "the", "offset", "in", "name", "as", "value", ".", "Returns", "a", "boolean", "indicating", "the", "previous", "value", "of", "offset", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1458-L1464
[ "def", "setbit", "(", "self", ",", "name", ",", "offset", ",", "value", ")", ":", "value", "=", "value", "and", "1", "or", "0", "return", "self", ".", "execute_command", "(", "'SETBIT'", ",", "name", ",", "offset", ",", "value", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.setex
Set the value of key ``name`` to ``value`` that expires in ``time`` seconds. ``time`` can be represented by an integer or a Python timedelta object.
redis/client.py
def setex(self, name, time, value): """ Set the value of key ``name`` to ``value`` that expires in ``time`` seconds. ``time`` can be represented by an integer or a Python timedelta object. """ if isinstance(time, datetime.timedelta): time = int(time.total_seco...
def setex(self, name, time, value): """ Set the value of key ``name`` to ``value`` that expires in ``time`` seconds. ``time`` can be represented by an integer or a Python timedelta object. """ if isinstance(time, datetime.timedelta): time = int(time.total_seco...
[ "Set", "the", "value", "of", "key", "name", "to", "value", "that", "expires", "in", "time", "seconds", ".", "time", "can", "be", "represented", "by", "an", "integer", "or", "a", "Python", "timedelta", "object", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1466-L1474
[ "def", "setex", "(", "self", ",", "name", ",", "time", ",", "value", ")", ":", "if", "isinstance", "(", "time", ",", "datetime", ".", "timedelta", ")", ":", "time", "=", "int", "(", "time", ".", "total_seconds", "(", ")", ")", "return", "self", "."...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.setrange
Overwrite bytes in the value of ``name`` starting at ``offset`` with ``value``. If ``offset`` plus the length of ``value`` exceeds the length of the original value, the new value will be larger than before. If ``offset`` exceeds the length of the original value, null bytes will be used t...
redis/client.py
def setrange(self, name, offset, value): """ Overwrite bytes in the value of ``name`` starting at ``offset`` with ``value``. If ``offset`` plus the length of ``value`` exceeds the length of the original value, the new value will be larger than before. If ``offset`` exceeds the le...
def setrange(self, name, offset, value): """ Overwrite bytes in the value of ``name`` starting at ``offset`` with ``value``. If ``offset`` plus the length of ``value`` exceeds the length of the original value, the new value will be larger than before. If ``offset`` exceeds the le...
[ "Overwrite", "bytes", "in", "the", "value", "of", "name", "starting", "at", "offset", "with", "value", ".", "If", "offset", "plus", "the", "length", "of", "value", "exceeds", "the", "length", "of", "the", "original", "value", "the", "new", "value", "will",...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1480-L1491
[ "def", "setrange", "(", "self", ",", "name", ",", "offset", ",", "value", ")", ":", "return", "self", ".", "execute_command", "(", "'SETRANGE'", ",", "name", ",", "offset", ",", "value", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.blpop
LPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to LPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeout is 0, then block indefinitely.
redis/client.py
def blpop(self, keys, timeout=0): """ LPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to LPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeo...
def blpop(self, keys, timeout=0): """ LPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to LPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeo...
[ "LPOP", "a", "value", "off", "of", "the", "first", "non", "-", "empty", "list", "named", "in", "the", "keys", "list", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1537-L1552
[ "def", "blpop", "(", "self", ",", "keys", ",", "timeout", "=", "0", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "0", "keys", "=", "list_or_args", "(", "keys", ",", "None", ")", "keys", ".", "append", "(", "timeout", ")", "return",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.brpop
RPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to RPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeout is 0, then block indefinitely.
redis/client.py
def brpop(self, keys, timeout=0): """ RPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to RPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeo...
def brpop(self, keys, timeout=0): """ RPOP a value off of the first non-empty list named in the ``keys`` list. If none of the lists in ``keys`` has a value to RPOP, then block for ``timeout`` seconds, or until a value gets pushed on to one of the lists. If timeo...
[ "RPOP", "a", "value", "off", "of", "the", "first", "non", "-", "empty", "list", "named", "in", "the", "keys", "list", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1554-L1569
[ "def", "brpop", "(", "self", ",", "keys", ",", "timeout", "=", "0", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "0", "keys", "=", "list_or_args", "(", "keys", ",", "None", ")", "keys", ".", "append", "(", "timeout", ")", "return",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.lrange
Return a slice of the list ``name`` between position ``start`` and ``end`` ``start`` and ``end`` can be negative numbers just like Python slicing notation
redis/client.py
def lrange(self, name, start, end): """ Return a slice of the list ``name`` between position ``start`` and ``end`` ``start`` and ``end`` can be negative numbers just like Python slicing notation """ return self.execute_command('LRANGE', name, start, end)
def lrange(self, name, start, end): """ Return a slice of the list ``name`` between position ``start`` and ``end`` ``start`` and ``end`` can be negative numbers just like Python slicing notation """ return self.execute_command('LRANGE', name, start, end)
[ "Return", "a", "slice", "of", "the", "list", "name", "between", "position", "start", "and", "end" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1619-L1627
[ "def", "lrange", "(", "self", ",", "name", ",", "start", ",", "end", ")", ":", "return", "self", ".", "execute_command", "(", "'LRANGE'", ",", "name", ",", "start", ",", "end", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.lrem
Remove the first ``count`` occurrences of elements equal to ``value`` from the list stored at ``name``. The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to tail. count < 0: Remove elements equal to valu...
redis/client.py
def lrem(self, name, count, value): """ Remove the first ``count`` occurrences of elements equal to ``value`` from the list stored at ``name``. The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to ta...
def lrem(self, name, count, value): """ Remove the first ``count`` occurrences of elements equal to ``value`` from the list stored at ``name``. The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to ta...
[ "Remove", "the", "first", "count", "occurrences", "of", "elements", "equal", "to", "value", "from", "the", "list", "stored", "at", "name", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1629-L1639
[ "def", "lrem", "(", "self", ",", "name", ",", "count", ",", "value", ")", ":", "return", "self", ".", "execute_command", "(", "'LREM'", ",", "name", ",", "count", ",", "value", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.lset
Set ``position`` of list ``name`` to ``value``
redis/client.py
def lset(self, name, index, value): "Set ``position`` of list ``name`` to ``value``" return self.execute_command('LSET', name, index, value)
def lset(self, name, index, value): "Set ``position`` of list ``name`` to ``value``" return self.execute_command('LSET', name, index, value)
[ "Set", "position", "of", "list", "name", "to", "value" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1641-L1643
[ "def", "lset", "(", "self", ",", "name", ",", "index", ",", "value", ")", ":", "return", "self", ".", "execute_command", "(", "'LSET'", ",", "name", ",", "index", ",", "value", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.sort
Sort and return the list, set or sorted set at ``name``. ``start`` and ``num`` allow for paging through the sorted data ``by`` allows using an external key to weight and sort the items. Use an "*" to indicate where in the key the item value is located ``get`` allows for returning ...
redis/client.py
def sort(self, name, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False): """ Sort and return the list, set or sorted set at ``name``. ``start`` and ``num`` allow for paging through the sorted data ``by`` allows using an external key...
def sort(self, name, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False): """ Sort and return the list, set or sorted set at ``name``. ``start`` and ``num`` allow for paging through the sorted data ``by`` allows using an external key...
[ "Sort", "and", "return", "the", "list", "set", "or", "sorted", "set", "at", "name", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1674-L1739
[ "def", "sort", "(", "self", ",", "name", ",", "start", "=", "None", ",", "num", "=", "None", ",", "by", "=", "None", ",", "get", "=", "None", ",", "desc", "=", "False", ",", "alpha", "=", "False", ",", "store", "=", "None", ",", "groups", "=", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.scan
Incrementally return lists of key names. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns
redis/client.py
def scan(self, cursor=0, match=None, count=None): """ Incrementally return lists of key names. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns """ piece...
def scan(self, cursor=0, match=None, count=None): """ Incrementally return lists of key names. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns """ piece...
[ "Incrementally", "return", "lists", "of", "key", "names", ".", "Also", "return", "a", "cursor", "indicating", "the", "scan", "position", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1742-L1756
[ "def", "scan", "(", "self", ",", "cursor", "=", "0", ",", "match", "=", "None", ",", "count", "=", "None", ")", ":", "pieces", "=", "[", "cursor", "]", "if", "match", "is", "not", "None", ":", "pieces", ".", "extend", "(", "[", "Token", ".", "g...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.scan_iter
Make an iterator using the SCAN command so that the client doesn't need to remember the cursor position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns
redis/client.py
def scan_iter(self, match=None, count=None): """ Make an iterator using the SCAN command so that the client doesn't need to remember the cursor position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns """ ...
def scan_iter(self, match=None, count=None): """ Make an iterator using the SCAN command so that the client doesn't need to remember the cursor position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns """ ...
[ "Make", "an", "iterator", "using", "the", "SCAN", "command", "so", "that", "the", "client", "doesn", "t", "need", "to", "remember", "the", "cursor", "position", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1758-L1771
[ "def", "scan_iter", "(", "self", ",", "match", "=", "None", ",", "count", "=", "None", ")", ":", "cursor", "=", "'0'", "while", "cursor", "!=", "0", ":", "cursor", ",", "data", "=", "self", ".", "scan", "(", "cursor", "=", "cursor", ",", "match", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.sscan
Incrementally return lists of elements in a set. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns
redis/client.py
def sscan(self, name, cursor=0, match=None, count=None): """ Incrementally return lists of elements in a set. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns ""...
def sscan(self, name, cursor=0, match=None, count=None): """ Incrementally return lists of elements in a set. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns ""...
[ "Incrementally", "return", "lists", "of", "elements", "in", "a", "set", ".", "Also", "return", "a", "cursor", "indicating", "the", "scan", "position", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1773-L1787
[ "def", "sscan", "(", "self", ",", "name", ",", "cursor", "=", "0", ",", "match", "=", "None", ",", "count", "=", "None", ")", ":", "pieces", "=", "[", "name", ",", "cursor", "]", "if", "match", "is", "not", "None", ":", "pieces", ".", "extend", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zscan
Incrementally return lists of elements in a sorted set. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for hint the minimum number of returns ``score_cast_func`` a callable used to cast the score return value
redis/client.py
def zscan(self, name, cursor=0, match=None, count=None, score_cast_func=float): """ Incrementally return lists of elements in a sorted set. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for h...
def zscan(self, name, cursor=0, match=None, count=None, score_cast_func=float): """ Incrementally return lists of elements in a sorted set. Also return a cursor indicating the scan position. ``match`` allows for filtering the keys by pattern ``count`` allows for h...
[ "Incrementally", "return", "lists", "of", "elements", "in", "a", "sorted", "set", ".", "Also", "return", "a", "cursor", "indicating", "the", "scan", "position", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1837-L1855
[ "def", "zscan", "(", "self", ",", "name", ",", "cursor", "=", "0", ",", "match", "=", "None", ",", "count", "=", "None", ",", "score_cast_func", "=", "float", ")", ":", "pieces", "=", "[", "name", ",", "cursor", "]", "if", "match", "is", "not", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.smove
Move ``value`` from set ``src`` to set ``dst`` atomically
redis/client.py
def smove(self, src, dst, value): "Move ``value`` from set ``src`` to set ``dst`` atomically" return self.execute_command('SMOVE', src, dst, value)
def smove(self, src, dst, value): "Move ``value`` from set ``src`` to set ``dst`` atomically" return self.execute_command('SMOVE', src, dst, value)
[ "Move", "value", "from", "set", "src", "to", "set", "dst", "atomically" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1920-L1922
[ "def", "smove", "(", "self", ",", "src", ",", "dst", ",", "value", ")", ":", "return", "self", ".", "execute_command", "(", "'SMOVE'", ",", "src", ",", "dst", ",", "value", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.spop
Remove and return a random member of set ``name``
redis/client.py
def spop(self, name, count=None): "Remove and return a random member of set ``name``" args = (count is not None) and [count] or [] return self.execute_command('SPOP', name, *args)
def spop(self, name, count=None): "Remove and return a random member of set ``name``" args = (count is not None) and [count] or [] return self.execute_command('SPOP', name, *args)
[ "Remove", "and", "return", "a", "random", "member", "of", "set", "name" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1924-L1927
[ "def", "spop", "(", "self", ",", "name", ",", "count", "=", "None", ")", ":", "args", "=", "(", "count", "is", "not", "None", ")", "and", "[", "count", "]", "or", "[", "]", "return", "self", ".", "execute_command", "(", "'SPOP'", ",", "name", ","...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xack
Acknowledges the successful processing of one or more messages. name: name of the stream. groupname: name of the consumer group. *ids: message ids to acknowlege.
redis/client.py
def xack(self, name, groupname, *ids): """ Acknowledges the successful processing of one or more messages. name: name of the stream. groupname: name of the consumer group. *ids: message ids to acknowlege. """ return self.execute_command('XACK', name, groupname, *i...
def xack(self, name, groupname, *ids): """ Acknowledges the successful processing of one or more messages. name: name of the stream. groupname: name of the consumer group. *ids: message ids to acknowlege. """ return self.execute_command('XACK', name, groupname, *i...
[ "Acknowledges", "the", "successful", "processing", "of", "one", "or", "more", "messages", ".", "name", ":", "name", "of", "the", "stream", ".", "groupname", ":", "name", "of", "the", "consumer", "group", ".", "*", "ids", ":", "message", "ids", "to", "ack...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1958-L1965
[ "def", "xack", "(", "self", ",", "name", ",", "groupname", ",", "*", "ids", ")", ":", "return", "self", ".", "execute_command", "(", "'XACK'", ",", "name", ",", "groupname", ",", "*", "ids", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xadd
Add to a stream. name: name of the stream fields: dict of field/value pairs to insert into the stream id: Location to insert this record. By default it is appended. maxlen: truncate old stream members beyond this size approximate: actual stream length may be slightly more than ma...
redis/client.py
def xadd(self, name, fields, id='*', maxlen=None, approximate=True): """ Add to a stream. name: name of the stream fields: dict of field/value pairs to insert into the stream id: Location to insert this record. By default it is appended. maxlen: truncate old stream member...
def xadd(self, name, fields, id='*', maxlen=None, approximate=True): """ Add to a stream. name: name of the stream fields: dict of field/value pairs to insert into the stream id: Location to insert this record. By default it is appended. maxlen: truncate old stream member...
[ "Add", "to", "a", "stream", ".", "name", ":", "name", "of", "the", "stream", "fields", ":", "dict", "of", "field", "/", "value", "pairs", "to", "insert", "into", "the", "stream", "id", ":", "Location", "to", "insert", "this", "record", ".", "By", "de...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1967-L1990
[ "def", "xadd", "(", "self", ",", "name", ",", "fields", ",", "id", "=", "'*'", ",", "maxlen", "=", "None", ",", "approximate", "=", "True", ")", ":", "pieces", "=", "[", "]", "if", "maxlen", "is", "not", "None", ":", "if", "not", "isinstance", "(...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xclaim
Changes the ownership of a pending message. name: name of the stream. groupname: name of the consumer group. consumername: name of a consumer that claims the message. min_idle_time: filter messages that were idle less than this amount of milliseconds message_ids: non-empt...
redis/client.py
def xclaim(self, name, groupname, consumername, min_idle_time, message_ids, idle=None, time=None, retrycount=None, force=False, justid=False): """ Changes the ownership of a pending message. name: name of the stream. groupname: name of the consumer group. ...
def xclaim(self, name, groupname, consumername, min_idle_time, message_ids, idle=None, time=None, retrycount=None, force=False, justid=False): """ Changes the ownership of a pending message. name: name of the stream. groupname: name of the consumer group. ...
[ "Changes", "the", "ownership", "of", "a", "pending", "message", ".", "name", ":", "name", "of", "the", "stream", ".", "groupname", ":", "name", "of", "the", "consumer", "group", ".", "consumername", ":", "name", "of", "a", "consumer", "that", "claims", "...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1992-L2050
[ "def", "xclaim", "(", "self", ",", "name", ",", "groupname", ",", "consumername", ",", "min_idle_time", ",", "message_ids", ",", "idle", "=", "None", ",", "time", "=", "None", ",", "retrycount", "=", "None", ",", "force", "=", "False", ",", "justid", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xgroup_create
Create a new consumer group associated with a stream. name: name of the stream. groupname: name of the consumer group. id: ID of the last item in the stream to consider already delivered.
redis/client.py
def xgroup_create(self, name, groupname, id='$', mkstream=False): """ Create a new consumer group associated with a stream. name: name of the stream. groupname: name of the consumer group. id: ID of the last item in the stream to consider already delivered. """ pi...
def xgroup_create(self, name, groupname, id='$', mkstream=False): """ Create a new consumer group associated with a stream. name: name of the stream. groupname: name of the consumer group. id: ID of the last item in the stream to consider already delivered. """ pi...
[ "Create", "a", "new", "consumer", "group", "associated", "with", "a", "stream", ".", "name", ":", "name", "of", "the", "stream", ".", "groupname", ":", "name", "of", "the", "consumer", "group", ".", "id", ":", "ID", "of", "the", "last", "item", "in", ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2060-L2070
[ "def", "xgroup_create", "(", "self", ",", "name", ",", "groupname", ",", "id", "=", "'$'", ",", "mkstream", "=", "False", ")", ":", "pieces", "=", "[", "'XGROUP CREATE'", ",", "name", ",", "groupname", ",", "id", "]", "if", "mkstream", ":", "pieces", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xgroup_delconsumer
Remove a specific consumer from a consumer group. Returns the number of pending messages that the consumer had before it was deleted. name: name of the stream. groupname: name of the consumer group. consumername: name of consumer to delete
redis/client.py
def xgroup_delconsumer(self, name, groupname, consumername): """ Remove a specific consumer from a consumer group. Returns the number of pending messages that the consumer had before it was deleted. name: name of the stream. groupname: name of the consumer group. ...
def xgroup_delconsumer(self, name, groupname, consumername): """ Remove a specific consumer from a consumer group. Returns the number of pending messages that the consumer had before it was deleted. name: name of the stream. groupname: name of the consumer group. ...
[ "Remove", "a", "specific", "consumer", "from", "a", "consumer", "group", ".", "Returns", "the", "number", "of", "pending", "messages", "that", "the", "consumer", "had", "before", "it", "was", "deleted", ".", "name", ":", "name", "of", "the", "stream", ".",...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2072-L2082
[ "def", "xgroup_delconsumer", "(", "self", ",", "name", ",", "groupname", ",", "consumername", ")", ":", "return", "self", ".", "execute_command", "(", "'XGROUP DELCONSUMER'", ",", "name", ",", "groupname", ",", "consumername", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xgroup_setid
Set the consumer group last delivered ID to something else. name: name of the stream. groupname: name of the consumer group. id: ID of the last item in the stream to consider already delivered.
redis/client.py
def xgroup_setid(self, name, groupname, id): """ Set the consumer group last delivered ID to something else. name: name of the stream. groupname: name of the consumer group. id: ID of the last item in the stream to consider already delivered. """ return self.execu...
def xgroup_setid(self, name, groupname, id): """ Set the consumer group last delivered ID to something else. name: name of the stream. groupname: name of the consumer group. id: ID of the last item in the stream to consider already delivered. """ return self.execu...
[ "Set", "the", "consumer", "group", "last", "delivered", "ID", "to", "something", "else", ".", "name", ":", "name", "of", "the", "stream", ".", "groupname", ":", "name", "of", "the", "consumer", "group", ".", "id", ":", "ID", "of", "the", "last", "item"...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2092-L2099
[ "def", "xgroup_setid", "(", "self", ",", "name", ",", "groupname", ",", "id", ")", ":", "return", "self", ".", "execute_command", "(", "'XGROUP SETID'", ",", "name", ",", "groupname", ",", "id", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xpending_range
Returns information about pending messages, in a range. name: name of the stream. groupname: name of the consumer group. min: minimum stream ID. max: maximum stream ID. count: number of messages to return consumername: name of a consumer to filter by (optional).
redis/client.py
def xpending_range(self, name, groupname, min, max, count, consumername=None): """ Returns information about pending messages, in a range. name: name of the stream. groupname: name of the consumer group. min: minimum stream ID. max: maximum stream I...
def xpending_range(self, name, groupname, min, max, count, consumername=None): """ Returns information about pending messages, in a range. name: name of the stream. groupname: name of the consumer group. min: minimum stream ID. max: maximum stream I...
[ "Returns", "information", "about", "pending", "messages", "in", "a", "range", ".", "name", ":", "name", "of", "the", "stream", ".", "groupname", ":", "name", "of", "the", "consumer", "group", ".", "min", ":", "minimum", "stream", "ID", ".", "max", ":", ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2137-L2162
[ "def", "xpending_range", "(", "self", ",", "name", ",", "groupname", ",", "min", ",", "max", ",", "count", ",", "consumername", "=", "None", ")", ":", "pieces", "=", "[", "name", ",", "groupname", "]", "if", "min", "is", "not", "None", "or", "max", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xrange
Read stream values within an interval. name: name of the stream. start: first stream ID. defaults to '-', meaning the earliest available. finish: last stream ID. defaults to '+', meaning the latest available. count: if set, only return this many items, begi...
redis/client.py
def xrange(self, name, min='-', max='+', count=None): """ Read stream values within an interval. name: name of the stream. start: first stream ID. defaults to '-', meaning the earliest available. finish: last stream ID. defaults to '+', meaning the ...
def xrange(self, name, min='-', max='+', count=None): """ Read stream values within an interval. name: name of the stream. start: first stream ID. defaults to '-', meaning the earliest available. finish: last stream ID. defaults to '+', meaning the ...
[ "Read", "stream", "values", "within", "an", "interval", ".", "name", ":", "name", "of", "the", "stream", ".", "start", ":", "first", "stream", "ID", ".", "defaults", "to", "-", "meaning", "the", "earliest", "available", ".", "finish", ":", "last", "strea...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2164-L2182
[ "def", "xrange", "(", "self", ",", "name", ",", "min", "=", "'-'", ",", "max", "=", "'+'", ",", "count", "=", "None", ")", ":", "pieces", "=", "[", "min", ",", "max", "]", "if", "count", "is", "not", "None", ":", "if", "not", "isinstance", "(",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xread
Block and monitor multiple streams for new data. streams: a dict of stream names to stream IDs, where IDs indicate the last ID already seen. count: if set, only return this many items, beginning with the earliest available. block: number of milliseconds to wait,...
redis/client.py
def xread(self, streams, count=None, block=None): """ Block and monitor multiple streams for new data. streams: a dict of stream names to stream IDs, where IDs indicate the last ID already seen. count: if set, only return this many items, beginning with the ...
def xread(self, streams, count=None, block=None): """ Block and monitor multiple streams for new data. streams: a dict of stream names to stream IDs, where IDs indicate the last ID already seen. count: if set, only return this many items, beginning with the ...
[ "Block", "and", "monitor", "multiple", "streams", "for", "new", "data", ".", "streams", ":", "a", "dict", "of", "stream", "names", "to", "stream", "IDs", "where", "IDs", "indicate", "the", "last", "ID", "already", "seen", ".", "count", ":", "if", "set", ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2184-L2210
[ "def", "xread", "(", "self", ",", "streams", ",", "count", "=", "None", ",", "block", "=", "None", ")", ":", "pieces", "=", "[", "]", "if", "block", "is", "not", "None", ":", "if", "not", "isinstance", "(", "block", ",", "(", "int", ",", "long", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xreadgroup
Read from a stream via a consumer group. groupname: name of the consumer group. consumername: name of the requesting consumer. streams: a dict of stream names to stream IDs, where IDs indicate the last ID already seen. count: if set, only return this many items, beginning ...
redis/client.py
def xreadgroup(self, groupname, consumername, streams, count=None, block=None, noack=False): """ Read from a stream via a consumer group. groupname: name of the consumer group. consumername: name of the requesting consumer. streams: a dict of stream names to st...
def xreadgroup(self, groupname, consumername, streams, count=None, block=None, noack=False): """ Read from a stream via a consumer group. groupname: name of the consumer group. consumername: name of the requesting consumer. streams: a dict of stream names to st...
[ "Read", "from", "a", "stream", "via", "a", "consumer", "group", ".", "groupname", ":", "name", "of", "the", "consumer", "group", ".", "consumername", ":", "name", "of", "the", "requesting", "consumer", ".", "streams", ":", "a", "dict", "of", "stream", "n...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2212-L2244
[ "def", "xreadgroup", "(", "self", ",", "groupname", ",", "consumername", ",", "streams", ",", "count", "=", "None", ",", "block", "=", "None", ",", "noack", "=", "False", ")", ":", "pieces", "=", "[", "Token", ".", "get_token", "(", "'GROUP'", ")", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.xtrim
Trims old messages from a stream. name: name of the stream. maxlen: truncate old stream messages beyond this size approximate: actual stream length may be slightly more than maxlen
redis/client.py
def xtrim(self, name, maxlen, approximate=True): """ Trims old messages from a stream. name: name of the stream. maxlen: truncate old stream messages beyond this size approximate: actual stream length may be slightly more than maxlen """ pieces = [Token.get_token(...
def xtrim(self, name, maxlen, approximate=True): """ Trims old messages from a stream. name: name of the stream. maxlen: truncate old stream messages beyond this size approximate: actual stream length may be slightly more than maxlen """ pieces = [Token.get_token(...
[ "Trims", "old", "messages", "from", "a", "stream", ".", "name", ":", "name", "of", "the", "stream", ".", "maxlen", ":", "truncate", "old", "stream", "messages", "beyond", "this", "size", "approximate", ":", "actual", "stream", "length", "may", "be", "sligh...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2266-L2277
[ "def", "xtrim", "(", "self", ",", "name", ",", "maxlen", ",", "approximate", "=", "True", ")", ":", "pieces", "=", "[", "Token", ".", "get_token", "(", "'MAXLEN'", ")", "]", "if", "approximate", ":", "pieces", ".", "append", "(", "Token", ".", "get_t...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zadd
Set any number of element-name, score pairs to the key ``name``. Pairs are specified as a dict of element-names keys to score values. ``nx`` forces ZADD to only create new elements and not to update scores for elements that already exist. ``xx`` forces ZADD to only update scores of ele...
redis/client.py
def zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False): """ Set any number of element-name, score pairs to the key ``name``. Pairs are specified as a dict of element-names keys to score values. ``nx`` forces ZADD to only create new elements and not to update sco...
def zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False): """ Set any number of element-name, score pairs to the key ``name``. Pairs are specified as a dict of element-names keys to score values. ``nx`` forces ZADD to only create new elements and not to update sco...
[ "Set", "any", "number", "of", "element", "-", "name", "score", "pairs", "to", "the", "key", "name", ".", "Pairs", "are", "specified", "as", "a", "dict", "of", "element", "-", "names", "keys", "to", "score", "values", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2280-L2325
[ "def", "zadd", "(", "self", ",", "name", ",", "mapping", ",", "nx", "=", "False", ",", "xx", "=", "False", ",", "ch", "=", "False", ",", "incr", "=", "False", ")", ":", "if", "not", "mapping", ":", "raise", "DataError", "(", "\"ZADD requires at least...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zcount
Returns the number of elements in the sorted set at key ``name`` with a score between ``min`` and ``max``.
redis/client.py
def zcount(self, name, min, max): """ Returns the number of elements in the sorted set at key ``name`` with a score between ``min`` and ``max``. """ return self.execute_command('ZCOUNT', name, min, max)
def zcount(self, name, min, max): """ Returns the number of elements in the sorted set at key ``name`` with a score between ``min`` and ``max``. """ return self.execute_command('ZCOUNT', name, min, max)
[ "Returns", "the", "number", "of", "elements", "in", "the", "sorted", "set", "at", "key", "name", "with", "a", "score", "between", "min", "and", "max", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2331-L2336
[ "def", "zcount", "(", "self", ",", "name", ",", "min", ",", "max", ")", ":", "return", "self", ".", "execute_command", "(", "'ZCOUNT'", ",", "name", ",", "min", ",", "max", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zincrby
Increment the score of ``value`` in sorted set ``name`` by ``amount``
redis/client.py
def zincrby(self, name, amount, value): "Increment the score of ``value`` in sorted set ``name`` by ``amount``" return self.execute_command('ZINCRBY', name, amount, value)
def zincrby(self, name, amount, value): "Increment the score of ``value`` in sorted set ``name`` by ``amount``" return self.execute_command('ZINCRBY', name, amount, value)
[ "Increment", "the", "score", "of", "value", "in", "sorted", "set", "name", "by", "amount" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2338-L2340
[ "def", "zincrby", "(", "self", ",", "name", ",", "amount", ",", "value", ")", ":", "return", "self", ".", "execute_command", "(", "'ZINCRBY'", ",", "name", ",", "amount", ",", "value", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zinterstore
Intersect multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``. Scores in the destination will be aggregated based on the ``aggregate``, or SUM if none is provided.
redis/client.py
def zinterstore(self, dest, keys, aggregate=None): """ Intersect multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``. Scores in the destination will be aggregated based on the ``aggregate``, or SUM if none is provided. """ return self._zaggregate('Z...
def zinterstore(self, dest, keys, aggregate=None): """ Intersect multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``. Scores in the destination will be aggregated based on the ``aggregate``, or SUM if none is provided. """ return self._zaggregate('Z...
[ "Intersect", "multiple", "sorted", "sets", "specified", "by", "keys", "into", "a", "new", "sorted", "set", "dest", ".", "Scores", "in", "the", "destination", "will", "be", "aggregated", "based", "on", "the", "aggregate", "or", "SUM", "if", "none", "is", "p...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2342-L2348
[ "def", "zinterstore", "(", "self", ",", "dest", ",", "keys", ",", "aggregate", "=", "None", ")", ":", "return", "self", ".", "_zaggregate", "(", "'ZINTERSTORE'", ",", "dest", ",", "keys", ",", "aggregate", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zlexcount
Return the number of items in the sorted set ``name`` between the lexicographical range ``min`` and ``max``.
redis/client.py
def zlexcount(self, name, min, max): """ Return the number of items in the sorted set ``name`` between the lexicographical range ``min`` and ``max``. """ return self.execute_command('ZLEXCOUNT', name, min, max)
def zlexcount(self, name, min, max): """ Return the number of items in the sorted set ``name`` between the lexicographical range ``min`` and ``max``. """ return self.execute_command('ZLEXCOUNT', name, min, max)
[ "Return", "the", "number", "of", "items", "in", "the", "sorted", "set", "name", "between", "the", "lexicographical", "range", "min", "and", "max", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2350-L2355
[ "def", "zlexcount", "(", "self", ",", "name", ",", "min", ",", "max", ")", ":", "return", "self", ".", "execute_command", "(", "'ZLEXCOUNT'", ",", "name", ",", "min", ",", "max", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zpopmax
Remove and return up to ``count`` members with the highest scores from the sorted set ``name``.
redis/client.py
def zpopmax(self, name, count=None): """ Remove and return up to ``count`` members with the highest scores from the sorted set ``name``. """ args = (count is not None) and [count] or [] options = { 'withscores': True } return self.execute_comma...
def zpopmax(self, name, count=None): """ Remove and return up to ``count`` members with the highest scores from the sorted set ``name``. """ args = (count is not None) and [count] or [] options = { 'withscores': True } return self.execute_comma...
[ "Remove", "and", "return", "up", "to", "count", "members", "with", "the", "highest", "scores", "from", "the", "sorted", "set", "name", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2357-L2366
[ "def", "zpopmax", "(", "self", ",", "name", ",", "count", "=", "None", ")", ":", "args", "=", "(", "count", "is", "not", "None", ")", "and", "[", "count", "]", "or", "[", "]", "options", "=", "{", "'withscores'", ":", "True", "}", "return", "self...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zpopmin
Remove and return up to ``count`` members with the lowest scores from the sorted set ``name``.
redis/client.py
def zpopmin(self, name, count=None): """ Remove and return up to ``count`` members with the lowest scores from the sorted set ``name``. """ args = (count is not None) and [count] or [] options = { 'withscores': True } return self.execute_comman...
def zpopmin(self, name, count=None): """ Remove and return up to ``count`` members with the lowest scores from the sorted set ``name``. """ args = (count is not None) and [count] or [] options = { 'withscores': True } return self.execute_comman...
[ "Remove", "and", "return", "up", "to", "count", "members", "with", "the", "lowest", "scores", "from", "the", "sorted", "set", "name", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2368-L2377
[ "def", "zpopmin", "(", "self", ",", "name", ",", "count", "=", "None", ")", ":", "args", "=", "(", "count", "is", "not", "None", ")", "and", "[", "count", "]", "or", "[", "]", "options", "=", "{", "'withscores'", ":", "True", "}", "return", "self...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.bzpopmax
ZPOPMAX a value off of the first non-empty sorted set named in the ``keys`` list. If none of the sorted sets in ``keys`` has a value to ZPOPMAX, then block for ``timeout`` seconds, or until a member gets added to one of the sorted sets. If timeout is 0, then block indefinitely.
redis/client.py
def bzpopmax(self, keys, timeout=0): """ ZPOPMAX a value off of the first non-empty sorted set named in the ``keys`` list. If none of the sorted sets in ``keys`` has a value to ZPOPMAX, then block for ``timeout`` seconds, or until a member gets added to one of the sorted...
def bzpopmax(self, keys, timeout=0): """ ZPOPMAX a value off of the first non-empty sorted set named in the ``keys`` list. If none of the sorted sets in ``keys`` has a value to ZPOPMAX, then block for ``timeout`` seconds, or until a member gets added to one of the sorted...
[ "ZPOPMAX", "a", "value", "off", "of", "the", "first", "non", "-", "empty", "sorted", "set", "named", "in", "the", "keys", "list", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2379-L2394
[ "def", "bzpopmax", "(", "self", ",", "keys", ",", "timeout", "=", "0", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "0", "keys", "=", "list_or_args", "(", "keys", ",", "None", ")", "keys", ".", "append", "(", "timeout", ")", "retur...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.bzpopmin
ZPOPMIN a value off of the first non-empty sorted set named in the ``keys`` list. If none of the sorted sets in ``keys`` has a value to ZPOPMIN, then block for ``timeout`` seconds, or until a member gets added to one of the sorted sets. If timeout is 0, then block indefinitely.
redis/client.py
def bzpopmin(self, keys, timeout=0): """ ZPOPMIN a value off of the first non-empty sorted set named in the ``keys`` list. If none of the sorted sets in ``keys`` has a value to ZPOPMIN, then block for ``timeout`` seconds, or until a member gets added to one of the sorted...
def bzpopmin(self, keys, timeout=0): """ ZPOPMIN a value off of the first non-empty sorted set named in the ``keys`` list. If none of the sorted sets in ``keys`` has a value to ZPOPMIN, then block for ``timeout`` seconds, or until a member gets added to one of the sorted...
[ "ZPOPMIN", "a", "value", "off", "of", "the", "first", "non", "-", "empty", "sorted", "set", "named", "in", "the", "keys", "list", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2396-L2411
[ "def", "bzpopmin", "(", "self", ",", "keys", ",", "timeout", "=", "0", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "0", "keys", "=", "list_or_args", "(", "keys", ",", "None", ")", "keys", ".", "append", "(", "timeout", ")", "retur...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zrangebylex
Return the lexicographical range of values from sorted set ``name`` between ``min`` and ``max``. If ``start`` and ``num`` are specified, then return a slice of the range.
redis/client.py
def zrangebylex(self, name, min, max, start=None, num=None): """ Return the lexicographical range of values from sorted set ``name`` between ``min`` and ``max``. If ``start`` and ``num`` are specified, then return a slice of the range. """ if (start is not None a...
def zrangebylex(self, name, min, max, start=None, num=None): """ Return the lexicographical range of values from sorted set ``name`` between ``min`` and ``max``. If ``start`` and ``num`` are specified, then return a slice of the range. """ if (start is not None a...
[ "Return", "the", "lexicographical", "range", "of", "values", "from", "sorted", "set", "name", "between", "min", "and", "max", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2440-L2454
[ "def", "zrangebylex", "(", "self", ",", "name", ",", "min", ",", "max", ",", "start", "=", "None", ",", "num", "=", "None", ")", ":", "if", "(", "start", "is", "not", "None", "and", "num", "is", "None", ")", "or", "(", "num", "is", "not", "None...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zremrangebylex
Remove all elements in the sorted set ``name`` between the lexicographical range specified by ``min`` and ``max``. Returns the number of elements removed.
redis/client.py
def zremrangebylex(self, name, min, max): """ Remove all elements in the sorted set ``name`` between the lexicographical range specified by ``min`` and ``max``. Returns the number of elements removed. """ return self.execute_command('ZREMRANGEBYLEX', name, min, max)
def zremrangebylex(self, name, min, max): """ Remove all elements in the sorted set ``name`` between the lexicographical range specified by ``min`` and ``max``. Returns the number of elements removed. """ return self.execute_command('ZREMRANGEBYLEX', name, min, max)
[ "Remove", "all", "elements", "in", "the", "sorted", "set", "name", "between", "the", "lexicographical", "range", "specified", "by", "min", "and", "max", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2511-L2518
[ "def", "zremrangebylex", "(", "self", ",", "name", ",", "min", ",", "max", ")", ":", "return", "self", ".", "execute_command", "(", "'ZREMRANGEBYLEX'", ",", "name", ",", "min", ",", "max", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zremrangebyrank
Remove all elements in the sorted set ``name`` with ranks between ``min`` and ``max``. Values are 0-based, ordered from smallest score to largest. Values can be negative indicating the highest scores. Returns the number of elements removed
redis/client.py
def zremrangebyrank(self, name, min, max): """ Remove all elements in the sorted set ``name`` with ranks between ``min`` and ``max``. Values are 0-based, ordered from smallest score to largest. Values can be negative indicating the highest scores. Returns the number of elements r...
def zremrangebyrank(self, name, min, max): """ Remove all elements in the sorted set ``name`` with ranks between ``min`` and ``max``. Values are 0-based, ordered from smallest score to largest. Values can be negative indicating the highest scores. Returns the number of elements r...
[ "Remove", "all", "elements", "in", "the", "sorted", "set", "name", "with", "ranks", "between", "min", "and", "max", ".", "Values", "are", "0", "-", "based", "ordered", "from", "smallest", "score", "to", "largest", ".", "Values", "can", "be", "negative", ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2520-L2527
[ "def", "zremrangebyrank", "(", "self", ",", "name", ",", "min", ",", "max", ")", ":", "return", "self", ".", "execute_command", "(", "'ZREMRANGEBYRANK'", ",", "name", ",", "min", ",", "max", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zrevrangebyscore
Return a range of values from the sorted set ``name`` with scores between ``min`` and ``max`` in descending order. If ``start`` and ``num`` are specified, then return a slice of the range. ``withscores`` indicates to return the scores along with the values. The return type is a...
redis/client.py
def zrevrangebyscore(self, name, max, min, start=None, num=None, withscores=False, score_cast_func=float): """ Return a range of values from the sorted set ``name`` with scores between ``min`` and ``max`` in descending order. If ``start`` and ``num`` are specifi...
def zrevrangebyscore(self, name, max, min, start=None, num=None, withscores=False, score_cast_func=float): """ Return a range of values from the sorted set ``name`` with scores between ``min`` and ``max`` in descending order. If ``start`` and ``num`` are specifi...
[ "Return", "a", "range", "of", "values", "from", "the", "sorted", "set", "name", "with", "scores", "between", "min", "and", "max", "in", "descending", "order", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2558-L2584
[ "def", "zrevrangebyscore", "(", "self", ",", "name", ",", "max", ",", "min", ",", "start", "=", "None", ",", "num", "=", "None", ",", "withscores", "=", "False", ",", "score_cast_func", "=", "float", ")", ":", "if", "(", "start", "is", "not", "None",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.zunionstore
Union multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``. Scores in the destination will be aggregated based on the ``aggregate``, or SUM if none is provided.
redis/client.py
def zunionstore(self, dest, keys, aggregate=None): """ Union multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``. Scores in the destination will be aggregated based on the ``aggregate``, or SUM if none is provided. """ return self._zaggregate('ZUNIO...
def zunionstore(self, dest, keys, aggregate=None): """ Union multiple sorted sets specified by ``keys`` into a new sorted set, ``dest``. Scores in the destination will be aggregated based on the ``aggregate``, or SUM if none is provided. """ return self._zaggregate('ZUNIO...
[ "Union", "multiple", "sorted", "sets", "specified", "by", "keys", "into", "a", "new", "sorted", "set", "dest", ".", "Scores", "in", "the", "destination", "will", "be", "aggregated", "based", "on", "the", "aggregate", "or", "SUM", "if", "none", "is", "provi...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2597-L2603
[ "def", "zunionstore", "(", "self", ",", "dest", ",", "keys", ",", "aggregate", "=", "None", ")", ":", "return", "self", ".", "_zaggregate", "(", "'ZUNIONSTORE'", ",", "dest", ",", "keys", ",", "aggregate", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.hmget
Returns a list of values ordered identically to ``keys``
redis/client.py
def hmget(self, name, keys, *args): "Returns a list of values ordered identically to ``keys``" args = list_or_args(keys, args) return self.execute_command('HMGET', name, *args)
def hmget(self, name, keys, *args): "Returns a list of values ordered identically to ``keys``" args = list_or_args(keys, args) return self.execute_command('HMGET', name, *args)
[ "Returns", "a", "list", "of", "values", "ordered", "identically", "to", "keys" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2697-L2700
[ "def", "hmget", "(", "self", ",", "name", ",", "keys", ",", "*", "args", ")", ":", "args", "=", "list_or_args", "(", "keys", ",", "args", ")", "return", "self", ".", "execute_command", "(", "'HMGET'", ",", "name", ",", "*", "args", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.eval
Execute the Lua ``script``, specifying the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. In practice, use the object returned by ``register_script``. This function exists purely for Redis API completion.
redis/client.py
def eval(self, script, numkeys, *keys_and_args): """ Execute the Lua ``script``, specifying the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. In practice, use the object returned by ``register_scri...
def eval(self, script, numkeys, *keys_and_args): """ Execute the Lua ``script``, specifying the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. In practice, use the object returned by ``register_scri...
[ "Execute", "the", "Lua", "script", "specifying", "the", "numkeys", "the", "script", "will", "touch", "and", "the", "key", "names", "and", "argument", "values", "in", "keys_and_args", ".", "Returns", "the", "result", "of", "the", "script", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2742-L2751
[ "def", "eval", "(", "self", ",", "script", ",", "numkeys", ",", "*", "keys_and_args", ")", ":", "return", "self", ".", "execute_command", "(", "'EVAL'", ",", "script", ",", "numkeys", ",", "*", "keys_and_args", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.evalsha
Use the ``sha`` to execute a Lua script already registered via EVAL or SCRIPT LOAD. Specify the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. In practice, use the object returned by ``register_script``. Th...
redis/client.py
def evalsha(self, sha, numkeys, *keys_and_args): """ Use the ``sha`` to execute a Lua script already registered via EVAL or SCRIPT LOAD. Specify the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. ...
def evalsha(self, sha, numkeys, *keys_and_args): """ Use the ``sha`` to execute a Lua script already registered via EVAL or SCRIPT LOAD. Specify the ``numkeys`` the script will touch and the key names and argument values in ``keys_and_args``. Returns the result of the script. ...
[ "Use", "the", "sha", "to", "execute", "a", "Lua", "script", "already", "registered", "via", "EVAL", "or", "SCRIPT", "LOAD", ".", "Specify", "the", "numkeys", "the", "script", "will", "touch", "and", "the", "key", "names", "and", "argument", "values", "in",...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2753-L2763
[ "def", "evalsha", "(", "self", ",", "sha", ",", "numkeys", ",", "*", "keys_and_args", ")", ":", "return", "self", ".", "execute_command", "(", "'EVALSHA'", ",", "sha", ",", "numkeys", ",", "*", "keys_and_args", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.geoadd
Add the specified geospatial items to the specified key identified by the ``name`` argument. The Geospatial items are given as ordered members of the ``values`` argument, each item or place is formed by the triad longitude, latitude and name.
redis/client.py
def geoadd(self, name, *values): """ Add the specified geospatial items to the specified key identified by the ``name`` argument. The Geospatial items are given as ordered members of the ``values`` argument, each item or place is formed by the triad longitude, latitude and name. ...
def geoadd(self, name, *values): """ Add the specified geospatial items to the specified key identified by the ``name`` argument. The Geospatial items are given as ordered members of the ``values`` argument, each item or place is formed by the triad longitude, latitude and name. ...
[ "Add", "the", "specified", "geospatial", "items", "to", "the", "specified", "key", "identified", "by", "the", "name", "argument", ".", "The", "Geospatial", "items", "are", "given", "as", "ordered", "members", "of", "the", "values", "argument", "each", "item", ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2795-L2805
[ "def", "geoadd", "(", "self", ",", "name", ",", "*", "values", ")", ":", "if", "len", "(", "values", ")", "%", "3", "!=", "0", ":", "raise", "DataError", "(", "\"GEOADD requires places with lon, lat and name\"", "\" values\"", ")", "return", "self", ".", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Redis.geodist
Return the distance between ``place1`` and ``place2`` members of the ``name`` key. The units must be one of the following : m, km mi, ft. By default meters are used.
redis/client.py
def geodist(self, name, place1, place2, unit=None): """ Return the distance between ``place1`` and ``place2`` members of the ``name`` key. The units must be one of the following : m, km mi, ft. By default meters are used. """ pieces = [name, place1, place2] ...
def geodist(self, name, place1, place2, unit=None): """ Return the distance between ``place1`` and ``place2`` members of the ``name`` key. The units must be one of the following : m, km mi, ft. By default meters are used. """ pieces = [name, place1, place2] ...
[ "Return", "the", "distance", "between", "place1", "and", "place2", "members", "of", "the", "name", "key", ".", "The", "units", "must", "be", "one", "of", "the", "following", ":", "m", "km", "mi", "ft", ".", "By", "default", "meters", "are", "used", "."...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2807-L2819
[ "def", "geodist", "(", "self", ",", "name", ",", "place1", ",", "place2", ",", "unit", "=", "None", ")", ":", "pieces", "=", "[", "name", ",", "place1", ",", "place2", "]", "if", "unit", "and", "unit", "not", "in", "(", "'m'", ",", "'km'", ",", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub.on_connect
Re-subscribe to any channels and patterns previously subscribed to
redis/client.py
def on_connect(self, connection): "Re-subscribe to any channels and patterns previously subscribed to" # NOTE: for python3, we can't pass bytestrings as keyword arguments # so we need to decode channel/pattern names back to unicode strings # before passing them to [p]subscribe. s...
def on_connect(self, connection): "Re-subscribe to any channels and patterns previously subscribed to" # NOTE: for python3, we can't pass bytestrings as keyword arguments # so we need to decode channel/pattern names back to unicode strings # before passing them to [p]subscribe. s...
[ "Re", "-", "subscribe", "to", "any", "channels", "and", "patterns", "previously", "subscribed", "to" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2972-L2988
[ "def", "on_connect", "(", "self", ",", "connection", ")", ":", "# NOTE: for python3, we can't pass bytestrings as keyword arguments", "# so we need to decode channel/pattern names back to unicode strings", "# before passing them to [p]subscribe.", "self", ".", "pending_unsubscribe_channels...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub.parse_response
Parse the response from a publish/subscribe command
redis/client.py
def parse_response(self, block=True, timeout=0): "Parse the response from a publish/subscribe command" connection = self.connection if connection is None: raise RuntimeError( 'pubsub connection not set: ' 'did you forget to call subscribe() or psubscri...
def parse_response(self, block=True, timeout=0): "Parse the response from a publish/subscribe command" connection = self.connection if connection is None: raise RuntimeError( 'pubsub connection not set: ' 'did you forget to call subscribe() or psubscri...
[ "Parse", "the", "response", "from", "a", "publish", "/", "subscribe", "command" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3029-L3038
[ "def", "parse_response", "(", "self", ",", "block", "=", "True", ",", "timeout", "=", "0", ")", ":", "connection", "=", "self", ".", "connection", "if", "connection", "is", "None", ":", "raise", "RuntimeError", "(", "'pubsub connection not set: '", "'did you f...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub._normalize_keys
normalize channel/pattern names to be either bytes or strings based on whether responses are automatically decoded. this saves us from coercing the value for each message coming in.
redis/client.py
def _normalize_keys(self, data): """ normalize channel/pattern names to be either bytes or strings based on whether responses are automatically decoded. this saves us from coercing the value for each message coming in. """ encode = self.encoder.encode decode = sel...
def _normalize_keys(self, data): """ normalize channel/pattern names to be either bytes or strings based on whether responses are automatically decoded. this saves us from coercing the value for each message coming in. """ encode = self.encoder.encode decode = sel...
[ "normalize", "channel", "/", "pattern", "names", "to", "be", "either", "bytes", "or", "strings", "based", "on", "whether", "responses", "are", "automatically", "decoded", ".", "this", "saves", "us", "from", "coercing", "the", "value", "for", "each", "message",...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3040-L3048
[ "def", "_normalize_keys", "(", "self", ",", "data", ")", ":", "encode", "=", "self", ".", "encoder", ".", "encode", "decode", "=", "self", ".", "encoder", ".", "decode", "return", "{", "decode", "(", "encode", "(", "k", ")", ")", ":", "v", "for", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub.psubscribe
Subscribe to channel patterns. Patterns supplied as keyword arguments expect a pattern name as the key and a callable as the value. A pattern's callable will be invoked automatically when a message is received on that pattern rather than producing a message via ``listen()``.
redis/client.py
def psubscribe(self, *args, **kwargs): """ Subscribe to channel patterns. Patterns supplied as keyword arguments expect a pattern name as the key and a callable as the value. A pattern's callable will be invoked automatically when a message is received on that pattern rather than...
def psubscribe(self, *args, **kwargs): """ Subscribe to channel patterns. Patterns supplied as keyword arguments expect a pattern name as the key and a callable as the value. A pattern's callable will be invoked automatically when a message is received on that pattern rather than...
[ "Subscribe", "to", "channel", "patterns", ".", "Patterns", "supplied", "as", "keyword", "arguments", "expect", "a", "pattern", "name", "as", "the", "key", "and", "a", "callable", "as", "the", "value", ".", "A", "pattern", "s", "callable", "will", "be", "in...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3050-L3069
[ "def", "psubscribe", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", ":", "args", "=", "list_or_args", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", ")", "new_patterns", "=", "dict", ".", "fromkeys",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub.punsubscribe
Unsubscribe from the supplied patterns. If empty, unsubscribe from all patterns.
redis/client.py
def punsubscribe(self, *args): """ Unsubscribe from the supplied patterns. If empty, unsubscribe from all patterns. """ if args: args = list_or_args(args[0], args[1:]) patterns = self._normalize_keys(dict.fromkeys(args)) else: patterns ...
def punsubscribe(self, *args): """ Unsubscribe from the supplied patterns. If empty, unsubscribe from all patterns. """ if args: args = list_or_args(args[0], args[1:]) patterns = self._normalize_keys(dict.fromkeys(args)) else: patterns ...
[ "Unsubscribe", "from", "the", "supplied", "patterns", ".", "If", "empty", "unsubscribe", "from", "all", "patterns", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3071-L3082
[ "def", "punsubscribe", "(", "self", ",", "*", "args", ")", ":", "if", "args", ":", "args", "=", "list_or_args", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", ")", "patterns", "=", "self", ".", "_normalize_keys", "(", "dict", ".", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub.subscribe
Subscribe to channels. Channels supplied as keyword arguments expect a channel name as the key and a callable as the value. A channel's callable will be invoked automatically when a message is received on that channel rather than producing a message via ``listen()`` or ``get_message()``.
redis/client.py
def subscribe(self, *args, **kwargs): """ Subscribe to channels. Channels supplied as keyword arguments expect a channel name as the key and a callable as the value. A channel's callable will be invoked automatically when a message is received on that channel rather than producin...
def subscribe(self, *args, **kwargs): """ Subscribe to channels. Channels supplied as keyword arguments expect a channel name as the key and a callable as the value. A channel's callable will be invoked automatically when a message is received on that channel rather than producin...
[ "Subscribe", "to", "channels", ".", "Channels", "supplied", "as", "keyword", "arguments", "expect", "a", "channel", "name", "as", "the", "key", "and", "a", "callable", "as", "the", "value", ".", "A", "channel", "s", "callable", "will", "be", "invoked", "au...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3084-L3103
[ "def", "subscribe", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", ":", "args", "=", "list_or_args", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", ")", "new_channels", "=", "dict", ".", "fromkeys", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub.unsubscribe
Unsubscribe from the supplied channels. If empty, unsubscribe from all channels
redis/client.py
def unsubscribe(self, *args): """ Unsubscribe from the supplied channels. If empty, unsubscribe from all channels """ if args: args = list_or_args(args[0], args[1:]) channels = self._normalize_keys(dict.fromkeys(args)) else: channels = ...
def unsubscribe(self, *args): """ Unsubscribe from the supplied channels. If empty, unsubscribe from all channels """ if args: args = list_or_args(args[0], args[1:]) channels = self._normalize_keys(dict.fromkeys(args)) else: channels = ...
[ "Unsubscribe", "from", "the", "supplied", "channels", ".", "If", "empty", "unsubscribe", "from", "all", "channels" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3105-L3116
[ "def", "unsubscribe", "(", "self", ",", "*", "args", ")", ":", "if", "args", ":", "args", "=", "list_or_args", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", ")", "channels", "=", "self", ".", "_normalize_keys", "(", "dict", ".", "f...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PubSub.handle_message
Parses a pub/sub message. If the channel or pattern was subscribed to with a message handler, the handler is invoked instead of a parsed message being returned.
redis/client.py
def handle_message(self, response, ignore_subscribe_messages=False): """ Parses a pub/sub message. If the channel or pattern was subscribed to with a message handler, the handler is invoked instead of a parsed message being returned. """ message_type = nativestr(response[...
def handle_message(self, response, ignore_subscribe_messages=False): """ Parses a pub/sub message. If the channel or pattern was subscribed to with a message handler, the handler is invoked instead of a parsed message being returned. """ message_type = nativestr(response[...
[ "Parses", "a", "pub", "/", "sub", "message", ".", "If", "the", "channel", "or", "pattern", "was", "subscribed", "to", "with", "a", "message", "handler", "the", "handler", "is", "invoked", "instead", "of", "a", "parsed", "message", "being", "returned", "." ...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3145-L3202
[ "def", "handle_message", "(", "self", ",", "response", ",", "ignore_subscribe_messages", "=", "False", ")", ":", "message_type", "=", "nativestr", "(", "response", "[", "0", "]", ")", "if", "message_type", "==", "'pmessage'", ":", "message", "=", "{", "'type...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Pipeline.multi
Start a transactional block of the pipeline after WATCH commands are issued. End the transactional block with `execute`.
redis/client.py
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.command_stack: ...
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.command_stack: ...
[ "Start", "a", "transactional", "block", "of", "the", "pipeline", "after", "WATCH", "commands", "are", "issued", ".", "End", "the", "transactional", "block", "with", "execute", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3315-L3325
[ "def", "multi", "(", "self", ")", ":", "if", "self", ".", "explicit_transaction", ":", "raise", "RedisError", "(", "'Cannot issue nested calls to MULTI'", ")", "if", "self", ".", "command_stack", ":", "raise", "RedisError", "(", "'Commands without an initial WATCH hav...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Pipeline.pipeline_execute_command
Stage a command to be executed when execute() is next called Returns the current Pipeline object back so commands can be chained together, such as: pipe = pipe.set('foo', 'bar').incr('baz').decr('bang') At some other point, you can then run: pipe.execute(), which will execute ...
redis/client.py
def pipeline_execute_command(self, *args, **options): """ Stage a command to be executed when execute() is next called Returns the current Pipeline object back so commands can be chained together, such as: pipe = pipe.set('foo', 'bar').incr('baz').decr('bang') At some ...
def pipeline_execute_command(self, *args, **options): """ Stage a command to be executed when execute() is next called Returns the current Pipeline object back so commands can be chained together, such as: pipe = pipe.set('foo', 'bar').incr('baz').decr('bang') At some ...
[ "Stage", "a", "command", "to", "be", "executed", "when", "execute", "()", "is", "next", "called" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3365-L3378
[ "def", "pipeline_execute_command", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "self", ".", "command_stack", ".", "append", "(", "(", "args", ",", "options", ")", ")", "return", "self" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BitFieldOperation.reset
Reset the state of the instance to when it was constructed
redis/client.py
def reset(self): """ Reset the state of the instance to when it was constructed """ self.operations = [] self._last_overflow = 'WRAP' self.overflow(self._default_overflow or self._last_overflow)
def reset(self): """ Reset the state of the instance to when it was constructed """ self.operations = [] self._last_overflow = 'WRAP' self.overflow(self._default_overflow or self._last_overflow)
[ "Reset", "the", "state", "of", "the", "instance", "to", "when", "it", "was", "constructed" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3591-L3597
[ "def", "reset", "(", "self", ")", ":", "self", ".", "operations", "=", "[", "]", "self", ".", "_last_overflow", "=", "'WRAP'", "self", ".", "overflow", "(", "self", ".", "_default_overflow", "or", "self", ".", "_last_overflow", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BitFieldOperation.overflow
Update the overflow algorithm of successive INCRBY operations :param overflow: Overflow algorithm, one of WRAP, SAT, FAIL. See the Redis docs for descriptions of these algorithmsself. :returns: a :py:class:`BitFieldOperation` instance.
redis/client.py
def overflow(self, overflow): """ Update the overflow algorithm of successive INCRBY operations :param overflow: Overflow algorithm, one of WRAP, SAT, FAIL. See the Redis docs for descriptions of these algorithmsself. :returns: a :py:class:`BitFieldOperation` instance. ...
def overflow(self, overflow): """ Update the overflow algorithm of successive INCRBY operations :param overflow: Overflow algorithm, one of WRAP, SAT, FAIL. See the Redis docs for descriptions of these algorithmsself. :returns: a :py:class:`BitFieldOperation` instance. ...
[ "Update", "the", "overflow", "algorithm", "of", "successive", "INCRBY", "operations", ":", "param", "overflow", ":", "Overflow", "algorithm", "one", "of", "WRAP", "SAT", "FAIL", ".", "See", "the", "Redis", "docs", "for", "descriptions", "of", "these", "algorit...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3599-L3610
[ "def", "overflow", "(", "self", ",", "overflow", ")", ":", "overflow", "=", "overflow", ".", "upper", "(", ")", "if", "overflow", "!=", "self", ".", "_last_overflow", ":", "self", ".", "_last_overflow", "=", "overflow", "self", ".", "operations", ".", "a...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BitFieldOperation.get
Get the value of a given bitfield. :param fmt: format-string for the bitfield being read, e.g. 'u8' for an unsigned 8-bit integer. :param offset: offset (in number of bits). If prefixed with a '#', this is an offset multiplier, e.g. given the arguments fmt='u8', offse...
redis/client.py
def get(self, fmt, offset): """ Get the value of a given bitfield. :param fmt: format-string for the bitfield being read, e.g. 'u8' for an unsigned 8-bit integer. :param offset: offset (in number of bits). If prefixed with a '#', this is an offset multiplier, e.g....
def get(self, fmt, offset): """ Get the value of a given bitfield. :param fmt: format-string for the bitfield being read, e.g. 'u8' for an unsigned 8-bit integer. :param offset: offset (in number of bits). If prefixed with a '#', this is an offset multiplier, e.g....
[ "Get", "the", "value", "of", "a", "given", "bitfield", ".", ":", "param", "fmt", ":", "format", "-", "string", "for", "the", "bitfield", "being", "read", "e", ".", "g", ".", "u8", "for", "an", "unsigned", "8", "-", "bit", "integer", ".", ":", "para...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3632-L3643
[ "def", "get", "(", "self", ",", "fmt", ",", "offset", ")", ":", "self", ".", "operations", ".", "append", "(", "(", "'GET'", ",", "fmt", ",", "offset", ")", ")", "return", "self" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BitFieldOperation.set
Set the value of a given bitfield. :param fmt: format-string for the bitfield being read, e.g. 'u8' for an unsigned 8-bit integer. :param offset: offset (in number of bits). If prefixed with a '#', this is an offset multiplier, e.g. given the arguments fmt='u8', offse...
redis/client.py
def set(self, fmt, offset, value): """ Set the value of a given bitfield. :param fmt: format-string for the bitfield being read, e.g. 'u8' for an unsigned 8-bit integer. :param offset: offset (in number of bits). If prefixed with a '#', this is an offset multiplie...
def set(self, fmt, offset, value): """ Set the value of a given bitfield. :param fmt: format-string for the bitfield being read, e.g. 'u8' for an unsigned 8-bit integer. :param offset: offset (in number of bits). If prefixed with a '#', this is an offset multiplie...
[ "Set", "the", "value", "of", "a", "given", "bitfield", ".", ":", "param", "fmt", ":", "format", "-", "string", "for", "the", "bitfield", "being", "read", "e", ".", "g", ".", "u8", "for", "an", "unsigned", "8", "-", "bit", "integer", ".", ":", "para...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3645-L3657
[ "def", "set", "(", "self", ",", "fmt", ",", "offset", ",", "value", ")", ":", "self", ".", "operations", ".", "append", "(", "(", "'SET'", ",", "fmt", ",", "offset", ",", "value", ")", ")", "return", "self" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BitFieldOperation.execute
Execute the operation(s) in a single BITFIELD command. The return value is a list of values corresponding to each operation. If the client used to create this instance was a pipeline, the list of values will be present within the pipeline's execute.
redis/client.py
def execute(self): """ Execute the operation(s) in a single BITFIELD command. The return value is a list of values corresponding to each operation. If the client used to create this instance was a pipeline, the list of values will be present within the pipeline's execute. ...
def execute(self): """ Execute the operation(s) in a single BITFIELD command. The return value is a list of values corresponding to each operation. If the client used to create this instance was a pipeline, the list of values will be present within the pipeline's execute. ...
[ "Execute", "the", "operation", "(", "s", ")", "in", "a", "single", "BITFIELD", "command", ".", "The", "return", "value", "is", "a", "list", "of", "values", "corresponding", "to", "each", "operation", ".", "If", "the", "client", "used", "to", "create", "t...
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3666-L3675
[ "def", "execute", "(", "self", ")", ":", "command", "=", "self", ".", "command", "self", ".", "reset", "(", ")", "return", "self", ".", "client", ".", "execute_command", "(", "*", "command", ")" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Token.get_token
Gets a cached token object or creates a new one if not already cached
redis/connection.py
def get_token(cls, value): "Gets a cached token object or creates a new one if not already cached" # Use try/except because after running for a short time most tokens # should already be cached try: return cls._cache[value] except KeyError: token = Token(...
def get_token(cls, value): "Gets a cached token object or creates a new one if not already cached" # Use try/except because after running for a short time most tokens # should already be cached try: return cls._cache[value] except KeyError: token = Token(...
[ "Gets", "a", "cached", "token", "object", "or", "creates", "a", "new", "one", "if", "not", "already", "cached" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L73-L83
[ "def", "get_token", "(", "cls", ",", "value", ")", ":", "# Use try/except because after running for a short time most tokens", "# should already be cached", "try", ":", "return", "cls", ".", "_cache", "[", "value", "]", "except", "KeyError", ":", "token", "=", "Token"...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Encoder.encode
Return a bytestring representation of the value
redis/connection.py
def encode(self, value): "Return a bytestring representation of the value" if isinstance(value, Token): return value.encoded_value elif isinstance(value, bytes): return value elif isinstance(value, bool): # special case bool since it is a subclass of i...
def encode(self, value): "Return a bytestring representation of the value" if isinstance(value, Token): return value.encoded_value elif isinstance(value, bytes): return value elif isinstance(value, bool): # special case bool since it is a subclass of i...
[ "Return", "a", "bytestring", "representation", "of", "the", "value" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L106-L128
[ "def", "encode", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "Token", ")", ":", "return", "value", ".", "encoded_value", "elif", "isinstance", "(", "value", ",", "bytes", ")", ":", "return", "value", "elif", "isinstance", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Encoder.decode
Return a unicode string from the byte representation
redis/connection.py
def decode(self, value, force=False): "Return a unicode string from the byte representation" if (self.decode_responses or force) and isinstance(value, bytes): value = value.decode(self.encoding, self.encoding_errors) return value
def decode(self, value, force=False): "Return a unicode string from the byte representation" if (self.decode_responses or force) and isinstance(value, bytes): value = value.decode(self.encoding, self.encoding_errors) return value
[ "Return", "a", "unicode", "string", "from", "the", "byte", "representation" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L130-L134
[ "def", "decode", "(", "self", ",", "value", ",", "force", "=", "False", ")", ":", "if", "(", "self", ".", "decode_responses", "or", "force", ")", "and", "isinstance", "(", "value", ",", "bytes", ")", ":", "value", "=", "value", ".", "decode", "(", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BaseParser.parse_error
Parse an error response
redis/connection.py
def parse_error(self, response): "Parse an error response" error_code = response.split(' ')[0] if error_code in self.EXCEPTION_CLASSES: response = response[len(error_code) + 1:] exception_class = self.EXCEPTION_CLASSES[error_code] if isinstance(exception_class...
def parse_error(self, response): "Parse an error response" error_code = response.split(' ')[0] if error_code in self.EXCEPTION_CLASSES: response = response[len(error_code) + 1:] exception_class = self.EXCEPTION_CLASSES[error_code] if isinstance(exception_class...
[ "Parse", "an", "error", "response" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L148-L157
[ "def", "parse_error", "(", "self", ",", "response", ")", ":", "error_code", "=", "response", ".", "split", "(", "' '", ")", "[", "0", "]", "if", "error_code", "in", "self", ".", "EXCEPTION_CLASSES", ":", "response", "=", "response", "[", "len", "(", "e...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PythonParser.on_connect
Called when the socket connects
redis/connection.py
def on_connect(self, connection): "Called when the socket connects" self._sock = connection._sock self._buffer = SocketBuffer(self._sock, self.socket_read_size) self.encoder = connection.encoder
def on_connect(self, connection): "Called when the socket connects" self._sock = connection._sock self._buffer = SocketBuffer(self._sock, self.socket_read_size) self.encoder = connection.encoder
[ "Called", "when", "the", "socket", "connects" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L265-L269
[ "def", "on_connect", "(", "self", ",", "connection", ")", ":", "self", ".", "_sock", "=", "connection", ".", "_sock", "self", ".", "_buffer", "=", "SocketBuffer", "(", "self", ".", "_sock", ",", "self", ".", "socket_read_size", ")", "self", ".", "encoder...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
PythonParser.on_disconnect
Called when the socket disconnects
redis/connection.py
def on_disconnect(self): "Called when the socket disconnects" self._sock = None if self._buffer is not None: self._buffer.close() self._buffer = None self.encoder = None
def on_disconnect(self): "Called when the socket disconnects" self._sock = None if self._buffer is not None: self._buffer.close() self._buffer = None self.encoder = None
[ "Called", "when", "the", "socket", "disconnects" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L271-L277
[ "def", "on_disconnect", "(", "self", ")", ":", "self", ".", "_sock", "=", "None", "if", "self", ".", "_buffer", "is", "not", "None", ":", "self", ".", "_buffer", ".", "close", "(", ")", "self", ".", "_buffer", "=", "None", "self", ".", "encoder", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Connection.connect
Connects to the Redis server if not already connected
redis/connection.py
def connect(self): "Connects to the Redis server if not already connected" if self._sock: return try: sock = self._connect() except socket.timeout: raise TimeoutError("Timeout connecting to server") except socket.error: e = sys.exc_...
def connect(self): "Connects to the Redis server if not already connected" if self._sock: return try: sock = self._connect() except socket.timeout: raise TimeoutError("Timeout connecting to server") except socket.error: e = sys.exc_...
[ "Connects", "to", "the", "Redis", "server", "if", "not", "already", "connected" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L474-L498
[ "def", "connect", "(", "self", ")", ":", "if", "self", ".", "_sock", ":", "return", "try", ":", "sock", "=", "self", ".", "_connect", "(", ")", "except", "socket", ".", "timeout", ":", "raise", "TimeoutError", "(", "\"Timeout connecting to server\"", ")", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Connection.disconnect
Disconnects from the Redis server
redis/connection.py
def disconnect(self): "Disconnects from the Redis server" self._parser.on_disconnect() if self._sock is None: return if self._selector is not None: self._selector.close() self._selector = None try: if os.getpid() == self.pid: ...
def disconnect(self): "Disconnects from the Redis server" self._parser.on_disconnect() if self._sock is None: return if self._selector is not None: self._selector.close() self._selector = None try: if os.getpid() == self.pid: ...
[ "Disconnects", "from", "the", "Redis", "server" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L566-L580
[ "def", "disconnect", "(", "self", ")", ":", "self", ".", "_parser", ".", "on_disconnect", "(", ")", "if", "self", ".", "_sock", "is", "None", ":", "return", "if", "self", ".", "_selector", "is", "not", "None", ":", "self", ".", "_selector", ".", "clo...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Connection.send_packed_command
Send an already packed command to the Redis server
redis/connection.py
def send_packed_command(self, command): "Send an already packed command to the Redis server" if not self._sock: self.connect() try: if isinstance(command, str): command = [command] for item in command: self._sock.sendall(item) ...
def send_packed_command(self, command): "Send an already packed command to the Redis server" if not self._sock: self.connect() try: if isinstance(command, str): command = [command] for item in command: self._sock.sendall(item) ...
[ "Send", "an", "already", "packed", "command", "to", "the", "Redis", "server" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L582-L606
[ "def", "send_packed_command", "(", "self", ",", "command", ")", ":", "if", "not", "self", ".", "_sock", ":", "self", ".", "connect", "(", ")", "try", ":", "if", "isinstance", "(", "command", ",", "str", ")", ":", "command", "=", "[", "command", "]", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Connection.can_read
Poll the socket to see if there's data that can be read.
redis/connection.py
def can_read(self, timeout=0): "Poll the socket to see if there's data that can be read." sock = self._sock if not sock: self.connect() sock = self._sock return self._parser.can_read() or self._selector.can_read(timeout)
def can_read(self, timeout=0): "Poll the socket to see if there's data that can be read." sock = self._sock if not sock: self.connect() sock = self._sock return self._parser.can_read() or self._selector.can_read(timeout)
[ "Poll", "the", "socket", "to", "see", "if", "there", "s", "data", "that", "can", "be", "read", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L612-L618
[ "def", "can_read", "(", "self", ",", "timeout", "=", "0", ")", ":", "sock", "=", "self", ".", "_sock", "if", "not", "sock", ":", "self", ".", "connect", "(", ")", "sock", "=", "self", ".", "_sock", "return", "self", ".", "_parser", ".", "can_read",...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Connection.read_response
Read the response from a previously sent command
redis/connection.py
def read_response(self): "Read the response from a previously sent command" try: response = self._parser.read_response() except socket.timeout: self.disconnect() raise TimeoutError("Timeout reading from %s:%s" % (self.host, self....
def read_response(self): "Read the response from a previously sent command" try: response = self._parser.read_response() except socket.timeout: self.disconnect() raise TimeoutError("Timeout reading from %s:%s" % (self.host, self....
[ "Read", "the", "response", "from", "a", "previously", "sent", "command" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L624-L642
[ "def", "read_response", "(", "self", ")", ":", "try", ":", "response", "=", "self", ".", "_parser", ".", "read_response", "(", ")", "except", "socket", ".", "timeout", ":", "self", ".", "disconnect", "(", ")", "raise", "TimeoutError", "(", "\"Timeout readi...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
Connection.pack_command
Pack a series of arguments into the Redis protocol
redis/connection.py
def pack_command(self, *args): "Pack a series of arguments into the Redis protocol" output = [] # the client might have included 1 or more literal arguments in # the command name, e.g., 'CONFIG GET'. The Redis server expects these # arguments to be sent separately, so split the f...
def pack_command(self, *args): "Pack a series of arguments into the Redis protocol" output = [] # the client might have included 1 or more literal arguments in # the command name, e.g., 'CONFIG GET'. The Redis server expects these # arguments to be sent separately, so split the f...
[ "Pack", "a", "series", "of", "arguments", "into", "the", "Redis", "protocol" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L644-L676
[ "def", "pack_command", "(", "self", ",", "*", "args", ")", ":", "output", "=", "[", "]", "# the client might have included 1 or more literal arguments in", "# the command name, e.g., 'CONFIG GET'. The Redis server expects these", "# arguments to be sent separately, so split the first a...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
SSLConnection._connect
Wrap the socket with SSL support
redis/connection.py
def _connect(self): "Wrap the socket with SSL support" sock = super(SSLConnection, self)._connect() if hasattr(ssl, "create_default_context"): context = ssl.create_default_context() context.check_hostname = False context.verify_mode = self.cert_reqs ...
def _connect(self): "Wrap the socket with SSL support" sock = super(SSLConnection, self)._connect() if hasattr(ssl, "create_default_context"): context = ssl.create_default_context() context.check_hostname = False context.verify_mode = self.cert_reqs ...
[ "Wrap", "the", "socket", "with", "SSL", "support" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L732-L753
[ "def", "_connect", "(", "self", ")", ":", "sock", "=", "super", "(", "SSLConnection", ",", "self", ")", ".", "_connect", "(", ")", "if", "hasattr", "(", "ssl", ",", "\"create_default_context\"", ")", ":", "context", "=", "ssl", ".", "create_default_context...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
UnixDomainSocketConnection._connect
Create a Unix domain socket connection
redis/connection.py
def _connect(self): "Create a Unix domain socket connection" sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.settimeout(self.socket_timeout) sock.connect(self.path) return sock
def _connect(self): "Create a Unix domain socket connection" sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.settimeout(self.socket_timeout) sock.connect(self.path) return sock
[ "Create", "a", "Unix", "domain", "socket", "connection" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L780-L785
[ "def", "_connect", "(", "self", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_UNIX", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "settimeout", "(", "self", ".", "socket_timeout", ")", "sock", ".", "connect", "(", "sel...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
ConnectionPool.from_url
Return a connection pool configured from the given URL. For example:: redis://[:password]@localhost:6379/0 rediss://[:password]@localhost:6379/0 unix://[:password]@/path/to/socket.sock?db=0 Three URL schemes are supported: - ```redis://`` <https:...
redis/connection.py
def from_url(cls, url, db=None, decode_components=False, **kwargs): """ Return a connection pool configured from the given URL. For example:: redis://[:password]@localhost:6379/0 rediss://[:password]@localhost:6379/0 unix://[:password]@/path/to/socket.sock?d...
def from_url(cls, url, db=None, decode_components=False, **kwargs): """ Return a connection pool configured from the given URL. For example:: redis://[:password]@localhost:6379/0 rediss://[:password]@localhost:6379/0 unix://[:password]@/path/to/socket.sock?d...
[ "Return", "a", "connection", "pool", "configured", "from", "the", "given", "URL", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L821-L937
[ "def", "from_url", "(", "cls", ",", "url", ",", "db", "=", "None", ",", "decode_components", "=", "False", ",", "*", "*", "kwargs", ")", ":", "url", "=", "urlparse", "(", "url", ")", "url_options", "=", "{", "}", "for", "name", ",", "value", "in", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
ConnectionPool.get_connection
Get a connection from the pool
redis/connection.py
def get_connection(self, command_name, *keys, **options): "Get a connection from the pool" self._checkpid() try: connection = self._available_connections.pop() except IndexError: connection = self.make_connection() self._in_use_connections.add(connection) ...
def get_connection(self, command_name, *keys, **options): "Get a connection from the pool" self._checkpid() try: connection = self._available_connections.pop() except IndexError: connection = self.make_connection() self._in_use_connections.add(connection) ...
[ "Get", "a", "connection", "from", "the", "pool" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L983-L1008
[ "def", "get_connection", "(", "self", ",", "command_name", ",", "*", "keys", ",", "*", "*", "options", ")", ":", "self", ".", "_checkpid", "(", ")", "try", ":", "connection", "=", "self", ".", "_available_connections", ".", "pop", "(", ")", "except", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
ConnectionPool.get_encoder
Return an encoder based on encoding settings
redis/connection.py
def get_encoder(self): "Return an encoder based on encoding settings" kwargs = self.connection_kwargs return Encoder( encoding=kwargs.get('encoding', 'utf-8'), encoding_errors=kwargs.get('encoding_errors', 'strict'), decode_responses=kwargs.get('decode_respons...
def get_encoder(self): "Return an encoder based on encoding settings" kwargs = self.connection_kwargs return Encoder( encoding=kwargs.get('encoding', 'utf-8'), encoding_errors=kwargs.get('encoding_errors', 'strict'), decode_responses=kwargs.get('decode_respons...
[ "Return", "an", "encoder", "based", "on", "encoding", "settings" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1010-L1017
[ "def", "get_encoder", "(", "self", ")", ":", "kwargs", "=", "self", ".", "connection_kwargs", "return", "Encoder", "(", "encoding", "=", "kwargs", ".", "get", "(", "'encoding'", ",", "'utf-8'", ")", ",", "encoding_errors", "=", "kwargs", ".", "get", "(", ...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
ConnectionPool.make_connection
Create a new connection
redis/connection.py
def make_connection(self): "Create a new connection" if self._created_connections >= self.max_connections: raise ConnectionError("Too many connections") self._created_connections += 1 return self.connection_class(**self.connection_kwargs)
def make_connection(self): "Create a new connection" if self._created_connections >= self.max_connections: raise ConnectionError("Too many connections") self._created_connections += 1 return self.connection_class(**self.connection_kwargs)
[ "Create", "a", "new", "connection" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1019-L1024
[ "def", "make_connection", "(", "self", ")", ":", "if", "self", ".", "_created_connections", ">=", "self", ".", "max_connections", ":", "raise", "ConnectionError", "(", "\"Too many connections\"", ")", "self", ".", "_created_connections", "+=", "1", "return", "self...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
ConnectionPool.disconnect
Disconnects all connections in the pool
redis/connection.py
def disconnect(self): "Disconnects all connections in the pool" self._checkpid() all_conns = chain(self._available_connections, self._in_use_connections) for connection in all_conns: connection.disconnect()
def disconnect(self): "Disconnects all connections in the pool" self._checkpid() all_conns = chain(self._available_connections, self._in_use_connections) for connection in all_conns: connection.disconnect()
[ "Disconnects", "all", "connections", "in", "the", "pool" ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1034-L1040
[ "def", "disconnect", "(", "self", ")", ":", "self", ".", "_checkpid", "(", ")", "all_conns", "=", "chain", "(", "self", ".", "_available_connections", ",", "self", ".", "_in_use_connections", ")", "for", "connection", "in", "all_conns", ":", "connection", "....
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BlockingConnectionPool.make_connection
Make a fresh connection.
redis/connection.py
def make_connection(self): "Make a fresh connection." connection = self.connection_class(**self.connection_kwargs) self._connections.append(connection) return connection
def make_connection(self): "Make a fresh connection." connection = self.connection_class(**self.connection_kwargs) self._connections.append(connection) return connection
[ "Make", "a", "fresh", "connection", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1103-L1107
[ "def", "make_connection", "(", "self", ")", ":", "connection", "=", "self", ".", "connection_class", "(", "*", "*", "self", ".", "connection_kwargs", ")", "self", ".", "_connections", ".", "append", "(", "connection", ")", "return", "connection" ]
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BlockingConnectionPool.get_connection
Get a connection, blocking for ``self.timeout`` until a connection is available from the pool. If the connection returned is ``None`` then creates a new connection. Because we use a last-in first-out queue, the existing connections (having been returned to the pool after the initial ``N...
redis/connection.py
def get_connection(self, command_name, *keys, **options): """ Get a connection, blocking for ``self.timeout`` until a connection is available from the pool. If the connection returned is ``None`` then creates a new connection. Because we use a last-in first-out queue, the existi...
def get_connection(self, command_name, *keys, **options): """ Get a connection, blocking for ``self.timeout`` until a connection is available from the pool. If the connection returned is ``None`` then creates a new connection. Because we use a last-in first-out queue, the existi...
[ "Get", "a", "connection", "blocking", "for", "self", ".", "timeout", "until", "a", "connection", "is", "available", "from", "the", "pool", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1109-L1156
[ "def", "get_connection", "(", "self", ",", "command_name", ",", "*", "keys", ",", "*", "*", "options", ")", ":", "# Make sure we haven't changed process.", "self", ".", "_checkpid", "(", ")", "# Try and get a connection from the pool. If one isn't available within", "# se...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db
train
BlockingConnectionPool.release
Releases the connection back to the pool.
redis/connection.py
def release(self, connection): "Releases the connection back to the pool." # Make sure we haven't changed process. self._checkpid() if connection.pid != self.pid: return # Put the connection back into the pool. try: self.pool.put_nowait(connection...
def release(self, connection): "Releases the connection back to the pool." # Make sure we haven't changed process. self._checkpid() if connection.pid != self.pid: return # Put the connection back into the pool. try: self.pool.put_nowait(connection...
[ "Releases", "the", "connection", "back", "to", "the", "pool", "." ]
andymccurdy/redis-py
python
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1158-L1171
[ "def", "release", "(", "self", ",", "connection", ")", ":", "# Make sure we haven't changed process.", "self", ".", "_checkpid", "(", ")", "if", "connection", ".", "pid", "!=", "self", ".", "pid", ":", "return", "# Put the connection back into the pool.", "try", "...
cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db