tools/code_coverage/coverage_utils.py
def WriteHtmlCoverageReport(self, no_component_view, no_file_view):
    """Writes html coverage report.

    In the report, sub-directories are displayed before files and within each
    category, entries are sorted alphabetically.
    """

    def EntryCmp(left, right):
      """Compare function for table entries."""
      if left['is_dir'] != right['is_dir']:
        return -1 if left['is_dir'] == True else 1

      return -1 if left['name'] < right['name'] else 1

    self._table_entries = sorted(
        self._table_entries, key=functools.cmp_to_key(EntryCmp))

    css_path = os.path.join(self._output_dir, os.extsep.join(['style', 'css']))

    directory_view_path = GetDirectoryViewPath(self._output_dir)
    directory_view_href = GetRelativePathToDirectoryOfFile(
        directory_view_path, self._output_path)

    component_view_href = None
    if not no_component_view:
      component_view_path = GetComponentViewPath(self._output_dir)
      component_view_href = GetRelativePathToDirectoryOfFile(
          component_view_path, self._output_path)

    # File view is optional in the report.
    file_view_href = None
    if not no_file_view:
      file_view_path = GetFileViewPath(self._output_dir)
      file_view_href = GetRelativePathToDirectoryOfFile(file_view_path,
                                                        self._output_path)

    html_header = self._header_template.render(
        css_path=GetRelativePathToDirectoryOfFile(css_path, self._output_path),
        directory_view_href=directory_view_href,
        component_view_href=component_view_href,
        file_view_href=file_view_href,
        style_overrides=self._style_overrides)

    html_table = self._table_template.render(
        entries=self._table_entries,
        total_entry=self._total_entry,
        table_entry_type=self._table_entry_type)
    html_footer = self._footer_template.render()

    if not os.path.exists(os.path.dirname(self._output_path)):
      os.makedirs(os.path.dirname(self._output_path))
    with open(self._output_path, 'w') as html_file:
      html_file.write(html_header + html_table + html_footer)
Writes html coverage report.

    In the report, sub-directories are displayed before files and within each
    category, entries are sorted alphabetically.
    
Writes html coverage report.
In the report, sub-directories are displayed before files and within each
category, entries are sorted alphabetically.
Writes html coverage report . In the report sub - directories are displayed before files and within each category entries are sorted alphabetically .
def WriteHtmlCoverageReport(self, no_component_view, no_file_view):
    def EntryCmp(left, right):
      if left['is_dir'] != right['is_dir']:
        return -1 if left['is_dir'] == True else 1
      return -1 if left['name'] < right['name'] else 1
    self._table_entries = sorted(
        self._table_entries, key=functools.cmp_to_key(EntryCmp))
    css_path = os.path.join(self._output_dir, os.extsep.join(['style', 'css']))
    directory_view_path = GetDirectoryViewPath(self._output_dir)
    directory_view_href = GetRelativePathToDirectoryOfFile(
        directory_view_path, self._output_path)
    component_view_href = None
    if not no_component_view:
      component_view_path = GetComponentViewPath(self._output_dir)
      component_view_href = GetRelativePathToDirectoryOfFile(
          component_view_path, self._output_path)
    file_view_href = None
    if not no_file_view:
      file_view_path = GetFileViewPath(self._output_dir)
      file_view_href = GetRelativePathToDirectoryOfFile(file_view_path,
                                                        self._output_path)
    html_header = self._header_template.render(
        css_path=GetRelativePathToDirectoryOfFile(css_path, self._output_path),
        directory_view_href=directory_view_href,
        component_view_href=component_view_href,
        file_view_href=file_view_href,
        style_overrides=self._style_overrides)
    html_table = self._table_template.render(
        entries=self._table_entries,
        total_entry=self._total_entry,
        table_entry_type=self._table_entry_type)
    html_footer = self._footer_template.render()
    if not os.path.exists(os.path.dirname(self._output_path)):
      os.makedirs(os.path.dirname(self._output_path))
    with open(self._output_path, 'w') as html_file:
      html_file.write(html_header + html_table + html_footer)
def WriteHtmlCoverageReport ( self , no_component_view , no_file_view ) : def EntryCmp ( left , right ) : """Compare function for table entries.""" if left [ 'is_dir' ] != right [ 'is_dir' ] : return - 1 if left [ 'is_dir' ] == True else 1 return - 1 if left [ 'name' ] < right [ 'name' ] else 1 self . _table_entries = sorted ( self . _table_entries , key = functools . cmp_to_key ( EntryCmp ) ) css_path = os . path . join ( self . _output_dir , os . extsep . join ( [ 'style' , 'css' ] ) ) directory_view_path = GetDirectoryViewPath ( self . _output_dir ) directory_view_href = GetRelativePathToDirectoryOfFile ( directory_view_path , self . _output_path ) component_view_href = None if not no_component_view : component_view_path = GetComponentViewPath ( self . _output_dir ) component_view_href = GetRelativePathToDirectoryOfFile ( component_view_path , self . _output_path ) file_view_href = None if not no_file_view : file_view_path = GetFileViewPath ( self . _output_dir ) file_view_href = GetRelativePathToDirectoryOfFile ( file_view_path , self . _output_path ) html_header = self . _header_template . render ( css_path = GetRelativePathToDirectoryOfFile ( css_path , self . _output_path ) , directory_view_href = directory_view_href , component_view_href = component_view_href , file_view_href = file_view_href , style_overrides = self . _style_overrides ) html_table = self . _table_template . render ( entries = self . _table_entries , total_entry = self . _total_entry , table_entry_type = self . _table_entry_type ) html_footer = self . _footer_template . render ( ) if not os . path . exists ( os . path . dirname ( self . _output_path ) ) : os . makedirs ( os . path . dirname ( self . _output_path ) ) with open ( self . _output_path , 'w' ) as html_file : html_file . write ( html_header + html_table + html_footer )
Writes html coverage report.
Writes html coverage report .
"""Writes html coverage report.

    In the report, sub-directories are displayed before files and within each
    category, entries are sorted alphabetically.
    """ """Compare function for table entries.""" # File view is optional in the report.
self
no_component_view
no_file_view