#NEWLINE# def _convert_slice( self , s ) : #NEWLINE# #INDENT# def _slice_to_indexes( s ) : #NEWLINE# #INDENT# start = s . start #NEWLINE# stop = s . stop #NEWLINE# if ( isinstance ( start , int ) or isinstance ( stop , int ) ) : #NEWLINE# #INDENT# return ( start , stop ) #NEWLINE# #UNINDENT# if start : #NEWLINE# #INDENT# start = self . database . zrank ( self . key , start ) #NEWLINE# if ( start is None ) : #NEWLINE# #INDENT# raise KeyError ( s . start ) #NEWLINE# #UNINDENT# #UNINDENT# if stop : #NEWLINE# #INDENT# stop = self . database . zrank ( self . key , stop ) #NEWLINE# if ( stop is None ) : #NEWLINE# #INDENT# raise KeyError ( s . stop ) #NEWLINE# #UNINDENT# #UNINDENT# return ( start , stop ) #NEWLINE# #UNINDENT# ( start , stop ) = _slice_to_indexes ( stop ) #NEWLINE# start = ( start or 0 ) #NEWLINE# if ( not stop ) : #NEWLINE# #INDENT# stop = ( - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stop -= 1 #NEWLINE# #UNINDENT# return ( start , stop )