def _get_incdec_value(match, incdec, url, count):
 (pre, zeroes, number, post) = match.groups()
 val = int(number)
 if (incdec == 'decrement'):
  if (val <= 0):
   raise IncDecError("Can't decrement {}!".format(val), url)
  val -= count
 elif (incdec == 'increment'):
  val += count
 else:
  raise ValueError('Invalid value {} for indec!'.format(incdec))
 if zeroes:
  if (len(number) < len(str(val))):
   zeroes = zeroes[1:]
  elif (len(number) > len(str(val))):
   zeroes += '0'
 return ''.join([pre, zeroes, str(val), post])

def _get_incdec_value ( match , incdec , url , count ) : ( pre , zeroes , number , post ) = match . groups ( ) val = int ( number ) if ( incdec == 'decrement' ) : if ( val <= 0 ) : raise IncDecError ( "Can't decrement {}!" . format ( val ) , url ) val -= count elif ( incdec == 'increment' ) : val += count else : raise ValueError ( 'Invalid value {} for indec!' . format ( incdec ) ) if zeroes : if ( len ( number ) < len ( str ( val ) ) ) : zeroes = zeroes [ 1 : ] elif ( len ( number ) > len ( str ( val ) ) ) : zeroes += '0' return '' . join ( [ pre , zeroes , str ( val ) , post ] )
get an incremented/decremented url based on a url match .