#NEWLINE# def _incrdecr( self , cmd , key , val ) : #NEWLINE# #INDENT# '\n        Internal wrapper for incr/decr.\n        ' #NEWLINE# if self . _disconnected : #NEWLINE# #INDENT# return fail ( RuntimeError ( 'not connected' ) ) #NEWLINE# #UNINDENT# if ( not isinstance ( key , str ) ) : #NEWLINE# #INDENT# return fail ( ClientError ( ( 'Invalid type for key: %s, expecting a string' % ( type ( key ) , ) ) ) ) #NEWLINE# #UNINDENT# if ( len ( key ) > self . MAX_KEY_LENGTH ) : #NEWLINE# #INDENT# return fail ( ClientError ( 'Key too long' ) ) #NEWLINE# #UNINDENT# fullcmd = ( '%s %s %d' % ( cmd , key , int ( val ) ) ) #NEWLINE# self . sendLine ( fullcmd ) #NEWLINE# cmdObj = Command ( cmd , key = key ) #NEWLINE# self . _current . append ( cmdObj ) #NEWLINE# return cmdObj . _deferred