Skip to content

Commit

Permalink
deploy: b0c59c8
Browse files Browse the repository at this point in the history
  • Loading branch information
YodaEmbedding committed Feb 26, 2023
1 parent cf11966 commit 1ef0934
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 141 deletions.
20 changes: 12 additions & 8 deletions _modules/easy_slurm/format.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ <h1>Source code for easy_slurm.format</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Sequence</span>

<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span>
<span class="s2">&quot;format_with_config&quot;</span><span class="p">,</span>
<span class="p">]</span>


<div class="viewcode-block" id="format_with_config"><a class="viewcode-back" href="../../easy_slurm/format.html#easy_slurm.format.format_with_config">[docs]</a><span class="k">def</span> <span class="nf">format_with_config</span><span class="p">(</span>
<span class="n">template</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span>
Expand Down Expand Up @@ -291,7 +295,7 @@ <h1>Source code for easy_slurm.format</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">formatted_result</span></div>


<div class="viewcode-block" id="dict_get"><a class="viewcode-back" href="../../easy_slurm/format.html#easy_slurm.format.dict_get">[docs]</a><span class="k">def</span> <span class="nf">dict_get</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">],</span> <span class="n">path_seq</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="n">Any</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">dict_get</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">],</span> <span class="n">path_seq</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="n">Any</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Gets dictionary element of key path.</span>

<span class="sd"> Examples:</span>
Expand All @@ -304,10 +308,10 @@ <h1>Source code for easy_slurm.format</h1><div class="highlight"><pre>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">path_seq</span><span class="p">:</span>
<span class="n">d</span> <span class="o">=</span> <span class="n">d</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
<span class="k">return</span> <span class="n">d</span></div>
<span class="k">return</span> <span class="n">d</span>


<div class="viewcode-block" id="dict_set"><a class="viewcode-back" href="../../easy_slurm/format.html#easy_slurm.format.dict_set">[docs]</a><span class="k">def</span> <span class="nf">dict_set</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">],</span> <span class="n">path_seq</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">value</span><span class="p">:</span> <span class="n">Any</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">dict_set</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">],</span> <span class="n">path_seq</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">value</span><span class="p">:</span> <span class="n">Any</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Sets dictionary element of key path with given value.</span>

<span class="sd"> Examples:</span>
Expand All @@ -321,25 +325,25 @@ <h1>Source code for easy_slurm.format</h1><div class="highlight"><pre>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">path_seq</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]:</span>
<span class="n">d</span> <span class="o">=</span> <span class="n">d</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
<span class="n">d</span><span class="p">[</span><span class="n">path_seq</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span> <span class="o">=</span> <span class="n">value</span></div>
<span class="n">d</span><span class="p">[</span><span class="n">path_seq</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span> <span class="o">=</span> <span class="n">value</span>


<div class="viewcode-block" id="encode_pair"><a class="viewcode-back" href="../../easy_slurm/format.html#easy_slurm.format.encode_pair">[docs]</a><span class="k">def</span> <span class="nf">encode_pair</span><span class="p">(</span><span class="n">left</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">rep</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">s</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">encode_pair</span><span class="p">(</span><span class="n">left</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">rep</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">s</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Encodes a left/right pair using temporary characters.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">(</span>
<span class="n">s</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="s2">&quot;</span><span class="se">\ufffe</span><span class="s2">&quot;</span> <span class="o">*</span> <span class="n">rep</span><span class="p">)</span>
<span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">right</span><span class="p">,</span> <span class="s2">&quot;</span><span class="se">\uffff</span><span class="s2">&quot;</span> <span class="o">*</span> <span class="n">rep</span><span class="p">)</span>
<span class="p">)</span></div>
<span class="p">)</span>


<div class="viewcode-block" id="decode_pair"><a class="viewcode-back" href="../../easy_slurm/format.html#easy_slurm.format.decode_pair">[docs]</a><span class="k">def</span> <span class="nf">decode_pair</span><span class="p">(</span><span class="n">left</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">rep</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">s</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">decode_pair</span><span class="p">(</span><span class="n">left</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">rep</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">s</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Decodes a left/right pair using temporary characters.&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">(</span>
<span class="n">s</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\ufffe</span><span class="s2">&quot;</span> <span class="o">*</span> <span class="n">rep</span><span class="p">,</span> <span class="n">left</span><span class="p">)</span>
<span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\uffff</span><span class="s2">&quot;</span> <span class="o">*</span> <span class="n">rep</span><span class="p">,</span> <span class="n">right</span><span class="p">)</span>
<span class="p">)</span></div>
<span class="p">)</span>


<span class="k">def</span> <span class="nf">_format_term</span><span class="p">(</span>
Expand Down
Loading

0 comments on commit 1ef0934

Please sign in to comment.