parameters: (source_dirs, input_path, sources_json_file,
                             src_root)
return_statement: return 0
docstring: Adds all normalized source directories and input path to
    |sources_json_file|.
  
    Args:
      source_dirs: List of source directories.
      input_path: The input path to non-instrumented class files.
      sources_json_file: File into which to write the list of source directories
      and input path.
      src_root: Root which sources added to the file should be relative to.
  
    Returns:
      An exit code.
docstring_summary: Adds all normalized source directories and input path to
    |sources_json_file|.
docstring_tokens: Adds all normalized source directories and input path to |sources_json_file| .
function: def _CreateSourcesJsonFile(source_dirs, input_path, sources_json_file,
                             src_root):
    """Adds all normalized source directories and input path to
    |sources_json_file|.
  
    Args:
      source_dirs: List of source directories.
      input_path: The input path to non-instrumented class files.
      sources_json_file: File into which to write the list of source directories
      and input path.
      src_root: Root which sources added to the file should be relative to.
  
    Returns:
      An exit code.
    """
    src_root = os.path.abspath(src_root)
    relative_sources = []
    for s in source_dirs:
      abs_source = os.path.abspath(s)
      if abs_source[:len(src_root)] != src_root:
        print('Error: found source directory not under repository root: %s %s' %
              (abs_source, src_root))
        return 1
      rel_source = os.path.relpath(abs_source, src_root)
  
      relative_sources.append(rel_source)
  
    data = {}
    data['source_dirs'] = relative_sources
    data['input_path'] = []
    if input_path:
      data['input_path'].append(os.path.abspath(input_path))
    with open(sources_json_file, 'w') as f:
      json.dump(data, f)
    return 0
function_tokens: def _CreateSourcesJsonFile ( source_dirs , input_path , sources_json_file , src_root ) : src_root = os . path . abspath ( src_root ) relative_sources = [ ] for s in source_dirs : abs_source = os . path . abspath ( s ) if abs_source [ : len ( src_root ) ] != src_root : print ( 'Error: found source directory not under repository root: %s %s' % ( abs_source , src_root ) ) return 1 rel_source = os . path . relpath ( abs_source , src_root ) relative_sources . append ( rel_source ) data = { } data [ 'source_dirs' ] = relative_sources data [ 'input_path' ] = [ ] if input_path : data [ 'input_path' ] . append ( os . path . abspath ( input_path ) ) with open ( sources_json_file , 'w' ) as f : json . dump ( data , f ) return 0