parameters: (test_path)
return_statement: return info
docstring: Pre-fills some best guesses config form based on the test path.
  
    Args:
      test_path: Test path string.
  
    Returns:
      A dictionary indicating the result. If successful, this should contain the
      the fields "suite", "email", "all_metrics", and "default_metric". If not
      successful this will contain the field "error".
docstring_summary: Pre-fills some best guesses config form based on the test path.
docstring_tokens: Pre - fills some best guesses config form based on the test path .
function: def _PrefillInfo(test_path):
    """Pre-fills some best guesses config form based on the test path.
  
    Args:
      test_path: Test path string.
  
    Returns:
      A dictionary indicating the result. If successful, this should contain the
      the fields "suite", "email", "all_metrics", and "default_metric". If not
      successful this will contain the field "error".
    """
    if not test_path:
      return {'error': 'No test specified'}
  
    suite_path = '/'.join(test_path.split('/')[:3])
    suite = utils.TestKey(suite_path).get()
    if not suite:
      return {'error': 'Invalid test %s' % test_path}
  
    graph_path = '/'.join(test_path.split('/')[:4])
    graph_key = utils.TestKey(graph_path)
  
    info = {'suite': suite.test_name}
    info['master'] = suite.master_name
    info['internal_only'] = suite.internal_only
    info['use_archive'] = _CanDownloadBuilds(suite.master_name)
  
    info['all_bots'] = _GetAvailableBisectBots(suite.master_name)
    info['bisect_bot'] = GuessBisectBot(suite.master_name, suite.bot_name)
  
    user = users.get_current_user()
    if not user:
      return {'error': 'User not logged in.'}
  
    # Secondary check for bisecting internal only tests.
    if suite.internal_only and not utils.IsInternalUser():
      return {'error': 'Unauthorized access, please use corp account to login.'}
  
    info['email'] = user.email()
  
    info['all_metrics'] = []
    metric_keys = list_tests.GetTestDescendants(graph_key, has_rows=True)
    for metric_key in metric_keys:
      metric_path = utils.TestPath(metric_key)
      if metric_path.endswith('/ref') or metric_path.endswith('_ref'):
        continue
      info['all_metrics'].append(GuessMetric(metric_path))
    info['default_metric'] = GuessMetric(test_path)
  
    return info
function_tokens: def _PrefillInfo ( test_path ) : if not test_path : return { 'error' : 'No test specified' } suite_path = '/' . join ( test_path . split ( '/' ) [ : 3 ] ) suite = utils . TestKey ( suite_path ) . get ( ) if not suite : return { 'error' : 'Invalid test %s' % test_path } graph_path = '/' . join ( test_path . split ( '/' ) [ : 4 ] ) graph_key = utils . TestKey ( graph_path ) info = { 'suite' : suite . test_name } info [ 'master' ] = suite . master_name info [ 'internal_only' ] = suite . internal_only info [ 'use_archive' ] = _CanDownloadBuilds ( suite . master_name ) info [ 'all_bots' ] = _GetAvailableBisectBots ( suite . master_name ) info [ 'bisect_bot' ] = GuessBisectBot ( suite . master_name , suite . bot_name ) user = users . get_current_user ( ) if not user : return { 'error' : 'User not logged in.' } # Secondary check for bisecting internal only tests. if suite . internal_only and not utils . IsInternalUser ( ) : return { 'error' : 'Unauthorized access, please use corp account to login.' } info [ 'email' ] = user . email ( ) info [ 'all_metrics' ] = [ ] metric_keys = list_tests . GetTestDescendants ( graph_key , has_rows = True ) for metric_key in metric_keys : metric_path = utils . TestPath ( metric_key ) if metric_path . endswith ( '/ref' ) or metric_path . endswith ( '_ref' ) : continue info [ 'all_metrics' ] . append ( GuessMetric ( metric_path ) ) info [ 'default_metric' ] = GuessMetric ( test_path ) return info