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)))
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