Skip to content

Commit

Permalink
fix tox on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelloPerathoner committed Sep 24, 2023
1 parent 3ad963c commit 7e797c9
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 41 deletions.
2 changes: 1 addition & 1 deletion docs/_build/_images/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/_build/builder/builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@
<dl class="py method">
<dt class="sig sig-object py" id="suffix_tree.builder.Builder.build">
<span class="sig-name descname"><span class="pre">build</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">root</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="../node.html#suffix_tree.node.Internal" title="suffix_tree.node.Internal"><span class="pre">Internal</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">id_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">object</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">S</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><span class="pre">Hashable</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#suffix_tree.builder.Builder.build" title="Link to this definition"></a></dt>
<dd><p>Adds the sequence to the tree.</p>
<dd><p>Add the sequence to the tree.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="suffix_tree.builder.Builder.set_progress_function">
<span class="sig-name descname"><span class="pre">set_progress_function</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tick</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#suffix_tree.builder.Builder.set_progress_function" title="Link to this definition"></a></dt>
<span class="sig-name descname"><span class="pre">set_progress_function</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tick</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#suffix_tree.builder.Builder.set_progress_function" title="Link to this definition"></a></dt>
<dd><p>Set a progress indicator callback function.</p>
<p>You should not change the tree in this callback.</p>
<dl class="field-list simple">
Expand Down
Binary file modified docs/_build/doctrees/builder/builder.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/tree.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/searchindex.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/_build/tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
<p>A Generalized Suffix Tree.</p>
<dl class="py class">
<dt class="sig sig-object py" id="suffix_tree.tree.Tree">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Tree</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">d</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">object</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">Hashable</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">builder</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="builder/builder.html#suffix_tree.builder.Builder" title="suffix_tree.builder.Builder"><span class="pre">Builder</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">type</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#suffix_tree.tree.Tree" title="Link to this definition"></a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Tree</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">object</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">Hashable</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">builder</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="builder/builder.html#suffix_tree.builder.Builder" title="suffix_tree.builder.Builder"><span class="pre">Builder</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">type</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#suffix_tree.tree.Tree" title="Link to this definition"></a></dt>
<dd><p>A generalized suffix tree.</p>
<p>The key feature of the suffix tree is that for any leaf <span class="math notranslate nohighlight">\(i\)</span>, the
concatenation of the edgle-labels on the path from the root to leaf
Expand Down Expand Up @@ -283,12 +283,13 @@
</div>
<dl class="py method">
<dt class="sig sig-object py" id="suffix_tree.tree.Tree.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">d</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">object</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">Hashable</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">builder</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="builder/builder.html#suffix_tree.builder.Builder" title="suffix_tree.builder.Builder"><span class="pre">Builder</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">type</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#suffix_tree.tree.Tree.__init__" title="Link to this definition"></a></dt>
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">object</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">Hashable</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">builder</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="builder/builder.html#suffix_tree.builder.Builder" title="suffix_tree.builder.Builder"><span class="pre">Builder</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">type</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#suffix_tree.tree.Tree.__init__" title="Link to this definition"></a></dt>
<dd><p>Initialize and optionally build the tree.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>d</strong> (<em>Dict</em><em>[</em><em>Id</em><em>, </em><em>Symbols</em><em>]</em>) – a dictionary of ids to sequences of symbols or None</p></li>
<li><p><strong>data</strong> (<em>Dict</em><em>[</em><em>Id</em><em>, </em><em>Symbols</em><em>]</em>) – a dictionary of ids to sequences of symbols
or None</p></li>
<li><p><strong>builder</strong> (<a class="reference internal" href="builder/builder.html#suffix_tree.builder.Builder" title="suffix_tree.builder.Builder"><em>builder.Builder</em></a>) – a builder
(default = <a class="reference internal" href="builder/ukkonen.html#suffix_tree.ukkonen.Builder" title="suffix_tree.ukkonen.Builder"><code class="xref py py-class docutils literal notranslate"><span class="pre">suffix_tree.ukkonen.Builder</span></code></a>)</p></li>
<li><p><strong>progress</strong> (<em>Callable</em>) – a progress function (default = None). The function
Expand Down
72 changes: 38 additions & 34 deletions docs/make_badges.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,51 @@

# shields_io_colors = ["success", "important", "critical", "informational", "inactive"]

badges = {}
if __name__ == "main":
badges = {}

# one build=passing badge for each python version
for filename in glob.glob(".tox/py*/log/2-commands*.log"):
with open(filename, "r") as fp:
status = "passing"
color = "success"
for line in fp:
if line.startswith("name: "):
name = line[6:].strip()
if line.startswith("==="):
if m := re.search(r"(\d+) failed", line):
# one build=passing badge for each python version
for filename in glob.glob(".tox/py*/log/*commands*.log"):
with open(filename, "r") as fp:
status = "passing"
color = "success"
for line in fp:
if line.startswith("name: "):
name = line[6:].strip()
if m := re.search(r"===.*(\d+) failed", line):
failed = int(m.group(1))
status = "failed"
color = "critical"
badge = requests.get(f"https://img.shields.io/badge/{name}-{status}-{color}").text
filename = f"_images/tox-{name}.svg"
with open(f"{DESTDIR}{filename}", "w") as dest:
dest.write(badge)
print(f"{filename}")
badge = requests.get(
f"https://img.shields.io/badge/{name}-{status}-{color}"
).text
filename = f"_images/tox-{name}.svg"
with open(f"{DESTDIR}{filename}", "w") as dest:
dest.write(badge)
print(f"{filename}")

badges[name] = f"{REFDIR}{filename}"
badges[name] = f"{REFDIR}{filename}"

# one coverage badge
with open("htmlcov/index.html") as fp:
root = etree.parse(fp, parser=etree.HTMLParser()).getroot()
# one coverage badge
with open("htmlcov/index.html") as fp:
root = etree.parse(fp, parser=etree.HTMLParser()).getroot()

coverage = root.xpath("//span[@class='pc_cov']")[0].text
coverage = root.xpath("//span[@class='pc_cov']")[0].text

cov = int(coverage.rstrip("%"))
if cov > 95:
color = "success"
elif cov > 75:
color = "important"
else:
color = "critical"
cov = int(coverage.rstrip("%"))
if cov > 95:
color = "success"
elif cov > 75:
color = "important"
else:
color = "critical"

badge = requests.get(f"https://img.shields.io/badge/coverage-{coverage}-{color}").text
badge = requests.get(
f"https://img.shields.io/badge/coverage-{coverage}-{color}"
).text

filename = "_images/coverage.svg"
with open(f"{DESTDIR}{filename}", "w") as dest:
dest.write(badge)
print(f"{filename}")
badges["coverage"] = f"{REFDIR}{filename}"
filename = "_images/coverage.svg"
with open(f"{DESTDIR}{filename}", "w") as dest:
dest.write(badge)
print(f"{filename}")
badges["coverage"] = f"{REFDIR}{filename}"
1 change: 1 addition & 0 deletions tests/unit/test_builder_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ def test_builder_factory(self):
assert builder_factory("mccreight") == mccreight.Builder
assert builder_factory("ukkonen") == ukkonen.Builder
assert builder_factory("naive") == naive.Builder
assert builder_factory("foo") == mccreight.Builder
assert builder_factory() == mccreight.Builder

0 comments on commit 7e797c9

Please sign in to comment.