Exemple #1
0
def zset_score_pairs(response, **options):
    """
    If ``withscores`` is specified in the options, return the response as
    a list of (value, score) pairs
    """
    if not response or not options['withscores']:
        return response
    it = iter(response)
    return list(izip(it, imap(int, it)))
Exemple #2
0
def zset_score_pairs(response, **options):
    """
    If ``withscores`` is specified in the options, return the response as
    a list of (value, score) pairs
    """
    if not response or not options['withscores']:
        return response
    it = iter(response)
    return list(izip(it, imap(int, it)))
Exemple #3
0
 def pack_command(self, *args):
     "Pack a series of arguments into a value Ledis command"
     output = SYM_STAR + b(str(len(args))) + SYM_CRLF
     for enc_value in imap(self.encode, args):
         output += SYM_DOLLAR
         output += b(str(len(enc_value)))
         output += SYM_CRLF
         output += enc_value
         output += SYM_CRLF
     return output
Exemple #4
0
 def pack_command(self, *args):
     "Pack a series of arguments into a value Ledis command"
     output = SYM_STAR + b(str(len(args))) + SYM_CRLF
     for enc_value in imap(self.encode, args):
         output += SYM_DOLLAR
         output += b(str(len(enc_value)))
         output += SYM_CRLF
         output += enc_value
         output += SYM_CRLF
     return output