Skip to content

Commit

Permalink
deploy: a23ac21
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhiyuanChen committed Aug 21, 2024
1 parent 9c270b7 commit 2c11ad7
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1859,8 +1859,8 @@ <h2 id="chanfig.config.Config" class="doc doc-heading">
<a id="__codelineno-0-100" name="__codelineno-0-100"></a> <span class="n">parser</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># ConfigParser, Python 3.7 does not support forward reference</span>
<a id="__codelineno-0-101" name="__codelineno-0-101"></a> <span class="n">frozen</span> <span class="o">=</span> <span class="kc">False</span>
<a id="__codelineno-0-102" name="__codelineno-0-102"></a>
<a id="__codelineno-0-103" name="__codelineno-0-103"></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">default_factory</span><span class="p">:</span> <span class="n">Callable</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span><span class="p">):</span>
<a id="__codelineno-0-104" name="__codelineno-0-104"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<a id="__codelineno-0-103" name="__codelineno-0-103"></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">default_factory</span><span class="p">:</span> <span class="n">Callable</span> <span class="o">|</span> <span class="n">NULL</span> <span class="o">=</span> <span class="n">Null</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span><span class="p">):</span>
<a id="__codelineno-0-104" name="__codelineno-0-104"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="n">Null</span><span class="p">:</span>
<a id="__codelineno-0-105" name="__codelineno-0-105"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="n">Config</span>
<a id="__codelineno-0-106" name="__codelineno-0-106"></a> <span class="bp">self</span><span class="o">.</span><span class="n">setattr</span><span class="p">(</span><span class="s2">&quot;frozen&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
<a id="__codelineno-0-107" name="__codelineno-0-107"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">default_factory</span><span class="o">=</span><span class="n">default_factory</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
Expand Down Expand Up @@ -1911,7 +1911,7 @@ <h2 id="chanfig.config.Config" class="doc doc-heading">
<a id="__codelineno-0-152" name="__codelineno-0-152"></a>
<a id="__codelineno-0-153" name="__codelineno-0-153"></a> <span class="bp">self</span><span class="o">.</span><span class="n">interpolate</span><span class="p">()</span>
<a id="__codelineno-0-154" name="__codelineno-0-154"></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate</span><span class="p">()</span>
<a id="__codelineno-0-155" name="__codelineno-0-155"></a> <span class="bp">self</span><span class="o">.</span><span class="n">apply_</span><span class="p">(</span><span class="k">lambda</span> <span class="n">c</span><span class="p">:</span> <span class="n">c</span><span class="o">.</span><span class="n">setattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">Config</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span>
<a id="__codelineno-0-155" name="__codelineno-0-155"></a> <span class="bp">self</span><span class="o">.</span><span class="n">apply_</span><span class="p">(</span><span class="k">lambda</span> <span class="n">c</span><span class="p">:</span> <span class="n">c</span><span class="o">.</span><span class="n">setattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="n">Null</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">Config</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span>
<a id="__codelineno-0-156" name="__codelineno-0-156"></a> <span class="k">return</span> <span class="bp">self</span>
<a id="__codelineno-0-157" name="__codelineno-0-157"></a>
<a id="__codelineno-0-158" name="__codelineno-0-158"></a> <span class="k">def</span> <span class="nf">boot</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Self</span><span class="p">:</span>
Expand Down Expand Up @@ -4115,7 +4115,7 @@ <h3 id="chanfig.config.Config.post" class="doc doc-heading">
<a id="__codelineno-0-152" name="__codelineno-0-152"></a>
<a id="__codelineno-0-153" name="__codelineno-0-153"></a> <span class="bp">self</span><span class="o">.</span><span class="n">interpolate</span><span class="p">()</span>
<a id="__codelineno-0-154" name="__codelineno-0-154"></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate</span><span class="p">()</span>
<a id="__codelineno-0-155" name="__codelineno-0-155"></a> <span class="bp">self</span><span class="o">.</span><span class="n">apply_</span><span class="p">(</span><span class="k">lambda</span> <span class="n">c</span><span class="p">:</span> <span class="n">c</span><span class="o">.</span><span class="n">setattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">Config</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span>
<a id="__codelineno-0-155" name="__codelineno-0-155"></a> <span class="bp">self</span><span class="o">.</span><span class="n">apply_</span><span class="p">(</span><span class="k">lambda</span> <span class="n">c</span><span class="p">:</span> <span class="n">c</span><span class="o">.</span><span class="n">setattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="n">Null</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">Config</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span>
<a id="__codelineno-0-156" name="__codelineno-0-156"></a> <span class="k">return</span> <span class="bp">self</span>
</code></pre></div></td></tr></table></div>
</details>
Expand Down
14 changes: 7 additions & 7 deletions default_dict/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ <h1 id="defaultdict">DefaultDict<a class="headerlink" href="#defaultdict" title=
<a id="__codelineno-0-57" name="__codelineno-0-57"></a><span class="sd"> TypeError: `default_factory=[]` must be Callable, but got &lt;class &#39;list&#39;&gt;.</span>
<a id="__codelineno-0-58" name="__codelineno-0-58"></a><span class="sd"> &quot;&quot;&quot;</span>
<a id="__codelineno-0-59" name="__codelineno-0-59"></a>
<a id="__codelineno-0-60" name="__codelineno-0-60"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="kc">None</span>
<a id="__codelineno-0-60" name="__codelineno-0-60"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="n">Null</span>
<a id="__codelineno-0-61" name="__codelineno-0-61"></a>
<a id="__codelineno-0-62" name="__codelineno-0-62"></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> <span class="c1"># pylint: disable=W1113</span>
<a id="__codelineno-0-63" name="__codelineno-0-63"></a> <span class="bp">self</span><span class="p">,</span> <span class="n">default_factory</span><span class="p">:</span> <span class="n">Callable</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">:</span> <span class="n">Any</span>
Expand All @@ -1211,7 +1211,7 @@ <h1 id="defaultdict">DefaultDict<a class="headerlink" href="#defaultdict" title=
<a id="__codelineno-0-73" name="__codelineno-0-73"></a>
<a id="__codelineno-0-74" name="__codelineno-0-74"></a> <span class="k">def</span> <span class="fm">__missing__</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="n">Any</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">Null</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Any</span><span class="p">:</span> <span class="c1"># pylint: disable=R1710</span>
<a id="__codelineno-0-75" name="__codelineno-0-75"></a> <span class="k">if</span> <span class="n">default</span> <span class="ow">is</span> <span class="n">Null</span><span class="p">:</span>
<a id="__codelineno-0-76" name="__codelineno-0-76"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="ow">in</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">Null</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;__&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">name</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">&quot;__&quot;</span><span class="p">)):</span>
<a id="__codelineno-0-76" name="__codelineno-0-76"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">)</span> <span class="ow">is</span> <span class="n">Null</span> <span class="ow">or</span> <span class="p">(</span><span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;__&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">name</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">&quot;__&quot;</span><span class="p">)):</span>
<a id="__codelineno-0-77" name="__codelineno-0-77"></a> <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="kn">from</span> <span class="kc">None</span>
<a id="__codelineno-0-78" name="__codelineno-0-78"></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">)()</span>
<a id="__codelineno-0-79" name="__codelineno-0-79"></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">default</span><span class="p">,</span> <span class="n">FlatDict</span><span class="p">):</span>
Expand All @@ -1221,7 +1221,7 @@ <h1 id="defaultdict">DefaultDict<a class="headerlink" href="#defaultdict" title=
<a id="__codelineno-0-83" name="__codelineno-0-83"></a>
<a id="__codelineno-0-84" name="__codelineno-0-84"></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<a id="__codelineno-0-85" name="__codelineno-0-85"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<a id="__codelineno-0-86" name="__codelineno-0-86"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<a id="__codelineno-0-86" name="__codelineno-0-86"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="n">Null</span><span class="p">:</span>
<a id="__codelineno-0-87" name="__codelineno-0-87"></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__repr__</span><span class="p">()</span>
<a id="__codelineno-0-88" name="__codelineno-0-88"></a> <span class="n">super_repr</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__repr__</span><span class="p">()[</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="p">)</span> <span class="p">:]</span> <span class="c1"># noqa: E203</span>
<a id="__codelineno-0-89" name="__codelineno-0-89"></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">super_repr</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
Expand Down Expand Up @@ -1255,8 +1255,8 @@ <h1 id="defaultdict">DefaultDict<a class="headerlink" href="#defaultdict" title=
<a id="__codelineno-0-117" name="__codelineno-0-117"></a><span class="sd"> Traceback (most recent call last):</span>
<a id="__codelineno-0-118" name="__codelineno-0-118"></a><span class="sd"> ValueError: Cannot add to a DefaultDict with no default_factory</span>
<a id="__codelineno-0-119" name="__codelineno-0-119"></a><span class="sd"> &quot;&quot;&quot;</span>
<a id="__codelineno-0-120" name="__codelineno-0-120"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<a id="__codelineno-0-121" name="__codelineno-0-121"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<a id="__codelineno-0-120" name="__codelineno-0-120"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">)</span>
<a id="__codelineno-0-121" name="__codelineno-0-121"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="n">Null</span><span class="p">:</span>
<a id="__codelineno-0-122" name="__codelineno-0-122"></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Cannot add to a DefaultDict with no default_factory&quot;</span><span class="p">)</span>
<a id="__codelineno-0-123" name="__codelineno-0-123"></a> <span class="bp">self</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">default_factory</span><span class="p">())</span> <span class="c1"># pylint: disable=E1102</span>
<a id="__codelineno-0-124" name="__codelineno-0-124"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
Expand Down Expand Up @@ -1419,8 +1419,8 @@ <h2 id="chanfig.DefaultDict.add" class="doc doc-heading">
<a id="__codelineno-0-117" name="__codelineno-0-117"></a><span class="sd"> Traceback (most recent call last):</span>
<a id="__codelineno-0-118" name="__codelineno-0-118"></a><span class="sd"> ValueError: Cannot add to a DefaultDict with no default_factory</span>
<a id="__codelineno-0-119" name="__codelineno-0-119"></a><span class="sd"> &quot;&quot;&quot;</span>
<a id="__codelineno-0-120" name="__codelineno-0-120"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<a id="__codelineno-0-121" name="__codelineno-0-121"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<a id="__codelineno-0-120" name="__codelineno-0-120"></a> <span class="n">default_factory</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getattr</span><span class="p">(</span><span class="s2">&quot;default_factory&quot;</span><span class="p">)</span>
<a id="__codelineno-0-121" name="__codelineno-0-121"></a> <span class="k">if</span> <span class="n">default_factory</span> <span class="ow">is</span> <span class="n">Null</span><span class="p">:</span>
<a id="__codelineno-0-122" name="__codelineno-0-122"></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Cannot add to a DefaultDict with no default_factory&quot;</span><span class="p">)</span>
<a id="__codelineno-0-123" name="__codelineno-0-123"></a> <span class="bp">self</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">default_factory</span><span class="p">())</span> <span class="c1"># pylint: disable=E1102</span>
<a id="__codelineno-0-124" name="__codelineno-0-124"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
Expand Down
Loading

0 comments on commit 2c11ad7

Please sign in to comment.