#NEWLINE# @ query #NEWLINE# def least_common( self , n = None , reverse = False ) : #NEWLINE# #INDENT# 'Returns a list of the ``n`` least common (exactly, lowly\n        scored) members and their counts (scores) from the least\n        common to the most.  If ``n`` is not specified, it returns\n        *all* members in the set.  Members with equal scores are\n        ordered arbitarily.\n\n        :param n: the number of members to get\n        :type n: :class:`numbers.Integral`\n        :returns: an ordered list of pairs.\n                  every pair looks like (element, score)\n        :rtype: :class:`collections.Sequence`\n\n        .. note::\n\n           This method is directly mapped to :redis:`ZREVRANGE`\n           command and ``WITHSCORES`` option.\n\n        ' #NEWLINE# if ( n is None ) : #NEWLINE# #INDENT# n = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( n , numbers . Integral ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'n must be an integer, not ' + repr ( n ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# client = self . session . client #NEWLINE# zrange = ( client . zrevrange if reverse else client . zrange ) #NEWLINE# pairs = zrange ( self . key , 0 , ( n - 1 ) , withscores = True ) #NEWLINE# decode = self . value_type . decode #NEWLINE# return [ ( decode ( value ) , score ) for ( value , score ) in pairs ]