mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-01 01:27:01 +08:00
DOC: Complete coverage bar.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
/* This CSS stylesheet is no longer used. Edit agogo.css instead. */
|
||||
|
||||
/**
|
||||
* Sphinx stylesheet -- default theme
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -140,184 +142,3 @@ div.sphinxsidebar input {
|
||||
font-family: sans-serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* -- body styles ----------------------------------------------------------- */
|
||||
|
||||
a {
|
||||
color: {{ theme_linkcolor }};
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: {{ theme_visitedlinkcolor }};
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
div.body p, div.body dd, div.body li {
|
||||
text-align: justify;
|
||||
line-height: 130%;
|
||||
}
|
||||
|
||||
div.body h1,
|
||||
div.body h2,
|
||||
div.body h3,
|
||||
div.body h4,
|
||||
div.body h5,
|
||||
div.body h6 {
|
||||
font-family: {{ theme_headfont }};
|
||||
background-color: {{ theme_headbgcolor }};
|
||||
font-weight: normal;
|
||||
color: {{ theme_headtextcolor }};
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin: 20px -20px 10px -20px;
|
||||
padding: 3px 0 3px 10px;
|
||||
}
|
||||
|
||||
div.body h1 { margin-top: 0; font-size: 200%; }
|
||||
div.body h2 { font-size: 160%; }
|
||||
div.body h3 { font-size: 140%; }
|
||||
div.body h4 { font-size: 120%; }
|
||||
div.body h5 { font-size: 110%; }
|
||||
div.body h6 { font-size: 100%; }
|
||||
|
||||
a.headerlink {
|
||||
color: {{ theme_headlinkcolor }};
|
||||
font-size: 0.8em;
|
||||
padding: 0 4px 0 4px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.headerlink:hover {
|
||||
background-color: {{ theme_headlinkcolor }};
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.body p, div.body dd, div.body li {
|
||||
text-align: justify;
|
||||
line-height: 130%;
|
||||
}
|
||||
|
||||
div.admonition p.admonition-title + p {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.note {
|
||||
background-color: #eee;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
div.seealso {
|
||||
background-color: #ffc;
|
||||
border: 1px solid #ff6;
|
||||
}
|
||||
|
||||
div.topic {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
div.warning {
|
||||
background-color: #ffe4e4;
|
||||
border: 1px solid #f66;
|
||||
}
|
||||
|
||||
p.admonition-title {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
p.admonition-title:after {
|
||||
content: ":";
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 5px;
|
||||
background-color: {{ theme_codebgcolor }};
|
||||
color: {{ theme_codetextcolor }};
|
||||
line-height: 120%;
|
||||
border: 1px solid #ac9;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
tt {
|
||||
background-color: #ecf0f3;
|
||||
padding: 0 1px 0 1px;
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #ede;
|
||||
}
|
||||
|
||||
#api-reference ul:first-child {
|
||||
float: left;
|
||||
width: 35em;
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
list-style: none;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#api-reference li {
|
||||
float: left;
|
||||
position: relative;
|
||||
margin-right: 1em;
|
||||
width: 17em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.field-list {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/* Coverage States */
|
||||
span.missing{
|
||||
color: #000;
|
||||
background-color: #ff5840;
|
||||
border-color: #A77272;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.partial{
|
||||
color: #806600;
|
||||
background-color: #ffc343;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.done{
|
||||
color: #106600;
|
||||
background-color: #60f030;
|
||||
border-color: #4F8530;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.na{
|
||||
color: #A8A8A8;
|
||||
border-color: #4F8530;
|
||||
}
|
||||
span.missing-bar{
|
||||
color: #000;
|
||||
background-color: #ff5840;
|
||||
border-color: #A77272;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
span.partial-bar{
|
||||
color: #806600;
|
||||
background-color: #ffc343;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
span.done-bar{
|
||||
color: #106600;
|
||||
background-color: #60f030;
|
||||
border-color: #4F8530;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
span.na-bar{
|
||||
color: #A8A8A8;
|
||||
border-color: #4F8530;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import sys
|
||||
import os
|
||||
import csv
|
||||
@@ -13,12 +15,13 @@ except ImportError:
|
||||
# Missing item value
|
||||
MISSING_STRING=":missing:`Not Implemented`"
|
||||
|
||||
def calculate_coverage(reader,blocks=100):
|
||||
r"""Calculate portions of code that are in one of the coverage categories
|
||||
|
||||
Returns a tuple representing the weighted items as integers. The order is
|
||||
|
||||
(done,partial,missing,not applicable)
|
||||
def calculate_coverage(reader):
|
||||
"""Calculate portions of code that are in one of the coverage categories
|
||||
|
||||
Returns a tuple representing the weighted items. The order is
|
||||
|
||||
(done, partial, missing, not applicable)
|
||||
|
||||
"""
|
||||
# Coverage counters
|
||||
total_items = 0
|
||||
@@ -41,14 +44,13 @@ def calculate_coverage(reader,blocks=100):
|
||||
partial_items += 1
|
||||
elif ":na:" in row[2] or ":na:" in row[3]:
|
||||
na_items += 1
|
||||
|
||||
weight = float(blocks) / total_items
|
||||
|
||||
return (int(weight*done_items),
|
||||
int(weight*partial_items),
|
||||
int(weight*(total_items - (partial_items + done_items + na_items))),
|
||||
int(weight*na_items))
|
||||
|
||||
|
||||
counts = (done_items,
|
||||
partial_items,
|
||||
total_items - (partial_items + done_items + na_items),
|
||||
na_items)
|
||||
|
||||
return list(i / total_items for i in counts)
|
||||
|
||||
def read_table_titles(reader):
|
||||
r"""Create a dictionary with keys as section names and values as a list of
|
||||
@@ -196,45 +198,55 @@ def generate_page(csv_path,stream,page_title="Coverage Tables"):
|
||||
# reader = csv.reader(csv_file, dialect)
|
||||
|
||||
reader = csv.reader(csv_file)
|
||||
item_counts = calculate_coverage(reader,blocks=90)
|
||||
item_counts = calculate_coverage(reader)
|
||||
csv_file.seek(0)
|
||||
|
||||
|
||||
# Write out header
|
||||
stream.write("%s\n" % page_title)
|
||||
stream.write("="*len(page_title) + "\n\n")
|
||||
stream.write(".. role:: missing\n")
|
||||
stream.write(".. role:: partial\n")
|
||||
stream.write(".. role:: done\n")
|
||||
stream.write(".. role:: na\n\n")
|
||||
stream.write(".. role:: missing-bar\n")
|
||||
stream.write(".. role:: partial-bar\n")
|
||||
stream.write(".. role:: done-bar\n")
|
||||
stream.write(".. role:: na-bar\n\n")
|
||||
stream.write("Color Key\n")
|
||||
stream.write("---------\n")
|
||||
stream.write(":done:`Complete` ")
|
||||
stream.write(":partial:`Partial` ")
|
||||
stream.write(":missing:`Missing` ")
|
||||
stream.write(":na:`Not applicable`\n\n")
|
||||
stream.write("Coverage Bar\n")
|
||||
stream.write("------------\n\n")
|
||||
if item_counts[0] > 0:
|
||||
stream.write(":done-bar:`%s` " % ("="*item_counts[0]))
|
||||
if item_counts[1] > 0:
|
||||
stream.write(":partial-bar:`%s` " % ("="*item_counts[1]))
|
||||
if item_counts[2] > 0:
|
||||
stream.write(":missing-bar:`%s` " % ("="*item_counts[2]))
|
||||
if item_counts[3] > 0:
|
||||
stream.write(":na-bar:`%s`" % ("="*item_counts[3]))
|
||||
stream.write("\n\n")
|
||||
|
||||
stream.write("""
|
||||
|
||||
.. role:: missing
|
||||
.. role:: partial
|
||||
.. role:: done
|
||||
.. role:: na
|
||||
.. role:: missing-bar
|
||||
.. role:: partial-bar
|
||||
.. role:: done-bar
|
||||
.. role:: na-bar
|
||||
|
||||
.. warning::
|
||||
|
||||
This table has not yet been updated. We've just finished
|
||||
setting up its structure.
|
||||
|
||||
Color Key
|
||||
---------
|
||||
:done:`Complete` :partial:`Partial` :missing:`Missing` :na:`Not Applicable`
|
||||
|
||||
Coverage Bar
|
||||
------------
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<table width="100%" class="coverage"><tr>
|
||||
|
||||
""")
|
||||
|
||||
for item, style in enumerate(('done-bar', 'partial-bar',
|
||||
'missing-bar', 'na-bar')):
|
||||
stream.write('<td width="%s" class="%s">XX</td>' % \
|
||||
(item_counts[item] * 100, style))
|
||||
|
||||
stream.write("</tr></table>\n\n")
|
||||
|
||||
sections,table_names = read_table_titles(reader)
|
||||
for section_name in sections:
|
||||
stream.write(section_name + "\n")
|
||||
stream.write("-"*len(section_name) + "\n\n")
|
||||
for table_name in table_names[section_name]:
|
||||
generate_table(reader,stream,table_name)
|
||||
|
||||
|
||||
csv_file.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -487,3 +487,190 @@ div.viewcode-block:target {
|
||||
}
|
||||
|
||||
span.strike { text-decoration: line-through; }
|
||||
|
||||
/* -- body styles ----------------------------------------------------------- */
|
||||
|
||||
a {
|
||||
color: {{ theme_linkcolor }};
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: {{ theme_visitedlinkcolor }};
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
div.body p, div.body dd, div.body li {
|
||||
text-align: justify;
|
||||
line-height: 130%;
|
||||
}
|
||||
|
||||
div.body h1,
|
||||
div.body h2,
|
||||
div.body h3,
|
||||
div.body h4,
|
||||
div.body h5,
|
||||
div.body h6 {
|
||||
font-family: {{ theme_headfont }};
|
||||
background-color: {{ theme_headbgcolor }};
|
||||
font-weight: normal;
|
||||
color: {{ theme_headtextcolor }};
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin: 20px -20px 10px -20px;
|
||||
padding: 3px 0 3px 10px;
|
||||
}
|
||||
|
||||
div.body h1 { margin-top: 0; font-size: 200%; }
|
||||
div.body h2 { font-size: 160%; }
|
||||
div.body h3 { font-size: 140%; }
|
||||
div.body h4 { font-size: 120%; }
|
||||
div.body h5 { font-size: 110%; }
|
||||
div.body h6 { font-size: 100%; }
|
||||
|
||||
a.headerlink {
|
||||
color: {{ theme_headlinkcolor }};
|
||||
font-size: 0.8em;
|
||||
padding: 0 4px 0 4px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.headerlink:hover {
|
||||
background-color: {{ theme_headlinkcolor }};
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.body p, div.body dd, div.body li {
|
||||
text-align: justify;
|
||||
line-height: 130%;
|
||||
}
|
||||
|
||||
div.admonition p.admonition-title + p {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.note {
|
||||
background-color: #eee;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
div.seealso {
|
||||
background-color: #ffc;
|
||||
border: 1px solid #ff6;
|
||||
}
|
||||
|
||||
div.topic {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
div.warning {
|
||||
background-color: #ffe4e4;
|
||||
border: 1px solid #f66;
|
||||
}
|
||||
|
||||
p.admonition-title {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
p.admonition-title:after {
|
||||
content: ":";
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 5px;
|
||||
background-color: {{ theme_codebgcolor }};
|
||||
color: {{ theme_codetextcolor }};
|
||||
line-height: 120%;
|
||||
border: 1px solid #ac9;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
tt {
|
||||
background-color: #ecf0f3;
|
||||
padding: 0 1px 0 1px;
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #ede;
|
||||
}
|
||||
|
||||
#api-reference ul:first-child {
|
||||
float: left;
|
||||
width: 35em;
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
list-style: none;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#api-reference li {
|
||||
float: left;
|
||||
position: relative;
|
||||
margin-right: 1em;
|
||||
width: 17em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.field-list {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/* ----------------- Coverage States ----------------- */
|
||||
span.missing{
|
||||
color: #000;
|
||||
background-color: #ff5840;
|
||||
border-color: #A77272;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.partial{
|
||||
color: #806600;
|
||||
background-color: #ffc343;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.done{
|
||||
color: #106600;
|
||||
background-color: #60f030;
|
||||
border-color: #4F8530;
|
||||
font-weight: bold;
|
||||
}
|
||||
span.na{
|
||||
color: #A8A8A8;
|
||||
border-color: #4F8530;
|
||||
}
|
||||
|
||||
table.coverage {
|
||||
border: solid 1px;
|
||||
}
|
||||
|
||||
td.missing-bar{
|
||||
color: #ff5840;
|
||||
background-color: #ff5840;
|
||||
border-color: #A77272;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
td.partial-bar{
|
||||
color: #ffc343;
|
||||
background-color: #ffc343;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
td.done-bar{
|
||||
color: #60f030;
|
||||
background-color: #60f030;
|
||||
border-color: #4F8530;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
td.na-bar{
|
||||
color: #FFF;
|
||||
background-color: #FFF;
|
||||
border-color: #4F8530;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user