Skip to content

Commit

Permalink
Deploying to gh-pages from @ d0ee394 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff committed Jun 6, 2024
1 parent a757d8f commit fc55495
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
4 changes: 4 additions & 0 deletions _downloads/621e2c7711e8623173875c33222eddb6/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -582,3 +582,7 @@
added:
- max_value and min_value in Variable class.
date: 2024-06-04 19:43:13
- bump: patch
changes:
added: Visualization option when running tests
date: 2024-06-06 09:09:41
23 changes: 22 additions & 1 deletion _modules/policyengine_core/tools/test_runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ <h1>Source code for policyengine_core.tools.test_runner</h1><div class="highligh
<span class="n">verbose</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;verbose&quot;</span><span class="p">)</span>
<span class="n">performance_graph</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;performance_graph&quot;</span><span class="p">)</span>
<span class="n">performance_tables</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;performance_tables&quot;</span><span class="p">)</span>
<span class="n">visualize</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;visualize&quot;</span><span class="p">)</span>

<span class="k">try</span><span class="p">:</span>
<span class="n">builder</span><span class="o">.</span><span class="n">set_default_period</span><span class="p">(</span><span class="n">period</span><span class="p">)</span>
Expand All @@ -495,7 +496,7 @@ <h1>Source code for policyengine_core.tools.test_runner</h1><div class="highligh

<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">simulation</span><span class="o">.</span><span class="n">trace</span> <span class="o">=</span> <span class="p">(</span>
<span class="n">verbose</span> <span class="ow">or</span> <span class="n">performance_graph</span> <span class="ow">or</span> <span class="n">performance_tables</span>
<span class="n">verbose</span> <span class="ow">or</span> <span class="n">performance_graph</span> <span class="ow">or</span> <span class="n">performance_tables</span> <span class="ow">or</span> <span class="n">visualize</span>
<span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">check_output</span><span class="p">()</span>
<span class="k">finally</span><span class="p">:</span>
Expand All @@ -506,6 +507,8 @@ <h1>Source code for policyengine_core.tools.test_runner</h1><div class="highligh
<span class="bp">self</span><span class="o">.</span><span class="n">generate_performance_graph</span><span class="p">(</span><span class="n">tracer</span><span class="p">)</span>
<span class="k">if</span> <span class="n">performance_tables</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">generate_performance_tables</span><span class="p">(</span><span class="n">tracer</span><span class="p">)</span>
<span class="k">if</span> <span class="n">visualize</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">generate_variable_graph</span><span class="p">(</span><span class="n">tracer</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">print_computation_log</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tracer</span><span class="p">):</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Computation log:&quot;</span><span class="p">)</span> <span class="c1"># noqa T001</span>
Expand All @@ -517,6 +520,24 @@ <h1>Source code for policyengine_core.tools.test_runner</h1><div class="highligh
<span class="k">def</span> <span class="nf">generate_performance_tables</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tracer</span><span class="p">):</span>
<span class="n">tracer</span><span class="o">.</span><span class="n">generate_performance_tables</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">generate_variable_graph</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tracer</span><span class="p">):</span>
<span class="n">tracer</span><span class="o">.</span><span class="n">generate_variable_graph</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;name&quot;</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_all_output_vars</span><span class="p">()</span>
<span class="p">)</span>

<span class="k">def</span> <span class="nf">_all_output_vars</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_leaf_keys</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">test</span><span class="p">[</span><span class="s2">&quot;output&quot;</span><span class="p">])</span>

<span class="k">def</span> <span class="nf">_get_leaf_keys</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dictionary</span><span class="p">:</span> <span class="nb">dict</span><span class="p">):</span>
<span class="n">keys</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">dictionary</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">dict</span><span class="p">:</span>
<span class="n">keys</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_leaf_keys</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">keys</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>

<span class="k">return</span> <span class="n">keys</span>

<span class="k">def</span> <span class="nf">check_output</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">test</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;output&quot;</span><span class="p">)</span>

Expand Down
11 changes: 11 additions & 0 deletions _modules/policyengine_core/tracers/full_tracer.html
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ <h1>Source code for policyengine_core.tracers.full_tracer</h1><div class="highli
<span class="k">def</span> <span class="nf">performance_log</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">tracers</span><span class="o">.</span><span class="n">PerformanceLog</span><span class="p">:</span>
<span class="k">return</span> <span class="n">tracers</span><span class="o">.</span><span class="n">PerformanceLog</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">variable_graph</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">tracers</span><span class="o">.</span><span class="n">VariableGraph</span><span class="p">:</span>
<span class="k">return</span> <span class="n">tracers</span><span class="o">.</span><span class="n">VariableGraph</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">flat_trace</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">tracers</span><span class="o">.</span><span class="n">FlatTrace</span><span class="p">:</span>
<span class="k">return</span> <span class="n">tracers</span><span class="o">.</span><span class="n">FlatTrace</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
Expand All @@ -378,6 +382,13 @@ <h1>Source code for policyengine_core.tracers.full_tracer</h1><div class="highli
<span class="k">def</span> <span class="nf">generate_performance_tables</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dir_path</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">performance_log</span><span class="o">.</span><span class="n">generate_performance_tables</span><span class="p">(</span><span class="n">dir_path</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">generate_variable_graph</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">output_vars</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">variable_graph</span><span class="o">.</span><span class="n">visualize</span><span class="p">(</span>
<span class="n">name</span><span class="p">,</span> <span class="n">aggregate</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">max_depth</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">output_vars</span><span class="o">=</span><span class="n">output_vars</span>
<span class="p">)</span>

<span class="k">def</span> <span class="nf">_get_nb_requests</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tree</span><span class="p">:</span> <span class="n">tracers</span><span class="o">.</span><span class="n">TraceNode</span><span class="p">,</span> <span class="n">variable</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
<span class="n">tree_call</span> <span class="o">=</span> <span class="n">tree</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="n">variable</span>
<span class="n">children_calls</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions usage/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ <h3>test<a class="headerlink" href="#test" title="Permalink to this heading">#</
<p>Run OpenFisca YAML tests</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">policyengine</span><span class="o">-</span><span class="n">core</span> <span class="n">test</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">c</span> <span class="n">COUNTRY_PACKAGE</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">e</span> <span class="p">[</span><span class="n">EXTENSIONS</span> <span class="o">...</span><span class="p">]]</span>
<span class="p">[</span><span class="o">-</span><span class="n">r</span> <span class="p">[</span><span class="n">REFORMS</span> <span class="o">...</span><span class="p">]]</span> <span class="p">[</span><span class="o">-</span><span class="n">n</span> <span class="n">NAME_FILTER</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">p</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">performance</span><span class="o">-</span><span class="n">graph</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">performance</span><span class="o">-</span><span class="n">tables</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">v</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">a</span><span class="p">]</span>
<span class="p">[</span><span class="o">-</span><span class="n">d</span> <span class="n">MAX_DEPTH</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">o</span> <span class="p">[</span><span class="n">ONLY_VARIABLES</span> <span class="o">...</span><span class="p">]]</span>
<span class="p">[</span><span class="o">-</span><span class="n">i</span> <span class="p">[</span><span class="n">IGNORE_VARIABLES</span> <span class="o">...</span><span class="p">]]</span>
<span class="p">[</span><span class="o">--</span><span class="n">performance</span><span class="o">-</span><span class="n">graph</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">performance</span><span class="o">-</span><span class="n">tables</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">v</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">visualize</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">a</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">d</span> <span class="n">MAX_DEPTH</span><span class="p">]</span>
<span class="p">[</span><span class="o">-</span><span class="n">o</span> <span class="p">[</span><span class="n">ONLY_VARIABLES</span> <span class="o">...</span><span class="p">]]</span> <span class="p">[</span><span class="o">-</span><span class="n">i</span> <span class="p">[</span><span class="n">IGNORE_VARIABLES</span> <span class="o">...</span><span class="p">]]</span>
<span class="n">path</span> <span class="p">[</span><span class="n">path</span> <span class="o">...</span><span class="p">]</span>
</pre></div>
</div>
Expand Down Expand Up @@ -305,6 +305,10 @@ <h4>Named Arguments<a class="headerlink" href="#named-arguments" title="Permalin
<dd><p>increase output verbosity. If specified, output the entire calculation trace.</p>
<p>Default: False</p>
</dd>
<dt><kbd>--visualize</kbd></dt>
<dd><p>output a relationship graph of the variables being tested</p>
<p>Default: False</p>
</dd>
<dt><kbd>-a, --aggregate</kbd></dt>
<dd><p>increase output verbosity to aggregate. If specified, output the avg, max, and min values of the calculation trace. This flag has no effect without –verbose.</p>
<p>Default: False</p>
Expand Down

0 comments on commit fc55495

Please sign in to comment.