repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
andymccurdy/redis-py | redis/client.py | Redis.xrange | 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 ... | python | 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",
")",
":",
"pieces",
"=",
"[",
"min",
",",
"max",
"]",
"if",
"count",
"is",
"not",
"None",
":",
"if",
"not",
"isinstance",
"(",... | 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... | [
"Read",
"stream",
"values",
"within",
"an",
"interval",
".",
"name",
":",
"name",
"of",
"the",
"stream",
".",
"start",
":",
"first",
"stream",
"ID",
".",
"defaults",
"to",
"-",
"meaning",
"the",
"earliest",
"available",
".",
"finish",
":",
"last",
"strea... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2164-L2182 | train | Read stream values within an interval. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.xread | 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
... | python | 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",
")",
":",
"pieces",
"=",
"[",
"]",
"if",
"block",
"is",
"not",
"None",
":",
"if",
"not",
"isinstance",
"(",
"block",
",",
"(",
"int",
",",
"long",
... | 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,... | [
"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",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2184-L2210 | train | Read many items from a set of streams. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.xreadgroup | 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... | python | 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",
")",
":",
"pieces",
"=",
"[",
"Token",
".",
"get_token",
"(",
"'GROUP'",
")",
"... | 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 ... | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2212-L2244 | train | Read from a consumer group via a consumer group. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.xtrim | 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(... | python | 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",
")",
":",
"pieces",
"=",
"[",
"Token",
".",
"get_token",
"(",
"'MAXLEN'",
")",
"]",
"if",
"approximate",
":",
"pieces",
".",
"append",
"(",
"Token",
".",
"get_t... | 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 | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2266-L2277 | train | Trim old messages from a stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zadd | 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... | python | 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",
")",
":",
"if",
"not",
"mapping",
":",
"raise",
"DataError",
"(",
"\"ZADD requires at least... | 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... | [
"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",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2280-L2325 | train | Add any number of elements to the specified key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zcount | 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) | python | 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",
")",
":",
"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``. | [
"Returns",
"the",
"number",
"of",
"elements",
"in",
"the",
"sorted",
"set",
"at",
"key",
"name",
"with",
"a",
"score",
"between",
"min",
"and",
"max",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2331-L2336 | train | Returns the number of elements in the sorted set at key name with a score between min and max. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zincrby | 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) | python | 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",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'ZINCRBY'",
",",
"name",
",",
"amount",
",",
"value",
")"
] | Increment the score of ``value`` in sorted set ``name`` by ``amount`` | [
"Increment",
"the",
"score",
"of",
"value",
"in",
"sorted",
"set",
"name",
"by",
"amount"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2338-L2340 | train | Increment the score of value in sorted set name by amount | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zinterstore | 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... | python | 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",
")",
":",
"return",
"self",
".",
"_zaggregate",
"(",
"'ZINTERSTORE'",
",",
"dest",
",",
"keys",
",",
"aggregate",
")"
] | 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. | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2342-L2348 | train | Intersect multiple sorted sets specified by keys into a new sorted set dest. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zlexcount | 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) | python | 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",
"self",
".",
"execute_command",
"(",
"'ZLEXCOUNT'",
",",
"name",
",",
"min",
",",
"max",
")"
] | Return the number of items in the sorted set ``name`` between the
lexicographical range ``min`` and ``max``. | [
"Return",
"the",
"number",
"of",
"items",
"in",
"the",
"sorted",
"set",
"name",
"between",
"the",
"lexicographical",
"range",
"min",
"and",
"max",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2350-L2355 | train | Return the number of items in the sorted set name between the lexicographical range min and max. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zpopmax | 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... | python | 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",
")",
":",
"args",
"=",
"(",
"count",
"is",
"not",
"None",
")",
"and",
"[",
"count",
"]",
"or",
"[",
"]",
"options",
"=",
"{",
"'withscores'",
":",
"True",
"}",
"return",
"self... | Remove and return up to ``count`` members with the highest scores
from the sorted set ``name``. | [
"Remove",
"and",
"return",
"up",
"to",
"count",
"members",
"with",
"the",
"highest",
"scores",
"from",
"the",
"sorted",
"set",
"name",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2357-L2366 | train | Remove and return up to count members with the highest scores
from the sorted set name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zpopmin | 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... | python | 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",
")",
":",
"args",
"=",
"(",
"count",
"is",
"not",
"None",
")",
"and",
"[",
"count",
"]",
"or",
"[",
"]",
"options",
"=",
"{",
"'withscores'",
":",
"True",
"}",
"return",
"self... | Remove and return up to ``count`` members with the lowest scores
from the sorted set ``name``. | [
"Remove",
"and",
"return",
"up",
"to",
"count",
"members",
"with",
"the",
"lowest",
"scores",
"from",
"the",
"sorted",
"set",
"name",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2368-L2377 | train | Remove and return up to count members with the lowest scores
from the sorted set name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.bzpopmax | 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... | python | 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",
")",
":",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"0",
"keys",
"=",
"list_or_args",
"(",
"keys",
",",
"None",
")",
"keys",
".",
"append",
"(",
"timeout",
")",
"retur... | 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. | [
"ZPOPMAX",
"a",
"value",
"off",
"of",
"the",
"first",
"non",
"-",
"empty",
"sorted",
"set",
"named",
"in",
"the",
"keys",
"list",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2379-L2394 | train | Remove and return the highest priority set from the sorted set at the given keys. If timeout is not set then block indefinitely until a member gets added to the first non - empty set at the given keys. If timeout is set then block indefinitely until a member gets added to the first non - empty set at the given keys. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zrangebylex | 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... | python | 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",
")",
":",
"if",
"(",
"start",
"is",
"not",
"None",
"and",
"num",
"is",
"None",
")",
"or",
"(",
"num",
"is",
"not",
"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. | [
"Return",
"the",
"lexicographical",
"range",
"of",
"values",
"from",
"sorted",
"set",
"name",
"between",
"min",
"and",
"max",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2440-L2454 | train | Return the lexicographical range of values from sorted set name between min and max. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zremrangebylex | 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) | python | 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",
")",
":",
"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``.
Returns the number of elements removed. | [
"Remove",
"all",
"elements",
"in",
"the",
"sorted",
"set",
"name",
"between",
"the",
"lexicographical",
"range",
"specified",
"by",
"min",
"and",
"max",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2511-L2518 | train | Remove all elements in the sorted set name between the lexicographical range specified by min and max. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zremrangebyrank | 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... | python | 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",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'ZREMRANGEBYRANK'",
",",
"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 removed | [
"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",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2520-L2527 | train | Remove all elements in the sorted set name with ranks between min and max. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zrevrangebyscore | 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... | python | 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",
")",
":",
"if",
"(",
"start",
"is",
"not",
"None",... | 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... | [
"Return",
"a",
"range",
"of",
"values",
"from",
"the",
"sorted",
"set",
"name",
"with",
"scores",
"between",
"min",
"and",
"max",
"in",
"descending",
"order",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2558-L2584 | train | Returns a range of values from the sorted set name with scores between min and max in descending order. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.zunionstore | 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... | python | 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",
")",
":",
"return",
"self",
".",
"_zaggregate",
"(",
"'ZUNIONSTORE'",
",",
"dest",
",",
"keys",
",",
"aggregate",
")"
] | 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. | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2597-L2603 | train | Union multiple sorted sets specified by keys into a new sorted set dest. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.hmget | 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) | python | 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",
")",
":",
"args",
"=",
"list_or_args",
"(",
"keys",
",",
"args",
")",
"return",
"self",
".",
"execute_command",
"(",
"'HMGET'",
",",
"name",
",",
"*",
"args",
")"
] | Returns a list of values ordered identically to ``keys`` | [
"Returns",
"a",
"list",
"of",
"values",
"ordered",
"identically",
"to",
"keys"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2697-L2700 | train | Returns a list of values ordered identically to keys | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.eval | 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... | python | 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",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'EVAL'",
",",
"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_script``. This
function exists purely for Redis API completion. | [
"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",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2742-L2751 | train | Execute a Lua script and return the result. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.evalsha | 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.
... | python | 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",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'EVALSHA'",
",",
"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.
In practice, use the object returned by ``register_script``. Th... | [
"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",... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2753-L2763 | train | Execute a Lua script with the given sha. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.geoadd | 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.
... | python | 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",
")",
":",
"if",
"len",
"(",
"values",
")",
"%",
"3",
"!=",
"0",
":",
"raise",
"DataError",
"(",
"\"GEOADD requires places with lon, lat and name\"",
"\" values\"",
")",
"return",
"self",
".",
"... | 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",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2795-L2805 | train | Add the specified geospatial items to the specified key identified by the name argument. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Redis.geodist | 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]
... | python | 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",
")",
":",
"pieces",
"=",
"[",
"name",
",",
"place1",
",",
"place2",
"]",
"if",
"unit",
"and",
"unit",
"not",
"in",
"(",
"'m'",
",",
"'km'",
",",
... | 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. | [
"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",
"."... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2807-L2819 | train | Return the distance between place1 and place2 members of the key name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub.on_connect | 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... | python | 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",
")",
":",
"# 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... | Re-subscribe to any channels and patterns previously subscribed to | [
"Re",
"-",
"subscribe",
"to",
"any",
"channels",
"and",
"patterns",
"previously",
"subscribed",
"to"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L2972-L2988 | train | Re - subscribe to any channels and patterns previously subscribed to | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub.parse_response | 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... | python | 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",
")",
":",
"connection",
"=",
"self",
".",
"connection",
"if",
"connection",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'pubsub connection not set: '",
"'did you f... | Parse the response from a publish/subscribe command | [
"Parse",
"the",
"response",
"from",
"a",
"publish",
"/",
"subscribe",
"command"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3029-L3038 | train | Parse the response from a publish / subscribe command | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub._normalize_keys | 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... | python | 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",
")",
":",
"encode",
"=",
"self",
".",
"encoder",
".",
"encode",
"decode",
"=",
"self",
".",
"encoder",
".",
"decode",
"return",
"{",
"decode",
"(",
"encode",
"(",
"k",
")",
")",
":",
"v",
"for",
"... | 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. | [
"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",... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3040-L3048 | train | normalize channel names to be either bytes or strings
based on whether responses are automatically decoded. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub.psubscribe | 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... | python | 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",
")",
":",
"if",
"args",
":",
"args",
"=",
"list_or_args",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
":",
"]",
")",
"new_patterns",
"=",
"dict",
".",
"fromkeys",... | 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()``. | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3050-L3069 | train | Subscribe to channel patterns. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub.punsubscribe | 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 ... | python | 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",
")",
":",
"if",
"args",
":",
"args",
"=",
"list_or_args",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
":",
"]",
")",
"patterns",
"=",
"self",
".",
"_normalize_keys",
"(",
"dict",
".",
"... | Unsubscribe from the supplied patterns. If empty, unsubscribe from
all patterns. | [
"Unsubscribe",
"from",
"the",
"supplied",
"patterns",
".",
"If",
"empty",
"unsubscribe",
"from",
"all",
"patterns",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3071-L3082 | train | Unsubscribe from the supplied patterns. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub.subscribe | 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... | python | 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",
")",
":",
"if",
"args",
":",
"args",
"=",
"list_or_args",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
":",
"]",
")",
"new_channels",
"=",
"dict",
".",
"fromkeys",
... | 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()``. | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3084-L3103 | train | Subscribe to channels. Channels supplied as keyword arguments expect
a channel name as the key and a callable as the value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub.unsubscribe | 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 = ... | python | 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",
")",
":",
"if",
"args",
":",
"args",
"=",
"list_or_args",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
":",
"]",
")",
"channels",
"=",
"self",
".",
"_normalize_keys",
"(",
"dict",
".",
"f... | Unsubscribe from the supplied channels. If empty, unsubscribe from
all channels | [
"Unsubscribe",
"from",
"the",
"supplied",
"channels",
".",
"If",
"empty",
"unsubscribe",
"from",
"all",
"channels"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3105-L3116 | train | Unsubscribe from the supplied channels. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | PubSub.handle_message | 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[... | python | 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",
")",
":",
"message_type",
"=",
"nativestr",
"(",
"response",
"[",
"0",
"]",
")",
"if",
"message_type",
"==",
"'pmessage'",
":",
"message",
"=",
"{",
"'type... | 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. | [
"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",
"."
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3145-L3202 | train | Parses a pub / sub message and returns a parsed version of the message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Pipeline.multi | def multi(self):
"""
Start a transactional block of the pipeline after WATCH commands
are issued. End the transactional block with `execute`.
"""
if self.explicit_transaction:
raise RedisError('Cannot issue nested calls to MULTI')
if self.command_stack:
... | python | def multi(self):
"""
Start a transactional block of the pipeline after WATCH commands
are issued. End the transactional block with `execute`.
"""
if self.explicit_transaction:
raise RedisError('Cannot issue nested calls to MULTI')
if self.command_stack:
... | [
"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... | Start a transactional block of the pipeline after WATCH commands
are issued. End the transactional block with `execute`. | [
"Start",
"a",
"transactional",
"block",
"of",
"the",
"pipeline",
"after",
"WATCH",
"commands",
"are",
"issued",
".",
"End",
"the",
"transactional",
"block",
"with",
"execute",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3315-L3325 | train | This method is used to issue multiple commands at once. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | Pipeline.pipeline_execute_command | 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 ... | python | 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",
")",
":",
"self",
".",
"command_stack",
".",
"append",
"(",
"(",
"args",
",",
"options",
")",
")",
"return",
"self"
] | 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 ... | [
"Stage",
"a",
"command",
"to",
"be",
"executed",
"when",
"execute",
"()",
"is",
"next",
"called"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3365-L3378 | train | Execute a command in the pipeline. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | BitFieldOperation.reset | 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) | python | 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",
")",
":",
"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 | [
"Reset",
"the",
"state",
"of",
"the",
"instance",
"to",
"when",
"it",
"was",
"constructed"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3591-L3597 | train | Reset the state of the instance to when it was constructed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | BitFieldOperation.overflow | 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.
... | python | 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",
")",
":",
"overflow",
"=",
"overflow",
".",
"upper",
"(",
")",
"if",
"overflow",
"!=",
"self",
".",
"_last_overflow",
":",
"self",
".",
"_last_overflow",
"=",
"overflow",
"self",
".",
"operations",
".",
"a... | 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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3599-L3610 | train | Updates the overflow algorithm of successive INCRBY operations
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | BitFieldOperation.get | 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.... | python | 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",
")",
":",
"self",
".",
"operations",
".",
"append",
"(",
"(",
"'GET'",
",",
"fmt",
",",
"offset",
")",
")",
"return",
"self"
] | 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... | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3632-L3643 | train | Adds a GET operation to the bitfield. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | BitFieldOperation.set | 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... | python | 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",
")",
":",
"self",
".",
"operations",
".",
"append",
"(",
"(",
"'SET'",
",",
"fmt",
",",
"offset",
",",
"value",
")",
")",
"return",
"self"
] | 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... | [
"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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3645-L3657 | train | Set the value of a given bitfield at the given offset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/client.py | BitFieldOperation.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.
... | python | 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",
")",
":",
"command",
"=",
"self",
".",
"command",
"self",
".",
"reset",
"(",
")",
"return",
"self",
".",
"client",
".",
"execute_command",
"(",
"*",
"command",
")"
] | 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... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L3666-L3675 | train | Execute the command in a single BITFIELD command. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Token.get_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(... | python | 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",
")",
":",
"# 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 | [
"Gets",
"a",
"cached",
"token",
"object",
"or",
"creates",
"a",
"new",
"one",
"if",
"not",
"already",
"cached"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L73-L83 | train | Gets a cached token object or creates a new one if not already cached | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Encoder.encode | 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... | python | 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",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Token",
")",
":",
"return",
"value",
".",
"encoded_value",
"elif",
"isinstance",
"(",
"value",
",",
"bytes",
")",
":",
"return",
"value",
"elif",
"isinstance",
... | Return a bytestring representation of the value | [
"Return",
"a",
"bytestring",
"representation",
"of",
"the",
"value"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L106-L128 | train | Return a bytestring representation of the value | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Encoder.decode | 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 | python | 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",
")",
":",
"if",
"(",
"self",
".",
"decode_responses",
"or",
"force",
")",
"and",
"isinstance",
"(",
"value",
",",
"bytes",
")",
":",
"value",
"=",
"value",
".",
"decode",
"(",
... | Return a unicode string from the byte representation | [
"Return",
"a",
"unicode",
"string",
"from",
"the",
"byte",
"representation"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L130-L134 | train | Return a unicode string from the byte representation | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | BaseParser.parse_error | 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... | python | 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",
")",
":",
"error_code",
"=",
"response",
".",
"split",
"(",
"' '",
")",
"[",
"0",
"]",
"if",
"error_code",
"in",
"self",
".",
"EXCEPTION_CLASSES",
":",
"response",
"=",
"response",
"[",
"len",
"(",
"e... | Parse an error response | [
"Parse",
"an",
"error",
"response"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L148-L157 | train | Parse an error response | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | PythonParser.on_connect | 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 | python | 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",
")",
":",
"self",
".",
"_sock",
"=",
"connection",
".",
"_sock",
"self",
".",
"_buffer",
"=",
"SocketBuffer",
"(",
"self",
".",
"_sock",
",",
"self",
".",
"socket_read_size",
")",
"self",
".",
"encoder... | Called when the socket connects | [
"Called",
"when",
"the",
"socket",
"connects"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L265-L269 | train | Called when the socket connects | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | PythonParser.on_disconnect | 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 | python | 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",
")",
":",
"self",
".",
"_sock",
"=",
"None",
"if",
"self",
".",
"_buffer",
"is",
"not",
"None",
":",
"self",
".",
"_buffer",
".",
"close",
"(",
")",
"self",
".",
"_buffer",
"=",
"None",
"self",
".",
"encoder",
"... | Called when the socket disconnects | [
"Called",
"when",
"the",
"socket",
"disconnects"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L271-L277 | train | Called when the socket disconnects | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Connection.connect | 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_... | python | 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",
")",
":",
"if",
"self",
".",
"_sock",
":",
"return",
"try",
":",
"sock",
"=",
"self",
".",
"_connect",
"(",
")",
"except",
"socket",
".",
"timeout",
":",
"raise",
"TimeoutError",
"(",
"\"Timeout connecting to server\"",
")",
... | Connects to the Redis server if not already connected | [
"Connects",
"to",
"the",
"Redis",
"server",
"if",
"not",
"already",
"connected"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L474-L498 | train | Connects to the Redis server if not already connected | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Connection.disconnect | 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:
... | python | 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",
")",
":",
"self",
".",
"_parser",
".",
"on_disconnect",
"(",
")",
"if",
"self",
".",
"_sock",
"is",
"None",
":",
"return",
"if",
"self",
".",
"_selector",
"is",
"not",
"None",
":",
"self",
".",
"_selector",
".",
"clo... | Disconnects from the Redis server | [
"Disconnects",
"from",
"the",
"Redis",
"server"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L566-L580 | train | Disconnects from the Redis server | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Connection.send_packed_command | 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)
... | python | 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",
")",
":",
"if",
"not",
"self",
".",
"_sock",
":",
"self",
".",
"connect",
"(",
")",
"try",
":",
"if",
"isinstance",
"(",
"command",
",",
"str",
")",
":",
"command",
"=",
"[",
"command",
"]",
... | Send an already packed command to the Redis server | [
"Send",
"an",
"already",
"packed",
"command",
"to",
"the",
"Redis",
"server"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L582-L606 | train | Send an already packed command to the Redis server | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Connection.can_read | 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) | python | 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",
")",
":",
"sock",
"=",
"self",
".",
"_sock",
"if",
"not",
"sock",
":",
"self",
".",
"connect",
"(",
")",
"sock",
"=",
"self",
".",
"_sock",
"return",
"self",
".",
"_parser",
".",
"can_read",... | Poll the socket to see if there's data that can be read. | [
"Poll",
"the",
"socket",
"to",
"see",
"if",
"there",
"s",
"data",
"that",
"can",
"be",
"read",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L612-L618 | train | Poll the socket to see if there s data that can be read. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Connection.read_response | 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.... | python | 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",
")",
":",
"try",
":",
"response",
"=",
"self",
".",
"_parser",
".",
"read_response",
"(",
")",
"except",
"socket",
".",
"timeout",
":",
"self",
".",
"disconnect",
"(",
")",
"raise",
"TimeoutError",
"(",
"\"Timeout readi... | Read the response from a previously sent command | [
"Read",
"the",
"response",
"from",
"a",
"previously",
"sent",
"command"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L624-L642 | train | Read the response from a previously sent command | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | Connection.pack_command | 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... | python | 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",
")",
":",
"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... | Pack a series of arguments into the Redis protocol | [
"Pack",
"a",
"series",
"of",
"arguments",
"into",
"the",
"Redis",
"protocol"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L644-L676 | train | Pack a series of arguments into the Redis protocol | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | SSLConnection._connect | 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
... | python | 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",
")",
":",
"sock",
"=",
"super",
"(",
"SSLConnection",
",",
"self",
")",
".",
"_connect",
"(",
")",
"if",
"hasattr",
"(",
"ssl",
",",
"\"create_default_context\"",
")",
":",
"context",
"=",
"ssl",
".",
"create_default_context... | Wrap the socket with SSL support | [
"Wrap",
"the",
"socket",
"with",
"SSL",
"support"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L732-L753 | train | Wrap the socket with SSL support | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | UnixDomainSocketConnection._connect | 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 | python | 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",
")",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_UNIX",
",",
"socket",
".",
"SOCK_STREAM",
")",
"sock",
".",
"settimeout",
"(",
"self",
".",
"socket_timeout",
")",
"sock",
".",
"connect",
"(",
"sel... | Create a Unix domain socket connection | [
"Create",
"a",
"Unix",
"domain",
"socket",
"connection"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L780-L785 | train | Create a Unix domain socket connection | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | ConnectionPool.from_url | 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... | python | 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",
")",
":",
"url",
"=",
"urlparse",
"(",
"url",
")",
"url_options",
"=",
"{",
"}",
"for",
"name",
",",
"value",
"in",
... | 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:... | [
"Return",
"a",
"connection",
"pool",
"configured",
"from",
"the",
"given",
"URL",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L821-L937 | train | Create a new ConnectionPool configured from a given URL. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | ConnectionPool.get_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)
... | python | 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",
")",
":",
"self",
".",
"_checkpid",
"(",
")",
"try",
":",
"connection",
"=",
"self",
".",
"_available_connections",
".",
"pop",
"(",
")",
"except",
"... | Get a connection from the pool | [
"Get",
"a",
"connection",
"from",
"the",
"pool"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L983-L1008 | train | Get a connection from the pool | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | ConnectionPool.get_encoder | 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... | python | 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",
")",
":",
"kwargs",
"=",
"self",
".",
"connection_kwargs",
"return",
"Encoder",
"(",
"encoding",
"=",
"kwargs",
".",
"get",
"(",
"'encoding'",
",",
"'utf-8'",
")",
",",
"encoding_errors",
"=",
"kwargs",
".",
"get",
"(",
... | Return an encoder based on encoding settings | [
"Return",
"an",
"encoder",
"based",
"on",
"encoding",
"settings"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1010-L1017 | train | Return an encoder based on encoding settings | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | ConnectionPool.make_connection | 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) | python | 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",
")",
":",
"if",
"self",
".",
"_created_connections",
">=",
"self",
".",
"max_connections",
":",
"raise",
"ConnectionError",
"(",
"\"Too many connections\"",
")",
"self",
".",
"_created_connections",
"+=",
"1",
"return",
"self... | Create a new connection | [
"Create",
"a",
"new",
"connection"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1019-L1024 | train | Create a new connection | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | ConnectionPool.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() | python | 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",
")",
":",
"self",
".",
"_checkpid",
"(",
")",
"all_conns",
"=",
"chain",
"(",
"self",
".",
"_available_connections",
",",
"self",
".",
"_in_use_connections",
")",
"for",
"connection",
"in",
"all_conns",
":",
"connection",
".... | Disconnects all connections in the pool | [
"Disconnects",
"all",
"connections",
"in",
"the",
"pool"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1034-L1040 | train | Disconnects all connections in the pool | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | BlockingConnectionPool.make_connection | def make_connection(self):
"Make a fresh connection."
connection = self.connection_class(**self.connection_kwargs)
self._connections.append(connection)
return connection | python | 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",
")",
":",
"connection",
"=",
"self",
".",
"connection_class",
"(",
"*",
"*",
"self",
".",
"connection_kwargs",
")",
"self",
".",
"_connections",
".",
"append",
"(",
"connection",
")",
"return",
"connection"
] | Make a fresh connection. | [
"Make",
"a",
"fresh",
"connection",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1103-L1107 | train | Make a fresh connection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | BlockingConnectionPool.get_connection | 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... | python | 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",
")",
":",
"# Make sure we haven't changed process.",
"self",
".",
"_checkpid",
"(",
")",
"# Try and get a connection from the pool. If one isn't available within",
"# se... | 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... | [
"Get",
"a",
"connection",
"blocking",
"for",
"self",
".",
"timeout",
"until",
"a",
"connection",
"is",
"available",
"from",
"the",
"pool",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1109-L1156 | train | Get a connection from the pool. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/connection.py | BlockingConnectionPool.release | 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... | python | 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",
")",
":",
"# Make sure we haven't changed process.",
"self",
".",
"_checkpid",
"(",
")",
"if",
"connection",
".",
"pid",
"!=",
"self",
".",
"pid",
":",
"return",
"# Put the connection back into the pool.",
"try",
"... | Releases the connection back to the pool. | [
"Releases",
"the",
"connection",
"back",
"to",
"the",
"pool",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1158-L1171 | train | Releases the connection back to the pool. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | benchmarks/command_packer_benchmark.py | StringJoiningConnection.pack_command | def pack_command(self, *args):
"Pack a series of arguments into a value Redis command"
args_output = SYM_EMPTY.join([
SYM_EMPTY.join(
(SYM_DOLLAR, str(len(k)).encode(), SYM_CRLF, k, SYM_CRLF))
for k in imap(self.encoder.encode, args)])
output = SYM_EMPTY.j... | python | def pack_command(self, *args):
"Pack a series of arguments into a value Redis command"
args_output = SYM_EMPTY.join([
SYM_EMPTY.join(
(SYM_DOLLAR, str(len(k)).encode(), SYM_CRLF, k, SYM_CRLF))
for k in imap(self.encoder.encode, args)])
output = SYM_EMPTY.j... | [
"def",
"pack_command",
"(",
"self",
",",
"*",
"args",
")",
":",
"args_output",
"=",
"SYM_EMPTY",
".",
"join",
"(",
"[",
"SYM_EMPTY",
".",
"join",
"(",
"(",
"SYM_DOLLAR",
",",
"str",
"(",
"len",
"(",
"k",
")",
")",
".",
"encode",
"(",
")",
",",
"S... | Pack a series of arguments into a value Redis command | [
"Pack",
"a",
"series",
"of",
"arguments",
"into",
"a",
"value",
"Redis",
"command"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/benchmarks/command_packer_benchmark.py#L29-L37 | train | Pack a series of arguments into a value Redis command | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/selector.py | has_selector | def has_selector(selector):
"Determine if the current platform has the selector available"
try:
if selector == 'poll':
# the select module offers the poll selector even if the platform
# doesn't support it. Attempt to poll for nothing to make sure
# poll is available
... | python | def has_selector(selector):
"Determine if the current platform has the selector available"
try:
if selector == 'poll':
# the select module offers the poll selector even if the platform
# doesn't support it. Attempt to poll for nothing to make sure
# poll is available
... | [
"def",
"has_selector",
"(",
"selector",
")",
":",
"try",
":",
"if",
"selector",
"==",
"'poll'",
":",
"# the select module offers the poll selector even if the platform",
"# doesn't support it. Attempt to poll for nothing to make sure",
"# poll is available",
"p",
"=",
"select",
... | Determine if the current platform has the selector available | [
"Determine",
"if",
"the",
"current",
"platform",
"has",
"the",
"selector",
"available"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/selector.py#L169-L183 | train | Determine if the current platform has the selector available | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/selector.py | DefaultSelector | def DefaultSelector(sock):
"Return the best selector for the platform"
global _DEFAULT_SELECTOR
if _DEFAULT_SELECTOR is None:
if has_selector('poll'):
_DEFAULT_SELECTOR = PollSelector
elif hasattr(select, 'select'):
_DEFAULT_SELECTOR = SelectSelector
else:
... | python | def DefaultSelector(sock):
"Return the best selector for the platform"
global _DEFAULT_SELECTOR
if _DEFAULT_SELECTOR is None:
if has_selector('poll'):
_DEFAULT_SELECTOR = PollSelector
elif hasattr(select, 'select'):
_DEFAULT_SELECTOR = SelectSelector
else:
... | [
"def",
"DefaultSelector",
"(",
"sock",
")",
":",
"global",
"_DEFAULT_SELECTOR",
"if",
"_DEFAULT_SELECTOR",
"is",
"None",
":",
"if",
"has_selector",
"(",
"'poll'",
")",
":",
"_DEFAULT_SELECTOR",
"=",
"PollSelector",
"elif",
"hasattr",
"(",
"select",
",",
"'select... | Return the best selector for the platform | [
"Return",
"the",
"best",
"selector",
"for",
"the",
"platform"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/selector.py#L186-L196 | train | Return the best selector for the platform | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/selector.py | BaseSelector.can_read | def can_read(self, timeout=0):
"""
Return True if data is ready to be read from the socket,
otherwise False.
This doesn't guarentee that the socket is still connected, just that
there is data to read.
Automatically retries EINTR errors based on PEP 475.
"""
... | python | def can_read(self, timeout=0):
"""
Return True if data is ready to be read from the socket,
otherwise False.
This doesn't guarentee that the socket is still connected, just that
there is data to read.
Automatically retries EINTR errors based on PEP 475.
"""
... | [
"def",
"can_read",
"(",
"self",
",",
"timeout",
"=",
"0",
")",
":",
"while",
"True",
":",
"try",
":",
"return",
"self",
".",
"check_can_read",
"(",
"timeout",
")",
"except",
"(",
"select",
".",
"error",
",",
"IOError",
")",
"as",
"ex",
":",
"if",
"... | Return True if data is ready to be read from the socket,
otherwise False.
This doesn't guarentee that the socket is still connected, just that
there is data to read.
Automatically retries EINTR errors based on PEP 475. | [
"Return",
"True",
"if",
"data",
"is",
"ready",
"to",
"be",
"read",
"from",
"the",
"socket",
"otherwise",
"False",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/selector.py#L16-L32 | train | Return True if data is ready to be read from the socket False otherwise. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/selector.py | BaseSelector.is_ready_for_command | def is_ready_for_command(self, timeout=0):
"""
Return True if the socket is ready to send a command,
otherwise False.
Automatically retries EINTR errors based on PEP 475.
"""
while True:
try:
return self.check_is_ready_for_command(timeout)
... | python | def is_ready_for_command(self, timeout=0):
"""
Return True if the socket is ready to send a command,
otherwise False.
Automatically retries EINTR errors based on PEP 475.
"""
while True:
try:
return self.check_is_ready_for_command(timeout)
... | [
"def",
"is_ready_for_command",
"(",
"self",
",",
"timeout",
"=",
"0",
")",
":",
"while",
"True",
":",
"try",
":",
"return",
"self",
".",
"check_is_ready_for_command",
"(",
"timeout",
")",
"except",
"(",
"select",
".",
"error",
",",
"IOError",
")",
"as",
... | Return True if the socket is ready to send a command,
otherwise False.
Automatically retries EINTR errors based on PEP 475. | [
"Return",
"True",
"if",
"the",
"socket",
"is",
"ready",
"to",
"send",
"a",
"command",
"otherwise",
"False",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/selector.py#L34-L47 | train | Check if the socket is ready to send a command. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/selector.py | BaseSelector.errno_from_exception | def errno_from_exception(self, ex):
"""
Get the error number from an exception
"""
if hasattr(ex, 'errno'):
return ex.errno
elif ex.args:
return ex.args[0]
else:
return None | python | def errno_from_exception(self, ex):
"""
Get the error number from an exception
"""
if hasattr(ex, 'errno'):
return ex.errno
elif ex.args:
return ex.args[0]
else:
return None | [
"def",
"errno_from_exception",
"(",
"self",
",",
"ex",
")",
":",
"if",
"hasattr",
"(",
"ex",
",",
"'errno'",
")",
":",
"return",
"ex",
".",
"errno",
"elif",
"ex",
".",
"args",
":",
"return",
"ex",
".",
"args",
"[",
"0",
"]",
"else",
":",
"return",
... | Get the error number from an exception | [
"Get",
"the",
"error",
"number",
"from",
"an",
"exception"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/selector.py#L68-L77 | train | Get the error number from an exception object | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/utils.py | from_url | def from_url(url, db=None, **kwargs):
"""
Returns an active Redis client generated from the given database URL.
Will attempt to extract the database id from the path url fragment, if
none is provided.
"""
from redis.client import Redis
return Redis.from_url(url, db, **kwargs) | python | def from_url(url, db=None, **kwargs):
"""
Returns an active Redis client generated from the given database URL.
Will attempt to extract the database id from the path url fragment, if
none is provided.
"""
from redis.client import Redis
return Redis.from_url(url, db, **kwargs) | [
"def",
"from_url",
"(",
"url",
",",
"db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"redis",
".",
"client",
"import",
"Redis",
"return",
"Redis",
".",
"from_url",
"(",
"url",
",",
"db",
",",
"*",
"*",
"kwargs",
")"
] | Returns an active Redis client generated from the given database URL.
Will attempt to extract the database id from the path url fragment, if
none is provided. | [
"Returns",
"an",
"active",
"Redis",
"client",
"generated",
"from",
"the",
"given",
"database",
"URL",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/utils.py#L11-L19 | train | Returns an active Redis client generated from the given database URL. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/sentinel.py | SentinelConnectionPool.rotate_slaves | def rotate_slaves(self):
"Round-robin slave balancer"
slaves = self.sentinel_manager.discover_slaves(self.service_name)
if slaves:
if self.slave_rr_counter is None:
self.slave_rr_counter = random.randint(0, len(slaves) - 1)
for _ in xrange(len(slaves)):
... | python | def rotate_slaves(self):
"Round-robin slave balancer"
slaves = self.sentinel_manager.discover_slaves(self.service_name)
if slaves:
if self.slave_rr_counter is None:
self.slave_rr_counter = random.randint(0, len(slaves) - 1)
for _ in xrange(len(slaves)):
... | [
"def",
"rotate_slaves",
"(",
"self",
")",
":",
"slaves",
"=",
"self",
".",
"sentinel_manager",
".",
"discover_slaves",
"(",
"self",
".",
"service_name",
")",
"if",
"slaves",
":",
"if",
"self",
".",
"slave_rr_counter",
"is",
"None",
":",
"self",
".",
"slave... | Round-robin slave balancer | [
"Round",
"-",
"robin",
"slave",
"balancer"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L109-L125 | train | Round - robin slave balancer | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/sentinel.py | Sentinel.discover_master | def discover_master(self, service_name):
"""
Asks sentinel servers for the Redis master's address corresponding
to the service labeled ``service_name``.
Returns a pair (address, port) or raises MasterNotFoundError if no
master is found.
"""
for sentinel_no, senti... | python | def discover_master(self, service_name):
"""
Asks sentinel servers for the Redis master's address corresponding
to the service labeled ``service_name``.
Returns a pair (address, port) or raises MasterNotFoundError if no
master is found.
"""
for sentinel_no, senti... | [
"def",
"discover_master",
"(",
"self",
",",
"service_name",
")",
":",
"for",
"sentinel_no",
",",
"sentinel",
"in",
"enumerate",
"(",
"self",
".",
"sentinels",
")",
":",
"try",
":",
"masters",
"=",
"sentinel",
".",
"sentinel_masters",
"(",
")",
"except",
"(... | Asks sentinel servers for the Redis master's address corresponding
to the service labeled ``service_name``.
Returns a pair (address, port) or raises MasterNotFoundError if no
master is found. | [
"Asks",
"sentinel",
"servers",
"for",
"the",
"Redis",
"master",
"s",
"address",
"corresponding",
"to",
"the",
"service",
"labeled",
"service_name",
"."
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L193-L212 | train | Discover the master s address corresponding to the service labeled service_name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/sentinel.py | Sentinel.filter_slaves | def filter_slaves(self, slaves):
"Remove slaves that are in an ODOWN or SDOWN state"
slaves_alive = []
for slave in slaves:
if slave['is_odown'] or slave['is_sdown']:
continue
slaves_alive.append((slave['ip'], slave['port']))
return slaves_alive | python | def filter_slaves(self, slaves):
"Remove slaves that are in an ODOWN or SDOWN state"
slaves_alive = []
for slave in slaves:
if slave['is_odown'] or slave['is_sdown']:
continue
slaves_alive.append((slave['ip'], slave['port']))
return slaves_alive | [
"def",
"filter_slaves",
"(",
"self",
",",
"slaves",
")",
":",
"slaves_alive",
"=",
"[",
"]",
"for",
"slave",
"in",
"slaves",
":",
"if",
"slave",
"[",
"'is_odown'",
"]",
"or",
"slave",
"[",
"'is_sdown'",
"]",
":",
"continue",
"slaves_alive",
".",
"append"... | Remove slaves that are in an ODOWN or SDOWN state | [
"Remove",
"slaves",
"that",
"are",
"in",
"an",
"ODOWN",
"or",
"SDOWN",
"state"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L214-L221 | train | Remove slaves that are in an ODOWN or SDOWN state | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
andymccurdy/redis-py | redis/sentinel.py | Sentinel.discover_slaves | def discover_slaves(self, service_name):
"Returns a list of alive slaves for service ``service_name``"
for sentinel in self.sentinels:
try:
slaves = sentinel.sentinel_slaves(service_name)
except (ConnectionError, ResponseError, TimeoutError):
conti... | python | def discover_slaves(self, service_name):
"Returns a list of alive slaves for service ``service_name``"
for sentinel in self.sentinels:
try:
slaves = sentinel.sentinel_slaves(service_name)
except (ConnectionError, ResponseError, TimeoutError):
conti... | [
"def",
"discover_slaves",
"(",
"self",
",",
"service_name",
")",
":",
"for",
"sentinel",
"in",
"self",
".",
"sentinels",
":",
"try",
":",
"slaves",
"=",
"sentinel",
".",
"sentinel_slaves",
"(",
"service_name",
")",
"except",
"(",
"ConnectionError",
",",
"Res... | Returns a list of alive slaves for service ``service_name`` | [
"Returns",
"a",
"list",
"of",
"alive",
"slaves",
"for",
"service",
"service_name"
] | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/sentinel.py#L223-L233 | train | Returns a list of alive slaves for service service_name | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/lightning.py | explain_weights_lightning | def explain_weights_lightning(estimator, vec=None, top=20, target_names=None,
targets=None, feature_names=None,
coef_scale=None):
""" Return an explanation of a lightning estimator weights """
return explain_weights_lightning_not_supported(estimator) | python | def explain_weights_lightning(estimator, vec=None, top=20, target_names=None,
targets=None, feature_names=None,
coef_scale=None):
""" Return an explanation of a lightning estimator weights """
return explain_weights_lightning_not_supported(estimator) | [
"def",
"explain_weights_lightning",
"(",
"estimator",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"20",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",
"coef_scale",
"=",
"None",
")",
":",
"return",
"e... | Return an explanation of a lightning estimator weights | [
"Return",
"an",
"explanation",
"of",
"a",
"lightning",
"estimator",
"weights"
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lightning.py#L20-L24 | train | Return an explanation of a lightning estimator weights | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/lightning.py | explain_prediction_lightning | def explain_prediction_lightning(estimator, doc, vec=None, top=None,
target_names=None, targets=None,
feature_names=None, vectorized=False,
coef_scale=None):
""" Return an explanation of a lightning estimator predicti... | python | def explain_prediction_lightning(estimator, doc, vec=None, top=None,
target_names=None, targets=None,
feature_names=None, vectorized=False,
coef_scale=None):
""" Return an explanation of a lightning estimator predicti... | [
"def",
"explain_prediction_lightning",
"(",
"estimator",
",",
"doc",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"None",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",
"vectorized",
"=",
"False",
",",
... | Return an explanation of a lightning estimator predictions | [
"Return",
"an",
"explanation",
"of",
"a",
"lightning",
"estimator",
"predictions"
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lightning.py#L39-L44 | train | Return an explanation of a lightning estimator prediction | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | format_as_html | def format_as_html(explanation, # type: Explanation
include_styles=True, # type: bool
force_weights=True, # type: bool
show=fields.ALL,
preserve_density=None, # type: Optional[bool]
highlight_spaces=None, # type: Optiona... | python | def format_as_html(explanation, # type: Explanation
include_styles=True, # type: bool
force_weights=True, # type: bool
show=fields.ALL,
preserve_density=None, # type: Optional[bool]
highlight_spaces=None, # type: Optiona... | [
"def",
"format_as_html",
"(",
"explanation",
",",
"# type: Explanation",
"include_styles",
"=",
"True",
",",
"# type: bool",
"force_weights",
"=",
"True",
",",
"# type: bool",
"show",
"=",
"fields",
".",
"ALL",
",",
"preserve_density",
"=",
"None",
",",
"# type: O... | Format explanation as html.
Most styles are inline, but some are included separately in <style> tag,
you can omit them by passing ``include_styles=False`` and call
``format_html_styles`` to render them separately (or just omit them).
With ``force_weights=False``, weights will not be displayed in a table... | [
"Format",
"explanation",
"as",
"html",
".",
"Most",
"styles",
"are",
"inline",
"but",
"some",
"are",
"included",
"separately",
"in",
"<style",
">",
"tag",
"you",
"can",
"omit",
"them",
"by",
"passing",
"include_styles",
"=",
"False",
"and",
"call",
"format_h... | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L37-L118 | train | Formats the explanation as html. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | render_targets_weighted_spans | def render_targets_weighted_spans(
targets, # type: List[TargetExplanation]
preserve_density, # type: Optional[bool]
):
# type: (...) -> List[Optional[str]]
""" Return a list of rendered weighted spans for targets.
Function must accept a list in order to select consistent weight
ra... | python | def render_targets_weighted_spans(
targets, # type: List[TargetExplanation]
preserve_density, # type: Optional[bool]
):
# type: (...) -> List[Optional[str]]
""" Return a list of rendered weighted spans for targets.
Function must accept a list in order to select consistent weight
ra... | [
"def",
"render_targets_weighted_spans",
"(",
"targets",
",",
"# type: List[TargetExplanation]",
"preserve_density",
",",
"# type: Optional[bool]",
")",
":",
"# type: (...) -> List[Optional[str]]",
"prepared_weighted_spans",
"=",
"prepare_weighted_spans",
"(",
"targets",
",",
"pre... | Return a list of rendered weighted spans for targets.
Function must accept a list in order to select consistent weight
ranges across all targets. | [
"Return",
"a",
"list",
"of",
"rendered",
"weighted",
"spans",
"for",
"targets",
".",
"Function",
"must",
"accept",
"a",
"list",
"in",
"order",
"to",
"select",
"consistent",
"weight",
"ranges",
"across",
"all",
"targets",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L142-L165 | train | Returns a list of rendered weighted spans for the given list of targets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | _colorize | def _colorize(token, # type: str
weight, # type: float
weight_range, # type: float
):
# type: (...) -> str
""" Return token wrapped in a span with some styles
(calculated from weight and weight_range) applied.
"""
token = html_escape(token)
if np.iscl... | python | def _colorize(token, # type: str
weight, # type: float
weight_range, # type: float
):
# type: (...) -> str
""" Return token wrapped in a span with some styles
(calculated from weight and weight_range) applied.
"""
token = html_escape(token)
if np.iscl... | [
"def",
"_colorize",
"(",
"token",
",",
"# type: str",
"weight",
",",
"# type: float",
"weight_range",
",",
"# type: float",
")",
":",
"# type: (...) -> str",
"token",
"=",
"html_escape",
"(",
"token",
")",
"if",
"np",
".",
"isclose",
"(",
"weight",
",",
"0.",
... | Return token wrapped in a span with some styles
(calculated from weight and weight_range) applied. | [
"Return",
"token",
"wrapped",
"in",
"a",
"span",
"with",
"some",
"styles",
"(",
"calculated",
"from",
"weight",
"and",
"weight_range",
")",
"applied",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L181-L209 | train | Return a token wrapped in a span with some styles applied from weight and weight_range. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | _weight_opacity | def _weight_opacity(weight, weight_range):
# type: (float, float) -> str
""" Return opacity value for given weight as a string.
"""
min_opacity = 0.8
if np.isclose(weight, 0) and np.isclose(weight_range, 0):
rel_weight = 0.0
else:
rel_weight = abs(weight) / weight_range
retur... | python | def _weight_opacity(weight, weight_range):
# type: (float, float) -> str
""" Return opacity value for given weight as a string.
"""
min_opacity = 0.8
if np.isclose(weight, 0) and np.isclose(weight_range, 0):
rel_weight = 0.0
else:
rel_weight = abs(weight) / weight_range
retur... | [
"def",
"_weight_opacity",
"(",
"weight",
",",
"weight_range",
")",
":",
"# type: (float, float) -> str",
"min_opacity",
"=",
"0.8",
"if",
"np",
".",
"isclose",
"(",
"weight",
",",
"0",
")",
"and",
"np",
".",
"isclose",
"(",
"weight_range",
",",
"0",
")",
"... | Return opacity value for given weight as a string. | [
"Return",
"opacity",
"value",
"for",
"given",
"weight",
"as",
"a",
"string",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L212-L221 | train | Return opacity value for given weight as a string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | weight_color_hsl | def weight_color_hsl(weight, weight_range, min_lightness=0.8):
# type: (float, float, float) -> _HSL_COLOR
""" Return HSL color components for given weight,
where the max absolute weight is given by weight_range.
"""
hue = _hue(weight)
saturation = 1
rel_weight = (abs(weight) / weight_range)... | python | def weight_color_hsl(weight, weight_range, min_lightness=0.8):
# type: (float, float, float) -> _HSL_COLOR
""" Return HSL color components for given weight,
where the max absolute weight is given by weight_range.
"""
hue = _hue(weight)
saturation = 1
rel_weight = (abs(weight) / weight_range)... | [
"def",
"weight_color_hsl",
"(",
"weight",
",",
"weight_range",
",",
"min_lightness",
"=",
"0.8",
")",
":",
"# type: (float, float, float) -> _HSL_COLOR",
"hue",
"=",
"_hue",
"(",
"weight",
")",
"saturation",
"=",
"1",
"rel_weight",
"=",
"(",
"abs",
"(",
"weight"... | Return HSL color components for given weight,
where the max absolute weight is given by weight_range. | [
"Return",
"HSL",
"color",
"components",
"for",
"given",
"weight",
"where",
"the",
"max",
"absolute",
"weight",
"is",
"given",
"by",
"weight_range",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L227-L236 | train | Return HSL color components for given weight. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | format_hsl | def format_hsl(hsl_color):
# type: (_HSL_COLOR) -> str
""" Format hsl color as css color string.
"""
hue, saturation, lightness = hsl_color
return 'hsl({}, {:.2%}, {:.2%})'.format(hue, saturation, lightness) | python | def format_hsl(hsl_color):
# type: (_HSL_COLOR) -> str
""" Format hsl color as css color string.
"""
hue, saturation, lightness = hsl_color
return 'hsl({}, {:.2%}, {:.2%})'.format(hue, saturation, lightness) | [
"def",
"format_hsl",
"(",
"hsl_color",
")",
":",
"# type: (_HSL_COLOR) -> str",
"hue",
",",
"saturation",
",",
"lightness",
"=",
"hsl_color",
"return",
"'hsl({}, {:.2%}, {:.2%})'",
".",
"format",
"(",
"hue",
",",
"saturation",
",",
"lightness",
")"
] | Format hsl color as css color string. | [
"Format",
"hsl",
"color",
"as",
"css",
"color",
"string",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L239-L244 | train | Format hsl color as css color string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | get_weight_range | def get_weight_range(weights):
# type: (FeatureWeights) -> float
""" Max absolute feature for pos and neg weights.
"""
return max_or_0(abs(fw.weight)
for lst in [weights.pos, weights.neg]
for fw in lst or []) | python | def get_weight_range(weights):
# type: (FeatureWeights) -> float
""" Max absolute feature for pos and neg weights.
"""
return max_or_0(abs(fw.weight)
for lst in [weights.pos, weights.neg]
for fw in lst or []) | [
"def",
"get_weight_range",
"(",
"weights",
")",
":",
"# type: (FeatureWeights) -> float",
"return",
"max_or_0",
"(",
"abs",
"(",
"fw",
".",
"weight",
")",
"for",
"lst",
"in",
"[",
"weights",
".",
"pos",
",",
"weights",
".",
"neg",
"]",
"for",
"fw",
"in",
... | Max absolute feature for pos and neg weights. | [
"Max",
"absolute",
"feature",
"for",
"pos",
"and",
"neg",
"weights",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L252-L258 | train | Returns the maximum absolute feature for pos and neg weights. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | remaining_weight_color_hsl | def remaining_weight_color_hsl(
ws, # type: List[FeatureWeight]
weight_range, # type: float
pos_neg, # type: str
):
# type: (...) -> _HSL_COLOR
""" Color for "remaining" row.
Handles a number of edge cases: if there are no weights in ws or weight_range
is zero, assume the ... | python | def remaining_weight_color_hsl(
ws, # type: List[FeatureWeight]
weight_range, # type: float
pos_neg, # type: str
):
# type: (...) -> _HSL_COLOR
""" Color for "remaining" row.
Handles a number of edge cases: if there are no weights in ws or weight_range
is zero, assume the ... | [
"def",
"remaining_weight_color_hsl",
"(",
"ws",
",",
"# type: List[FeatureWeight]",
"weight_range",
",",
"# type: float",
"pos_neg",
",",
"# type: str",
")",
":",
"# type: (...) -> _HSL_COLOR",
"sign",
"=",
"{",
"'pos'",
":",
"1.0",
",",
"'neg'",
":",
"-",
"1.0",
... | Color for "remaining" row.
Handles a number of edge cases: if there are no weights in ws or weight_range
is zero, assume the worst (most intensive positive or negative color). | [
"Color",
"for",
"remaining",
"row",
".",
"Handles",
"a",
"number",
"of",
"edge",
"cases",
":",
"if",
"there",
"are",
"no",
"weights",
"in",
"ws",
"or",
"weight_range",
"is",
"zero",
"assume",
"the",
"worst",
"(",
"most",
"intensive",
"positive",
"or",
"n... | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L261-L279 | train | Color for remaining row. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | _format_unhashed_feature | def _format_unhashed_feature(feature, weight, hl_spaces):
# type: (...) -> str
""" Format unhashed feature: show first (most probable) candidate,
display other candidates in title attribute.
"""
if not feature:
return ''
else:
first, rest = feature[0], feature[1:]
html = ... | python | def _format_unhashed_feature(feature, weight, hl_spaces):
# type: (...) -> str
""" Format unhashed feature: show first (most probable) candidate,
display other candidates in title attribute.
"""
if not feature:
return ''
else:
first, rest = feature[0], feature[1:]
html = ... | [
"def",
"_format_unhashed_feature",
"(",
"feature",
",",
"weight",
",",
"hl_spaces",
")",
":",
"# type: (...) -> str",
"if",
"not",
"feature",
":",
"return",
"''",
"else",
":",
"first",
",",
"rest",
"=",
"feature",
"[",
"0",
"]",
",",
"feature",
"[",
"1",
... | Format unhashed feature: show first (most probable) candidate,
display other candidates in title attribute. | [
"Format",
"unhashed",
"feature",
":",
"show",
"first",
"(",
"most",
"probable",
")",
"candidate",
"display",
"other",
"candidates",
"in",
"title",
"attribute",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L282-L296 | train | Format unhashed feature. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/html.py | _format_feature | def _format_feature(feature, weight, hl_spaces):
# type: (...) -> str
""" Format any feature.
"""
if isinstance(feature, FormattedFeatureName):
return feature.format()
elif (isinstance(feature, list) and
all('name' in x and 'sign' in x for x in feature)):
return _format_u... | python | def _format_feature(feature, weight, hl_spaces):
# type: (...) -> str
""" Format any feature.
"""
if isinstance(feature, FormattedFeatureName):
return feature.format()
elif (isinstance(feature, list) and
all('name' in x and 'sign' in x for x in feature)):
return _format_u... | [
"def",
"_format_feature",
"(",
"feature",
",",
"weight",
",",
"hl_spaces",
")",
":",
"# type: (...) -> str",
"if",
"isinstance",
"(",
"feature",
",",
"FormattedFeatureName",
")",
":",
"return",
"feature",
".",
"format",
"(",
")",
"elif",
"(",
"isinstance",
"("... | Format any feature. | [
"Format",
"any",
"feature",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/html.py#L299-L309 | train | Format any feature. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/lightgbm.py | explain_weights_lightgbm | def explain_weights_lightgbm(lgb,
vec=None,
top=20,
target_names=None, # ignored
targets=None, # ignored
feature_names=None,
feature_re=None,
... | python | def explain_weights_lightgbm(lgb,
vec=None,
top=20,
target_names=None, # ignored
targets=None, # ignored
feature_names=None,
feature_re=None,
... | [
"def",
"explain_weights_lightgbm",
"(",
"lgb",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"20",
",",
"target_names",
"=",
"None",
",",
"# ignored",
"targets",
"=",
"None",
",",
"# ignored",
"feature_names",
"=",
"None",
",",
"feature_re",
"=",
"None",
",",
... | Return an explanation of an LightGBM estimator (via scikit-learn wrapper
LGBMClassifier or LGBMRegressor) as feature importances.
See :func:`eli5.explain_weights` for description of
``top``, ``feature_names``,
``feature_re`` and ``feature_filter`` parameters.
``target_names`` and ``targets`` param... | [
"Return",
"an",
"explanation",
"of",
"an",
"LightGBM",
"estimator",
"(",
"via",
"scikit",
"-",
"learn",
"wrapper",
"LGBMClassifier",
"or",
"LGBMRegressor",
")",
"as",
"feature",
"importances",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lightgbm.py#L23-L65 | train | Return an explanation of a LightGBM estimator or LGBMRegressor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/lightgbm.py | explain_prediction_lightgbm | def explain_prediction_lightgbm(
lgb, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=None,
feature_re=None,
feature_filter=None,
vectorized=False,
):
""" Return an explanation of LightG... | python | def explain_prediction_lightgbm(
lgb, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=None,
feature_re=None,
feature_filter=None,
vectorized=False,
):
""" Return an explanation of LightG... | [
"def",
"explain_prediction_lightgbm",
"(",
"lgb",
",",
"doc",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"None",
",",
"top_targets",
"=",
"None",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",
"featu... | Return an explanation of LightGBM prediction (via scikit-learn wrapper
LGBMClassifier or LGBMRegressor) as feature weights.
See :func:`eli5.explain_prediction` for description of
``top``, ``top_targets``, ``target_names``, ``targets``,
``feature_names``, ``feature_re`` and ``feature_filter`` parameters... | [
"Return",
"an",
"explanation",
"of",
"LightGBM",
"prediction",
"(",
"via",
"scikit",
"-",
"learn",
"wrapper",
"LGBMClassifier",
"or",
"LGBMRegressor",
")",
"as",
"feature",
"weights",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lightgbm.py#L70-L151 | train | Return an explanation of the prediction of a light - gauss - M model. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/lightgbm.py | _compute_node_values | def _compute_node_values(tree_info):
""" Add node_value key with an expected value for non-leaf nodes """
def walk(tree):
if 'leaf_value' in tree:
return tree['leaf_value'], tree.get('leaf_count', 0)
left_value, left_count = walk(tree['left_child'])
right_value, right_count =... | python | def _compute_node_values(tree_info):
""" Add node_value key with an expected value for non-leaf nodes """
def walk(tree):
if 'leaf_value' in tree:
return tree['leaf_value'], tree.get('leaf_count', 0)
left_value, left_count = walk(tree['left_child'])
right_value, right_count =... | [
"def",
"_compute_node_values",
"(",
"tree_info",
")",
":",
"def",
"walk",
"(",
"tree",
")",
":",
"if",
"'leaf_value'",
"in",
"tree",
":",
"return",
"tree",
"[",
"'leaf_value'",
"]",
",",
"tree",
".",
"get",
"(",
"'leaf_count'",
",",
"0",
")",
"left_value... | Add node_value key with an expected value for non-leaf nodes | [
"Add",
"node_value",
"key",
"with",
"an",
"expected",
"value",
"for",
"non",
"-",
"leaf",
"nodes"
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lightgbm.py#L170-L187 | train | Compute the node value for all leaf nodes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/lightgbm.py | _changes | def _changes(path):
"""
>>> _changes([2, 3, 0, 5])
[2, 1, -3, 5]
>>> _changes([2])
[2]
"""
res = [path[0]]
res += [p - p_prev for p, p_prev in zip(path[1:], path)]
return res | python | def _changes(path):
"""
>>> _changes([2, 3, 0, 5])
[2, 1, -3, 5]
>>> _changes([2])
[2]
"""
res = [path[0]]
res += [p - p_prev for p, p_prev in zip(path[1:], path)]
return res | [
"def",
"_changes",
"(",
"path",
")",
":",
"res",
"=",
"[",
"path",
"[",
"0",
"]",
"]",
"res",
"+=",
"[",
"p",
"-",
"p_prev",
"for",
"p",
",",
"p_prev",
"in",
"zip",
"(",
"path",
"[",
"1",
":",
"]",
",",
"path",
")",
"]",
"return",
"res"
] | >>> _changes([2, 3, 0, 5])
[2, 1, -3, 5]
>>> _changes([2])
[2] | [
">>>",
"_changes",
"(",
"[",
"2",
"3",
"0",
"5",
"]",
")",
"[",
"2",
"1",
"-",
"3",
"5",
"]",
">>>",
"_changes",
"(",
"[",
"2",
"]",
")",
"[",
"2",
"]"
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lightgbm.py#L207-L216 | train | Return a list of changes in a path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/lightgbm.py | _get_prediction_feature_weights | def _get_prediction_feature_weights(lgb, X, n_targets):
"""
Return a list of {feat_id: value} dicts with feature weights,
following ideas from http://blog.datadive.net/interpreting-random-forests/
"""
if n_targets == 2:
n_targets = 1
dump = lgb.booster_.dump_model()
tree_info = ... | python | def _get_prediction_feature_weights(lgb, X, n_targets):
"""
Return a list of {feat_id: value} dicts with feature weights,
following ideas from http://blog.datadive.net/interpreting-random-forests/
"""
if n_targets == 2:
n_targets = 1
dump = lgb.booster_.dump_model()
tree_info = ... | [
"def",
"_get_prediction_feature_weights",
"(",
"lgb",
",",
"X",
",",
"n_targets",
")",
":",
"if",
"n_targets",
"==",
"2",
":",
"n_targets",
"=",
"1",
"dump",
"=",
"lgb",
".",
"booster_",
".",
"dump_model",
"(",
")",
"tree_info",
"=",
"dump",
"[",
"'tree_... | Return a list of {feat_id: value} dicts with feature weights,
following ideas from http://blog.datadive.net/interpreting-random-forests/ | [
"Return",
"a",
"list",
"of",
"{",
"feat_id",
":",
"value",
"}",
"dicts",
"with",
"feature",
"weights",
"following",
"ideas",
"from",
"http",
":",
"//",
"blog",
".",
"datadive",
".",
"net",
"/",
"interpreting",
"-",
"random",
"-",
"forests",
"/"
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lightgbm.py#L240-L266 | train | Returns a list of feature weights dicts with feature weights. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/utils.py | replace_spaces | def replace_spaces(s, replacer):
# type: (str, Callable[[int, str], str]) -> str
"""
>>> replace_spaces('ab', lambda n, l: '_' * n)
'ab'
>>> replace_spaces('a b', lambda n, l: '_' * n)
'a_b'
>>> replace_spaces(' ab', lambda n, l: '_' * n)
'_ab'
>>> replace_spaces(' a b ', lambda n, ... | python | def replace_spaces(s, replacer):
# type: (str, Callable[[int, str], str]) -> str
"""
>>> replace_spaces('ab', lambda n, l: '_' * n)
'ab'
>>> replace_spaces('a b', lambda n, l: '_' * n)
'a_b'
>>> replace_spaces(' ab', lambda n, l: '_' * n)
'_ab'
>>> replace_spaces(' a b ', lambda n, ... | [
"def",
"replace_spaces",
"(",
"s",
",",
"replacer",
")",
":",
"# type: (str, Callable[[int, str], str]) -> str",
"def",
"replace",
"(",
"m",
")",
":",
"# type: (Match[str]) -> str",
"if",
"m",
".",
"start",
"(",
")",
"==",
"0",
":",
"side",
"=",
"'left'",
"eli... | >>> replace_spaces('ab', lambda n, l: '_' * n)
'ab'
>>> replace_spaces('a b', lambda n, l: '_' * n)
'a_b'
>>> replace_spaces(' ab', lambda n, l: '_' * n)
'_ab'
>>> replace_spaces(' a b ', lambda n, s: s * n)
'leftleftacenterbright'
>>> replace_spaces(' a b ', lambda n, _: '0 0' * n)
... | [
">>>",
"replace_spaces",
"(",
"ab",
"lambda",
"n",
"l",
":",
"_",
"*",
"n",
")",
"ab",
">>>",
"replace_spaces",
"(",
"a",
"b",
"lambda",
"n",
"l",
":",
"_",
"*",
"n",
")",
"a_b",
">>>",
"replace_spaces",
"(",
"ab",
"lambda",
"n",
"l",
":",
"_",
... | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/utils.py#L14-L38 | train | Replace spaces in a string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/utils.py | format_signed | def format_signed(feature, # type: Dict[str, Any]
formatter=None, # type: Callable[..., str]
**kwargs
):
# type: (...) -> str
"""
Format unhashed feature with sign.
>>> format_signed({'name': 'foo', 'sign': 1})
'foo'
>>> format_signed({'na... | python | def format_signed(feature, # type: Dict[str, Any]
formatter=None, # type: Callable[..., str]
**kwargs
):
# type: (...) -> str
"""
Format unhashed feature with sign.
>>> format_signed({'name': 'foo', 'sign': 1})
'foo'
>>> format_signed({'na... | [
"def",
"format_signed",
"(",
"feature",
",",
"# type: Dict[str, Any]",
"formatter",
"=",
"None",
",",
"# type: Callable[..., str]",
"*",
"*",
"kwargs",
")",
":",
"# type: (...) -> str",
"txt",
"=",
"''",
"if",
"feature",
"[",
"'sign'",
"]",
">",
"0",
"else",
"... | Format unhashed feature with sign.
>>> format_signed({'name': 'foo', 'sign': 1})
'foo'
>>> format_signed({'name': 'foo', 'sign': -1})
'(-)foo'
>>> format_signed({'name': ' foo', 'sign': -1}, lambda x: '"{}"'.format(x))
'(-)" foo"' | [
"Format",
"unhashed",
"feature",
"with",
"sign",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/utils.py#L41-L60 | train | Format unhashed feature with sign. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/formatters/utils.py | tabulate | def tabulate(data, # type: List[List[Any]]
header=None, # type: Optional[List[Any]]
col_align=None, # type: Union[str, List[str]]
):
# type: (...) -> List[str]
""" Format data as a table without any fancy features.
col_align: l/r/c or a list/string of l/r/c. l = lef... | python | def tabulate(data, # type: List[List[Any]]
header=None, # type: Optional[List[Any]]
col_align=None, # type: Union[str, List[str]]
):
# type: (...) -> List[str]
""" Format data as a table without any fancy features.
col_align: l/r/c or a list/string of l/r/c. l = lef... | [
"def",
"tabulate",
"(",
"data",
",",
"# type: List[List[Any]]",
"header",
"=",
"None",
",",
"# type: Optional[List[Any]]",
"col_align",
"=",
"None",
",",
"# type: Union[str, List[str]]",
")",
":",
"# type: (...) -> List[str]",
"if",
"not",
"data",
"and",
"not",
"heade... | Format data as a table without any fancy features.
col_align: l/r/c or a list/string of l/r/c. l = left, r = right, c = center
Return a list of strings (lines of the table). | [
"Format",
"data",
"as",
"a",
"table",
"without",
"any",
"fancy",
"features",
".",
"col_align",
":",
"l",
"/",
"r",
"/",
"c",
"or",
"a",
"list",
"/",
"string",
"of",
"l",
"/",
"r",
"/",
"c",
".",
"l",
"=",
"left",
"r",
"=",
"right",
"c",
"=",
... | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/formatters/utils.py#L99-L140 | train | Return a list of strings that can be used to display a table of data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | explain_prediction_sklearn | def explain_prediction_sklearn(estimator, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=No... | python | def explain_prediction_sklearn(estimator, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=No... | [
"def",
"explain_prediction_sklearn",
"(",
"estimator",
",",
"doc",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"None",
",",
"top_targets",
"=",
"None",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",
"... | Return an explanation of a scikit-learn estimator | [
"Return",
"an",
"explanation",
"of",
"a",
"scikit",
"-",
"learn",
"estimator"
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L77-L88 | train | Return an explanation of a scikit - learn estimator. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | explain_prediction_linear_classifier | def explain_prediction_linear_classifier(clf, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets... | python | def explain_prediction_linear_classifier(clf, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets... | [
"def",
"explain_prediction_linear_classifier",
"(",
"clf",
",",
"doc",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"None",
",",
"top_targets",
"=",
"None",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",... | Explain prediction of a linear classifier.
See :func:`eli5.explain_prediction` for description of
``top``, ``top_targets``, ``target_names``, ``targets``,
``feature_names``, ``feature_re`` and ``feature_filter`` parameters.
``vec`` is a vectorizer instance used to transform
raw features to the inp... | [
"Explain",
"prediction",
"of",
"a",
"linear",
"classifier",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L140-L221 | train | Explain prediction of a linear classifier. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | explain_prediction_linear_regressor | def explain_prediction_linear_regressor(reg, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,... | python | def explain_prediction_linear_regressor(reg, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,... | [
"def",
"explain_prediction_linear_regressor",
"(",
"reg",
",",
"doc",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"None",
",",
"top_targets",
"=",
"None",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",
... | Explain prediction of a linear regressor.
See :func:`eli5.explain_prediction` for description of
``top``, ``top_targets``, ``target_names``, ``targets``,
``feature_names``, ``feature_re`` and ``feature_filter`` parameters.
``vec`` is a vectorizer instance used to transform
raw features to the inpu... | [
"Explain",
"prediction",
"of",
"a",
"linear",
"regressor",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L258-L331 | train | Explain prediction of a linear regressor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | explain_prediction_tree_classifier | def explain_prediction_tree_classifier(
clf, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=None,
feature_re=None,
feature_filter=None,
vectorized=False):
""" Explain prediction of a tree class... | python | def explain_prediction_tree_classifier(
clf, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=None,
feature_re=None,
feature_filter=None,
vectorized=False):
""" Explain prediction of a tree class... | [
"def",
"explain_prediction_tree_classifier",
"(",
"clf",
",",
"doc",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"None",
",",
"top_targets",
"=",
"None",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",
... | Explain prediction of a tree classifier.
See :func:`eli5.explain_prediction` for description of
``top``, ``top_targets``, ``target_names``, ``targets``,
``feature_names``, ``feature_re`` and ``feature_filter`` parameters.
``vec`` is a vectorizer instance used to transform
raw features to the input... | [
"Explain",
"prediction",
"of",
"a",
"tree",
"classifier",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L363-L459 | train | Explain prediction of a tree classifier. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | explain_prediction_tree_regressor | def explain_prediction_tree_regressor(
reg, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=None,
feature_re=None,
feature_filter=None,
vectorized=False):
""" Explain prediction of a tree regres... | python | def explain_prediction_tree_regressor(
reg, doc,
vec=None,
top=None,
top_targets=None,
target_names=None,
targets=None,
feature_names=None,
feature_re=None,
feature_filter=None,
vectorized=False):
""" Explain prediction of a tree regres... | [
"def",
"explain_prediction_tree_regressor",
"(",
"reg",
",",
"doc",
",",
"vec",
"=",
"None",
",",
"top",
"=",
"None",
",",
"top_targets",
"=",
"None",
",",
"target_names",
"=",
"None",
",",
"targets",
"=",
"None",
",",
"feature_names",
"=",
"None",
",",
... | Explain prediction of a tree regressor.
See :func:`eli5.explain_prediction` for description of
``top``, ``top_targets``, ``target_names``, ``targets``,
``feature_names``, ``feature_re`` and ``feature_filter`` parameters.
``vec`` is a vectorizer instance used to transform
raw features to the input ... | [
"Explain",
"prediction",
"of",
"a",
"tree",
"regressor",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L466-L554 | train | Explain prediction of a tree regressor. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | _trees_feature_weights | def _trees_feature_weights(clf, X, feature_names, num_targets):
""" Return feature weights for a tree or a tree ensemble.
"""
feature_weights = np.zeros([len(feature_names), num_targets])
if hasattr(clf, 'tree_'):
_update_tree_feature_weights(X, feature_names, clf, feature_weights)
else:
... | python | def _trees_feature_weights(clf, X, feature_names, num_targets):
""" Return feature weights for a tree or a tree ensemble.
"""
feature_weights = np.zeros([len(feature_names), num_targets])
if hasattr(clf, 'tree_'):
_update_tree_feature_weights(X, feature_names, clf, feature_weights)
else:
... | [
"def",
"_trees_feature_weights",
"(",
"clf",
",",
"X",
",",
"feature_names",
",",
"num_targets",
")",
":",
"feature_weights",
"=",
"np",
".",
"zeros",
"(",
"[",
"len",
"(",
"feature_names",
")",
",",
"num_targets",
"]",
")",
"if",
"hasattr",
"(",
"clf",
... | Return feature weights for a tree or a tree ensemble. | [
"Return",
"feature",
"weights",
"for",
"a",
"tree",
"or",
"a",
"tree",
"ensemble",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L557-L582 | train | Return feature weights for a tree or a tree ensemble. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | _update_tree_feature_weights | def _update_tree_feature_weights(X, feature_names, clf, feature_weights):
""" Update tree feature weights using decision path method.
"""
tree_value = clf.tree_.value
if tree_value.shape[1] == 1:
squeeze_axis = 1
else:
assert tree_value.shape[2] == 1
squeeze_axis = 2
tree... | python | def _update_tree_feature_weights(X, feature_names, clf, feature_weights):
""" Update tree feature weights using decision path method.
"""
tree_value = clf.tree_.value
if tree_value.shape[1] == 1:
squeeze_axis = 1
else:
assert tree_value.shape[2] == 1
squeeze_axis = 2
tree... | [
"def",
"_update_tree_feature_weights",
"(",
"X",
",",
"feature_names",
",",
"clf",
",",
"feature_weights",
")",
":",
"tree_value",
"=",
"clf",
".",
"tree_",
".",
"value",
"if",
"tree_value",
".",
"shape",
"[",
"1",
"]",
"==",
"1",
":",
"squeeze_axis",
"=",... | Update tree feature weights using decision path method. | [
"Update",
"tree",
"feature",
"weights",
"using",
"decision",
"path",
"method",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L585-L606 | train | Update tree feature weights using decision path method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | _multiply | def _multiply(X, coef):
""" Multiple X by coef element-wise, preserving sparsity. """
if sp.issparse(X):
return X.multiply(sp.csr_matrix(coef))
else:
return np.multiply(X, coef) | python | def _multiply(X, coef):
""" Multiple X by coef element-wise, preserving sparsity. """
if sp.issparse(X):
return X.multiply(sp.csr_matrix(coef))
else:
return np.multiply(X, coef) | [
"def",
"_multiply",
"(",
"X",
",",
"coef",
")",
":",
"if",
"sp",
".",
"issparse",
"(",
"X",
")",
":",
"return",
"X",
".",
"multiply",
"(",
"sp",
".",
"csr_matrix",
"(",
"coef",
")",
")",
"else",
":",
"return",
"np",
".",
"multiply",
"(",
"X",
"... | Multiple X by coef element-wise, preserving sparsity. | [
"Multiple",
"X",
"by",
"coef",
"element",
"-",
"wise",
"preserving",
"sparsity",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L610-L615 | train | Multiplies X by coef element - wise preserving sparsity. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/sklearn/explain_prediction.py | _linear_weights | def _linear_weights(clf, x, top, flt_feature_names, flt_indices):
""" Return top weights getter for label_id.
"""
def _weights(label_id, scale=1.0):
coef = get_coef(clf, label_id)
scores = _multiply(x, coef)
return get_top_features_filtered(x, flt_feature_names, flt_indices,
... | python | def _linear_weights(clf, x, top, flt_feature_names, flt_indices):
""" Return top weights getter for label_id.
"""
def _weights(label_id, scale=1.0):
coef = get_coef(clf, label_id)
scores = _multiply(x, coef)
return get_top_features_filtered(x, flt_feature_names, flt_indices,
... | [
"def",
"_linear_weights",
"(",
"clf",
",",
"x",
",",
"top",
",",
"flt_feature_names",
",",
"flt_indices",
")",
":",
"def",
"_weights",
"(",
"label_id",
",",
"scale",
"=",
"1.0",
")",
":",
"coef",
"=",
"get_coef",
"(",
"clf",
",",
"label_id",
")",
"scor... | Return top weights getter for label_id. | [
"Return",
"top",
"weights",
"getter",
"for",
"label_id",
"."
] | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/sklearn/explain_prediction.py#L618-L626 | train | Return linear weights getter for label_id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
TeamHG-Memex/eli5 | eli5/base_utils.py | attrs | def attrs(class_):
""" Like attr.s with slots=True,
but with attributes extracted from __init__ method signature.
slots=True ensures that signature matches what really happens
(we can't define different attributes on self).
It is useful if we still want __init__ for proper type-checking and
do n... | python | def attrs(class_):
""" Like attr.s with slots=True,
but with attributes extracted from __init__ method signature.
slots=True ensures that signature matches what really happens
(we can't define different attributes on self).
It is useful if we still want __init__ for proper type-checking and
do n... | [
"def",
"attrs",
"(",
"class_",
")",
":",
"attrs_kwargs",
"=",
"{",
"}",
"for",
"method",
",",
"kw_name",
"in",
"[",
"(",
"'__repr__'",
",",
"'repr'",
")",
",",
"(",
"'__eq__'",
",",
"'cmp'",
")",
",",
"(",
"'__hash__'",
",",
"'hash'",
")",
",",
"]"... | Like attr.s with slots=True,
but with attributes extracted from __init__ method signature.
slots=True ensures that signature matches what really happens
(we can't define different attributes on self).
It is useful if we still want __init__ for proper type-checking and
do not want to repeat attribute... | [
"Like",
"attr",
".",
"s",
"with",
"slots",
"=",
"True",
"but",
"with",
"attributes",
"extracted",
"from",
"__init__",
"method",
"signature",
".",
"slots",
"=",
"True",
"ensures",
"that",
"signature",
"matches",
"what",
"really",
"happens",
"(",
"we",
"can",
... | 371b402a0676295c05e582a2dd591f7af476b86b | https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/base_utils.py#L11-L36 | train | Like attr. s but with slots = True and attributes extracted from the class s __init__ method signature. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.