зеркало из https://github.com/microsoft/pybryt.git
fixed bug
This commit is contained in:
Родитель
b98e894b4f
Коммит
7f0984fa06
|
@ -84,14 +84,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"execution_count": 3
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -105,14 +105,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"pybryt.Value"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"execution_count": 4
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -150,7 +150,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5-final"
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
|
@ -179,4 +179,4 @@
|
|||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,11 +65,11 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's test your median function. What should `median([8.0, 5.0, -1.0, 10.0, 3.0, 5.0, 2.25])` return?"
|
||||
],
|
||||
"cell_type": "markdown",
|
||||
"metadata": {}
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
|
@ -77,14 +77,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"execution_count": 3
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -98,14 +98,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"pybryt.Value"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"execution_count": 4
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -143,7 +143,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5-final"
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
|
@ -172,4 +172,4 @@
|
|||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,14 +71,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"execution_count": 3
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -92,14 +92,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"pybryt.Value"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"execution_count": 4
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -137,7 +137,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5-final"
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
|
@ -166,4 +166,4 @@
|
|||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,14 +72,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"execution_count": 3
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -93,14 +93,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"pybryt.Value"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"execution_count": 4
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -138,7 +138,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5-final"
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
|
@ -167,4 +167,4 @@
|
|||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,14 +71,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"execution_count": 3
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -92,14 +92,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"pybryt.Value"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"execution_count": 4
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -137,7 +137,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5-final"
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
|
@ -166,4 +166,4 @@
|
|||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,14 +70,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"execution_count": 3
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -91,14 +91,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"pybryt.Value"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"execution_count": 4
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -136,7 +136,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5-final"
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
|
@ -165,4 +165,4 @@
|
|||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,14 +76,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"5.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"execution_count": 3
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -97,14 +97,14 @@
|
|||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"output_type": "execute_result",
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"pybryt.Value"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"execution_count": 4
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
|
@ -142,7 +142,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5-final"
|
||||
"version": "3.7.3"
|
||||
},
|
||||
"toc": {
|
||||
"colors": {
|
||||
|
@ -171,4 +171,4 @@
|
|||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ Annotations
|
|||
Value Annotations
|
||||
+++++++++++++++++
|
||||
|
||||
.. autoclass:: pybryt.Value
|
||||
.. automodule:: pybryt.annotations.value
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ Annotations
|
|||
Value Annotations
|
||||
+++++++++++++++++
|
||||
|
||||
.. autoclass:: pybryt.Value
|
||||
.. automodule:: pybryt.annotations.value
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
|
|
@ -273,14 +273,33 @@ list.</p>
|
|||
<dd><p>a message to relay to the student if satisfied</p>
|
||||
</dd></dl>
|
||||
</dd></dl>
|
||||
<div class="section" id="value-annotations">
|
||||
<h3>Value Annotations<a class="headerlink" href="#value-annotations" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="section" id="module-pybryt.annotations.value">
|
||||
<span id="value-annotations"></span><h3>Value Annotations<a class="headerlink" href="#module-pybryt.annotations.value" title="Permalink to this headline">¶</a></h3>
|
||||
<dl class="py class">
|
||||
<dt id="pybryt.Value">
|
||||
<em class="property">class </em><code class="sig-name descname">Value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span><span class="p">:</span> <span class="n">Any</span></em>, <em class="sig-param"><span class="n">tol</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>float<span class="p">, </span>int<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">0</span></em>, <em class="sig-param"><span class="n">invariants</span><span class="p">:</span> <span class="n">List<span class="p">[</span><a class="reference internal" href="#pybryt.annotations.invariants.invariant" title="pybryt.annotations.invariants.invariant">pybryt.annotations.invariants.invariant</a><span class="p">]</span></span> <span class="o">=</span> <span class="default_value">[]</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.Value" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pybryt.annotations.value.Attribute">
|
||||
<em class="property">class </em><code class="sig-name descname">Attribute</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span></em>, <em class="sig-param"><span class="n">attrs</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>str<span class="p">, </span>List<span class="p">[</span>str<span class="p">]</span><span class="p">]</span></span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.value.Attribute" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="py method">
|
||||
<dt id="pybryt.Value.check">
|
||||
<code class="sig-name descname">check</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">other_values</span><span class="p">:</span> <span class="n">List<span class="p">[</span>pybryt.execution.ObservedValue<span class="p">]</span></span></em><span class="sig-paren">)</span> → pybryt.annotations.annotation.AnnotationResult<a class="headerlink" href="#pybryt.Value.check" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pybryt.annotations.value.Attribute.check">
|
||||
<code class="sig-name descname">check</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">observed_values</span><span class="p">:</span> <span class="n">List<span class="p">[</span>pybryt.execution.ObservedValue<span class="p">]</span></span></em><span class="sig-paren">)</span> → pybryt.annotations.annotation.AnnotationResult<a class="headerlink" href="#pybryt.annotations.value.Attribute.check" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<dl class="py method">
|
||||
<dt id="pybryt.annotations.value.Attribute.children">
|
||||
<em class="property">property </em><code class="sig-name descname">children</code><a class="headerlink" href="#pybryt.annotations.value.Attribute.children" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>the child annotations of this annotation. If this annotation has no
|
||||
children, an empty list.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Type</dt>
|
||||
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">list[Annotation]</span></code></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
</dd></dl>
|
||||
<dl class="py class">
|
||||
<dt id="pybryt.annotations.value.Value">
|
||||
<em class="property">class </em><code class="sig-name descname">Value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span><span class="p">:</span> <span class="n">Any</span></em>, <em class="sig-param"><span class="n">tol</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>float<span class="p">, </span>int<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">0</span></em>, <em class="sig-param"><span class="n">invariants</span><span class="p">:</span> <span class="n">List<span class="p">[</span><a class="reference internal" href="#pybryt.annotations.invariants.invariant" title="pybryt.annotations.invariants.invariant">pybryt.annotations.invariants.invariant</a><span class="p">]</span></span> <span class="o">=</span> <span class="default_value">[]</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.value.Value" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="py method">
|
||||
<dt id="pybryt.annotations.value.Value.check">
|
||||
<code class="sig-name descname">check</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">other_values</span><span class="p">:</span> <span class="n">List<span class="p">[</span>pybryt.execution.ObservedValue<span class="p">]</span></span></em><span class="sig-paren">)</span> → pybryt.annotations.annotation.AnnotationResult<a class="headerlink" href="#pybryt.annotations.value.Value.check" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Runs the check on the condition asserted by this annotation and returns a results object.</p>
|
||||
<p>Checks that the condition required by this annotation is met using the list of tuples of
|
||||
observed values and timestamps <code class="docutils literal notranslate"><span class="pre">observed_values</span></code>. Creates and returns an
|
||||
|
@ -295,13 +314,13 @@ during execution and the timestamps of those values</p>
|
|||
<code class="docutils literal notranslate"><span class="pre">observed_values</span></code></p>
|
||||
</dd>
|
||||
<dt class="field-odd">Return type</dt>
|
||||
<dd class="field-odd"><p><a class="reference internal" href="#pybryt.AnnotationResult" title="pybryt.AnnotationResult"><code class="xref py py-class docutils literal notranslate"><span class="pre">AnnotationResult</span></code></a></p>
|
||||
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">AnnotationResult</span></code></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
<dl class="py method">
|
||||
<dt id="pybryt.Value.children">
|
||||
<em class="property">property </em><code class="sig-name descname">children</code><a class="headerlink" href="#pybryt.Value.children" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pybryt.annotations.value.Value.children">
|
||||
<em class="property">property </em><code class="sig-name descname">children</code><a class="headerlink" href="#pybryt.annotations.value.Value.children" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>the child annotations of this annotation. If this annotation has no
|
||||
children, an empty list.</p>
|
||||
<dl class="field-list simple">
|
||||
|
@ -311,16 +330,16 @@ children, an empty list.</p>
|
|||
</dl>
|
||||
</dd></dl>
|
||||
<dl class="py attribute">
|
||||
<dt id="pybryt.Value.intial_value">
|
||||
<code class="sig-name descname">intial_value</code><em class="property">: Any</em><a class="headerlink" href="#pybryt.Value.intial_value" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pybryt.annotations.value.Value.intial_value">
|
||||
<code class="sig-name descname">intial_value</code><em class="property">: Any</em><a class="headerlink" href="#pybryt.annotations.value.Value.intial_value" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<dl class="py attribute">
|
||||
<dt id="pybryt.Value.invariants">
|
||||
<code class="sig-name descname">invariants</code><em class="property">: List<span class="p">[</span>invariant<span class="p">]</span></em><a class="headerlink" href="#pybryt.Value.invariants" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pybryt.annotations.value.Value.invariants">
|
||||
<code class="sig-name descname">invariants</code><em class="property">: List<span class="p">[</span>invariant<span class="p">]</span></em><a class="headerlink" href="#pybryt.annotations.value.Value.invariants" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<dl class="py attribute">
|
||||
<dt id="pybryt.Value.tol">
|
||||
<code class="sig-name descname">tol</code><em class="property">: Union<span class="p">[</span>float<span class="p">, </span>int<span class="p">]</span></em><a class="headerlink" href="#pybryt.Value.tol" title="Permalink to this definition">¶</a></dt>
|
||||
<dt id="pybryt.annotations.value.Value.tol">
|
||||
<code class="sig-name descname">tol</code><em class="property">: Union<span class="p">[</span>float<span class="p">, </span>int<span class="p">]</span></em><a class="headerlink" href="#pybryt.annotations.value.Value.tol" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
</dd></dl>
|
||||
</div>
|
||||
|
@ -564,7 +583,7 @@ function as callables.</p>
|
|||
<dt id="pybryt.annotations.invariants.invariant.run">
|
||||
<em class="property">abstract static </em><code class="sig-name descname">run</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">values</span><span class="p">:</span> <span class="n">List<span class="p">[</span>Any<span class="p">]</span></span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span> → List<span class="p">[</span>Any<span class="p">]</span><a class="headerlink" href="#pybryt.annotations.invariants.invariant.run" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a list of values that this invariant accepts as correct.</p>
|
||||
<p>Takes in a list of acceptable values from a <a class="reference internal" href="#pybryt.Value" title="pybryt.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> annotation and
|
||||
<p>Takes in a list of acceptable values from a <code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code> annotation and
|
||||
returns a list of values that would evaluate as “the same” under the conditions of this
|
||||
invariant.</p>
|
||||
<p>For example, if <code class="docutils literal notranslate"><span class="pre">values</span></code> as a list with a single element, a numpy matrix, and the
|
||||
|
@ -860,7 +879,7 @@ present, this is the maximum satisfying timestamp of all child results</p>
|
|||
<ul>
|
||||
<li><a class="reference internal" href="#">API Reference</a><ul>
|
||||
<li><a class="reference internal" href="#annotations">Annotations</a><ul>
|
||||
<li><a class="reference internal" href="#value-annotations">Value Annotations</a></li>
|
||||
<li><a class="reference internal" href="#module-pybryt.annotations.value">Value Annotations</a></li>
|
||||
<li><a class="reference internal" href="#module-pybryt.annotations.relation">Relational Annotations</a></li>
|
||||
<li><a class="reference internal" href="#module-pybryt.annotations.invariants">Invariants</a></li>
|
||||
<li><a class="reference internal" href="#annotation-results">Annotation Results</a></li>
|
||||
|
|
|
@ -151,6 +151,8 @@
|
|||
<li><a href="api_reference.html#pybryt.AnnotationResult">AnnotationResult (class in pybryt)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.ReferenceImplementation.annotations">annotations (ReferenceImplementation attribute)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Attribute">Attribute (class in pybryt.annotations.value)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
@ -178,6 +180,8 @@
|
|||
|
||||
<ul>
|
||||
<li><a href="api_reference.html#pybryt.Annotation.check">(Annotation method)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Attribute.check">(Attribute method)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.annotations.relation.BeforeAnnotation.check">(BeforeAnnotation method)</a>
|
||||
</li>
|
||||
|
@ -189,7 +193,7 @@
|
|||
</li>
|
||||
<li><a href="api_reference.html#pybryt.StudentImplementation.check">(StudentImplementation method)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.Value.check">(Value method)</a>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Value.check">(Value method)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.annotations.relation.XorAnnotation.check">(XorAnnotation method)</a>
|
||||
</li>
|
||||
|
@ -203,9 +207,11 @@
|
|||
<li><a href="api_reference.html#pybryt.Annotation.children">children() (Annotation property)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Attribute.children">(Attribute property)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.annotations.relation.RelationalAnnotation.children">(RelationalAnnotation property)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.Value.children">(Value property)</a>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Value.children">(Value property)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="api_reference.html#pybryt.ReferenceImplementation.compile">compile() (ReferenceImplementation class method)</a>
|
||||
|
@ -278,13 +284,13 @@
|
|||
<h2>I</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api_reference.html#pybryt.Value.intial_value">intial_value (Value attribute)</a>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Value.intial_value">intial_value (Value attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api_reference.html#pybryt.annotations.invariants.invariant">invariant (class in pybryt.annotations.invariants)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.Value.invariants">invariants (Value attribute)</a>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Value.invariants">invariants (Value attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
@ -316,8 +322,6 @@
|
|||
<li><a href="api_reference.html#pybryt.ReferenceResult.messages">(ReferenceResult property)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li>
|
||||
module
|
||||
|
||||
|
@ -325,6 +329,8 @@
|
|||
<li><a href="api_reference.html#module-pybryt.annotations.invariants">pybryt.annotations.invariants</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#module-pybryt.annotations.relation">pybryt.annotations.relation</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#module-pybryt.annotations.value">pybryt.annotations.value</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
|
@ -370,13 +376,20 @@
|
|||
<li><a href="api_reference.html#module-pybryt.annotations.invariants">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li>
|
||||
pybryt.annotations.relation
|
||||
|
||||
<ul>
|
||||
<li><a href="api_reference.html#module-pybryt.annotations.relation">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li>
|
||||
pybryt.annotations.value
|
||||
|
||||
<ul>
|
||||
<li><a href="api_reference.html#module-pybryt.annotations.value">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
|
@ -445,7 +458,7 @@
|
|||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api_reference.html#pybryt.ReferenceResult.to_array">to_array() (ReferenceResult method)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.Value.tol">tol (Value attribute)</a>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Value.tol">tol (Value attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
@ -459,7 +472,7 @@
|
|||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api_reference.html#pybryt.Value">Value (class in pybryt)</a>
|
||||
<li><a href="api_reference.html#pybryt.annotations.value.Value">Value (class in pybryt.annotations.value)</a>
|
||||
</li>
|
||||
<li><a href="api_reference.html#pybryt.StudentImplementation.values">values (StudentImplementation attribute)</a>
|
||||
</li>
|
||||
|
|
Двоичные данные
docs/html/objects.inv
Двоичные данные
docs/html/objects.inv
Двоичный файл не отображается.
|
@ -141,14 +141,14 @@ complex boolean logic surrounding the presence, or lack thereof, of those values
|
|||
<p>All annotations are created by instaniating subclasses of the abstract
|
||||
<a class="reference internal" href="../api_reference.html#pybryt.Annotation" title="pybryt.Annotation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Annotation</span></code></a> class. Consider the most basic kind of annotation:
|
||||
expecting a specific value to appear while executing the student’s code. To create a value
|
||||
annotation, create an instance of <a class="reference internal" href="../api_reference.html#pybryt.Value" title="pybryt.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a>. The constructor takes in the
|
||||
annotation, create an instance of <code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code>. The constructor takes in the
|
||||
value that you are expecting to see in the student’s code:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span>
|
||||
<span class="n">arr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">100</span><span class="p">)</span>
|
||||
<span class="n">pybryt</span><span class="o">.</span><span class="n">Value</span><span class="p">(</span><span class="n">arr</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Note that when an instance of <a class="reference internal" href="../api_reference.html#pybryt.Value" title="pybryt.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> is created, <code class="xref py py-meth docutils literal notranslate"><span class="pre">copy.copy()</span></code> is
|
||||
<p>Note that when an instance of <code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code> is created, <code class="xref py py-meth docutils literal notranslate"><span class="pre">copy.copy()</span></code> is
|
||||
called on the argument passed to it, so values don’t need to worry about being affected by
|
||||
mutability.</p>
|
||||
<div class="section" id="numerical-tolerance">
|
||||
|
@ -224,7 +224,7 @@ before the array containing the <span class="math notranslate nohighlight">\(n\)
|
|||
condition such that we ensure the student followed the correct dynamic programming algorithm by
|
||||
checking each update to the <code class="docutils literal notranslate"><span class="pre">fibs</span></code> array.</p>
|
||||
<p>Temporal annotations are satisfied when the student’s code satisfies all of the child
|
||||
<a class="reference internal" href="../api_reference.html#pybryt.Value" title="pybryt.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> annotations and when the first annotation (the one calling
|
||||
<code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code> annotations and when the first annotation (the one calling
|
||||
<a class="reference internal" href="../api_reference.html#pybryt.Annotation.before" title="pybryt.Annotation.before"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Annotation.before</span></code></a>) has a timestamp greater than or equal to the
|
||||
timestamp of the second annotation.</p>
|
||||
<p>Note that <a class="reference internal" href="../api_reference.html#pybryt.Annotation.before" title="pybryt.Annotation.before"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Annotation.before</span></code></a> returns an instance of the
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -38,7 +38,8 @@ class UnassignedVarWrapper(ast.NodeTransformer):
|
|||
curr = node.parent
|
||||
body_child = None
|
||||
while not isinstance(curr, ast.Module):#hasattr(curr.parent, "body"):
|
||||
if hasattr(curr.parent, "body") and body_child is None:
|
||||
if hasattr(curr.parent, "body") and not (hasattr(curr.parent, "test") and \
|
||||
curr.parent.test == curr) and body_child is None:
|
||||
body_child = curr
|
||||
|
||||
# don't perform if in a comprehension
|
||||
|
@ -50,9 +51,9 @@ class UnassignedVarWrapper(ast.NodeTransformer):
|
|||
curr = curr.parent
|
||||
|
||||
curr = body_child
|
||||
is_else = False
|
||||
try:
|
||||
idx = curr.parent.body.index(curr)
|
||||
is_else = False
|
||||
except ValueError:
|
||||
if isinstance(curr.parent, ast.If):
|
||||
idx = curr.parent.orelse.index(curr)
|
||||
|
|
Загрузка…
Ссылка в новой задаче