Skip to content

Commit

Permalink
deploy: fcace3a
Browse files Browse the repository at this point in the history
  • Loading branch information
danielSanchezQ committed Apr 1, 2024
1 parent 3cc1f47 commit 77ff90e
Show file tree
Hide file tree
Showing 10 changed files with 490 additions and 20 deletions.
79 changes: 77 additions & 2 deletions exceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,86 @@ <h1 class="title">Module <code>rusty_results.exceptions</code></h1>
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class UnwrapException(Exception):
...</code></pre>
<pre><code class="python">from functools import wraps
from typing import TypeVar


class UnwrapException(Exception):
...


T = TypeVar(&#34;T&#34;)


class EarlyReturnException(ValueError):
def __init__(self, value: T):
self.value = value
super().__init__(self.value)


def early_return(f):
@wraps(f)
def wrapper(*args, **kwargs):
try:
f(*args, **kwargs)
except EarlyReturnException as e:
return e.value
return wrapper</code></pre>
</details>
</section>
<section>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="rusty_results.exceptions.early_return"><code class="name flex">
<span>def <span class="ident">early_return</span></span>(<span>f)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def early_return(f):
@wraps(f)
def wrapper(*args, **kwargs):
try:
f(*args, **kwargs)
except EarlyReturnException as e:
return e.value
return wrapper</code></pre>
</details>
</dd>
</dl>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="rusty_results.exceptions.EarlyReturnException"><code class="flex name class">
<span>class <span class="ident">EarlyReturnException</span></span>
<span>(</span><span>value: ~T)</span>
</code></dt>
<dd>
<div class="desc"><p>Inappropriate argument value (of correct type).</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class EarlyReturnException(ValueError):
def __init__(self, value: T):
self.value = value
super().__init__(self.value)</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
<li>builtins.ValueError</li>
<li>builtins.Exception</li>
<li>builtins.BaseException</li>
</ul>
</dd>
<dt id="rusty_results.exceptions.UnwrapException"><code class="flex name class">
<span>class <span class="ident">UnwrapException</span></span>
<span>(</span><span>*args, **kwargs)</span>
Expand Down Expand Up @@ -72,9 +139,17 @@ <h1>Index</h1>
<li><code><a title="rusty_results" href="index.html">rusty_results</a></code></li>
</ul>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="rusty_results.exceptions.early_return" href="#rusty_results.exceptions.early_return">early_return</a></code></li>
</ul>
</li>
<li><h3><a href="#header-classes">Classes</a></h3>
<ul>
<li>
<h4><code><a title="rusty_results.exceptions.EarlyReturnException" href="#rusty_results.exceptions.EarlyReturnException">EarlyReturnException</a></code></h4>
</li>
<li>
<h4><code><a title="rusty_results.exceptions.UnwrapException" href="#rusty_results.exceptions.UnwrapException">UnwrapException</a></code></h4>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h1 class="title">Package <code>rusty_results</code></h1>
<span>Expand source code</span>
</summary>
<pre><code class="python">from .prelude import Option, Some, Empty, Result, Ok, Err
from .exceptions import UnwrapException</code></pre>
from .exceptions import UnwrapException, early_return</code></pre>
</details>
</section>
<section>
Expand Down
Loading

0 comments on commit 77ff90e

Please sign in to comment.