def _DoSubstitute(args, context, callback):
 (name, formatters) = args
 if (name == '@'):
  value = context.Lookup('@')
 else:
  try:
   value = context.Lookup(name)
  except TypeError as e:
   raise EvaluationError(('Error evaluating %r in context %r: %r' % (name, context, e)))
 for (func, args, func_type) in formatters:
  try:
   if (func_type == ENHANCED_FUNC):
    value = func(value, context, args)
   else:
    value = func(value)
  except KeyboardInterrupt:
   raise
  except Exception as e:
   raise EvaluationError(('Formatting value %r with formatter %s raised exception: %r' % (value, formatters, e)), original_exception=e)
 if (value is None):
  raise EvaluationError(('Evaluating %r gave None value' % name))
 callback(value)

def _DoSubstitute ( args , context , callback ) : ( name , formatters ) = args if ( name == '@' ) : value = context . Lookup ( '@' ) else : try : value = context . Lookup ( name ) except TypeError as e : raise EvaluationError ( ( 'Error evaluating %r in context %r: %r' % ( name , context , e ) ) ) for ( func , args , func_type ) in formatters : try : if ( func_type == ENHANCED_FUNC ) : value = func ( value , context , args ) else : value = func ( value ) except KeyboardInterrupt : raise except Exception as e : raise EvaluationError ( ( 'Formatting value %r with formatter %s raised exception: %r' % ( value , formatters , e ) ) , original_exception = e ) if ( value is None ) : raise EvaluationError ( ( 'Evaluating %r gave None value' % name ) ) callback ( value )
variable substitution .