def _infer_mutants_handler(self, request):
    """Returns JSON for the `vz-line-chart`s for a feature.

    Args:
      request: A request that should contain 'feature_name', 'example_index',
         'inference_address', 'model_name', 'model_type', 'model_version', and
         'model_signature'.

    Returns:
      A list of JSON objects, one for each chart.
    """
    try:
      if request.method != 'GET':
        logger.error('%s requests are forbidden.', request.method)
        return http_util.Respond(request, {'error': 'invalid non-GET request'},
                                 'application/json', code=405)

      example_index = int(request.args.get('example_index', '0'))
      feature_name = request.args.get('feature_name')
      examples = (self.examples if example_index == -1
          else [self.examples[example_index]])

      (inference_addresses, model_names, model_versions,
          model_signatures) = self._parse_request_arguments(request)

      serving_bundles = []
      for model_num in xrange(len(inference_addresses)):
        serving_bundles.append(inference_utils.ServingBundle(
            inference_addresses[model_num],
            model_names[model_num],
            request.args.get('model_type'),
            model_versions[model_num],
            model_signatures[model_num],
            request.args.get('use_predict') == 'true',
            request.args.get('predict_input_tensor'),
            request.args.get('predict_output_tensor')))

      viz_params = inference_utils.VizParams(
          request.args.get('x_min'), request.args.get('x_max'),
          self.examples[0:NUM_EXAMPLES_TO_SCAN], NUM_MUTANTS,
          request.args.get('feature_index_pattern'))
      json_mapping = inference_utils.mutant_charts_for_feature(
          examples, feature_name, serving_bundles, viz_params)
      return http_util.Respond(request, json_mapping, 'application/json')
    except common_utils.InvalidUserInputError as e:
      return http_util.Respond(request, {'error': e.message},
                               'application/json', code=400)
def _infer_mutants_handler ( self , request ) : try : if request . method != 'GET' : logger . error ( '%s requests are forbidden.' , request . method ) return http_util . Respond ( request , { 'error' : 'invalid non-GET request' } , 'application/json' , code = 405 ) example_index = int ( request . args . get ( 'example_index' , '0' ) ) feature_name = request . args . get ( 'feature_name' ) examples = ( self . examples if example_index == - 1 else [ self . examples [ example_index ] ] ) ( inference_addresses , model_names , model_versions , model_signatures ) = self . _parse_request_arguments ( request ) serving_bundles = [ ] for model_num in xrange ( len ( inference_addresses ) ) : serving_bundles . append ( inference_utils . ServingBundle ( inference_addresses [ model_num ] , model_names [ model_num ] , request . args . get ( 'model_type' ) , model_versions [ model_num ] , model_signatures [ model_num ] , request . args . get ( 'use_predict' ) == 'true' , request . args . get ( 'predict_input_tensor' ) , request . args . get ( 'predict_output_tensor' ) ) ) viz_params = inference_utils . VizParams ( request . args . get ( 'x_min' ) , request . args . get ( 'x_max' ) , self . examples [ 0 : NUM_EXAMPLES_TO_SCAN ] , NUM_MUTANTS , request . args . get ( 'feature_index_pattern' ) ) json_mapping = inference_utils . mutant_charts_for_feature ( examples , feature_name , serving_bundles , viz_params ) return http_util . Respond ( request , json_mapping , 'application/json' ) except common_utils . InvalidUserInputError as e : return http_util . Respond ( request , { 'error' : e . message } , 'application/json' , code = 400 )
Returns JSON for the `vz-line-chart`s for a feature.

    Args:
      request: A request that should contain 'feature_name', 'example_index',
         'inference_address', 'model_name', 'model_type', 'model_version', and
         'model_signature'.

    Returns:
      A list of JSON objects, one for each chart.