import{_ as s,o as a,c as t,b as n,d as o,e}from"./app-Dq2hGnN2.js";const i={},p=n("h3",{id:"def-flat-config-config-dict-str-any-dict-str-any",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#def-flat-config-config-dict-str-any-dict-str-any"},[n("span",null,[n("em",null,[n("strong",null,"def")]),o(),n("code",null,"flat_config(config: dict[str, Any]) -> dict[str, Any]")])])],-1),c=n("p",null,"扁平化配置文件",-1),l=n("p",{"a.b.c:1":""},"{a:{b:{c:1}}} ->",-1),r=e(`<p>Args:</p><pre><code>config: 配置项目
</code></pre><p>Returns:</p><pre><code>扁平化后的配置文件，但也包含原有的键值对
</code></pre><details><summary>源代码</summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">flat_config</span><span class="token punctuation">(</span>config<span class="token punctuation">:</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">:</span>
    <span class="token triple-quoted-string string">&quot;&quot;&quot;
    扁平化配置文件

    {a:{b:{c:1}}} -&gt; {&quot;a.b.c&quot;: 1}
    Args:
        config: 配置项目

    Returns:
        扁平化后的配置文件，但也包含原有的键值对
    &quot;&quot;&quot;</span>
    new_config <span class="token operator">=</span> copy<span class="token punctuation">.</span>deepcopy<span class="token punctuation">(</span>config<span class="token punctuation">)</span>
    <span class="token keyword">for</span> <span class="token punctuation">(</span>key<span class="token punctuation">,</span> value<span class="token punctuation">)</span> <span class="token keyword">in</span> config<span class="token punctuation">.</span>items<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
        <span class="token keyword">if</span> <span class="token builtin">isinstance</span><span class="token punctuation">(</span>value<span class="token punctuation">,</span> <span class="token builtin">dict</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>k<span class="token punctuation">,</span> v<span class="token punctuation">)</span> <span class="token keyword">in</span> flat_config<span class="token punctuation">(</span>value<span class="token punctuation">)</span><span class="token punctuation">.</span>items<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
                new_config<span class="token punctuation">[</span><span class="token string-interpolation"><span class="token string">f&#39;</span><span class="token interpolation"><span class="token punctuation">{</span>key<span class="token punctuation">}</span></span><span class="token string">.</span><span class="token interpolation"><span class="token punctuation">{</span>k<span class="token punctuation">}</span></span><span class="token string">&#39;</span></span><span class="token punctuation">]</span> <span class="token operator">=</span> v
    <span class="token keyword">return</span> new_config
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="def-load-from-yaml-file-str-dict-str-any" tabindex="-1"><a class="header-anchor" href="#def-load-from-yaml-file-str-dict-str-any"><span><em><strong>def</strong></em> <code>load_from_yaml(file: str) -&gt; dict[str, Any]</code></span></a></h3><p>Load config from yaml file</p><details><summary>源代码</summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">load_from_yaml</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">:</span>
    <span class="token triple-quoted-string string">&quot;&quot;&quot;
    Load config from yaml file

    &quot;&quot;&quot;</span>
    logger<span class="token punctuation">.</span>debug<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Loading YAML config from </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">file</span><span class="token punctuation">}</span></span><span class="token string">&#39;</span></span><span class="token punctuation">)</span>
    config <span class="token operator">=</span> yaml<span class="token punctuation">.</span>safe_load<span class="token punctuation">(</span><span class="token builtin">open</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">,</span> <span class="token string">&#39;r&#39;</span><span class="token punctuation">,</span> encoding<span class="token operator">=</span><span class="token string">&#39;utf-8&#39;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token keyword">return</span> flat_config<span class="token punctuation">(</span>config <span class="token keyword">if</span> config <span class="token keyword">is</span> <span class="token keyword">not</span> <span class="token boolean">None</span> <span class="token keyword">else</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="def-load-from-json-file-str-dict-str-any" tabindex="-1"><a class="header-anchor" href="#def-load-from-json-file-str-dict-str-any"><span><em><strong>def</strong></em> <code>load_from_json(file: str) -&gt; dict[str, Any]</code></span></a></h3><p>Load config from json file</p><details><summary>源代码</summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">load_from_json</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">:</span>
    <span class="token triple-quoted-string string">&quot;&quot;&quot;
    Load config from json file
    &quot;&quot;&quot;</span>
    logger<span class="token punctuation">.</span>debug<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Loading JSON config from </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">file</span><span class="token punctuation">}</span></span><span class="token string">&#39;</span></span><span class="token punctuation">)</span>
    config <span class="token operator">=</span> json<span class="token punctuation">.</span>load<span class="token punctuation">(</span><span class="token builtin">open</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">,</span> <span class="token string">&#39;r&#39;</span><span class="token punctuation">,</span> encoding<span class="token operator">=</span><span class="token string">&#39;utf-8&#39;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token keyword">return</span> flat_config<span class="token punctuation">(</span>config <span class="token keyword">if</span> config <span class="token keyword">is</span> <span class="token keyword">not</span> <span class="token boolean">None</span> <span class="token keyword">else</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="def-load-from-toml-file-str-dict-str-any" tabindex="-1"><a class="header-anchor" href="#def-load-from-toml-file-str-dict-str-any"><span><em><strong>def</strong></em> <code>load_from_toml(file: str) -&gt; dict[str, Any]</code></span></a></h3><p>Load config from toml file</p><details><summary>源代码</summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">load_from_toml</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">:</span>
    <span class="token triple-quoted-string string">&quot;&quot;&quot;
    Load config from toml file
    &quot;&quot;&quot;</span>
    logger<span class="token punctuation">.</span>debug<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Loading TOML config from </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">file</span><span class="token punctuation">}</span></span><span class="token string">&#39;</span></span><span class="token punctuation">)</span>
    config <span class="token operator">=</span> toml<span class="token punctuation">.</span>load<span class="token punctuation">(</span><span class="token builtin">open</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">,</span> <span class="token string">&#39;r&#39;</span><span class="token punctuation">,</span> encoding<span class="token operator">=</span><span class="token string">&#39;utf-8&#39;</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token keyword">return</span> flat_config<span class="token punctuation">(</span>config <span class="token keyword">if</span> config <span class="token keyword">is</span> <span class="token keyword">not</span> <span class="token boolean">None</span> <span class="token keyword">else</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="def-load-from-files-dict-str-any" tabindex="-1"><a class="header-anchor" href="#def-load-from-files-dict-str-any"><span><em><strong>def</strong></em> <code>load_from_files() -&gt; dict[str, Any]</code></span></a></h3><p>从指定文件加载配置项，会自动识别文件格式</p><p>默认执行扁平化选项</p><details><summary>源代码</summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">load_from_files</span><span class="token punctuation">(</span><span class="token operator">*</span>files<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> no_warning<span class="token punctuation">:</span> <span class="token builtin">bool</span><span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">:</span>
    <span class="token triple-quoted-string string">&quot;&quot;&quot;
    从指定文件加载配置项，会自动识别文件格式
    默认执行扁平化选项
    &quot;&quot;&quot;</span>
    config <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
    <span class="token keyword">for</span> <span class="token builtin">file</span> <span class="token keyword">in</span> files<span class="token punctuation">:</span>
        <span class="token keyword">if</span> os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>exists<span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
            <span class="token keyword">if</span> <span class="token builtin">file</span><span class="token punctuation">.</span>endswith<span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token string">&#39;.yaml&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;yml&#39;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
                config<span class="token punctuation">.</span>update<span class="token punctuation">(</span>load_from_yaml<span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
            <span class="token keyword">elif</span> <span class="token builtin">file</span><span class="token punctuation">.</span>endswith<span class="token punctuation">(</span><span class="token string">&#39;.json&#39;</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
                config<span class="token punctuation">.</span>update<span class="token punctuation">(</span>load_from_json<span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
            <span class="token keyword">elif</span> <span class="token builtin">file</span><span class="token punctuation">.</span>endswith<span class="token punctuation">(</span><span class="token string">&#39;.toml&#39;</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
                config<span class="token punctuation">.</span>update<span class="token punctuation">(</span>load_from_toml<span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
            <span class="token keyword">elif</span> <span class="token keyword">not</span> no_warning<span class="token punctuation">:</span>
                logger<span class="token punctuation">.</span>warning<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Unsupported config file format: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">file</span><span class="token punctuation">}</span></span><span class="token string">&#39;</span></span><span class="token punctuation">)</span>
        <span class="token keyword">elif</span> <span class="token keyword">not</span> no_warning<span class="token punctuation">:</span>
            logger<span class="token punctuation">.</span>warning<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Config file not found: </span><span class="token interpolation"><span class="token punctuation">{</span><span class="token builtin">file</span><span class="token punctuation">}</span></span><span class="token string">&#39;</span></span><span class="token punctuation">)</span>
    <span class="token keyword">return</span> config
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="def-load-configs-from-dirs-dict-str-any" tabindex="-1"><a class="header-anchor" href="#def-load-configs-from-dirs-dict-str-any"><span><em><strong>def</strong></em> <code>load_configs_from_dirs() -&gt; dict[str, Any]</code></span></a></h3><p>从目录下加载配置文件，不递归</p><p>按照读取文件的优先级反向覆盖</p><p>默认执行扁平化选项</p><details><summary>源代码</summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">load_configs_from_dirs</span><span class="token punctuation">(</span><span class="token operator">*</span>directories<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> no_waring<span class="token punctuation">:</span> <span class="token builtin">bool</span><span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">:</span>
    <span class="token triple-quoted-string string">&quot;&quot;&quot;
    从目录下加载配置文件，不递归
    按照读取文件的优先级反向覆盖
    默认执行扁平化选项
    &quot;&quot;&quot;</span>
    config <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
    <span class="token keyword">for</span> directory <span class="token keyword">in</span> directories<span class="token punctuation">:</span>
        <span class="token keyword">if</span> <span class="token keyword">not</span> os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>exists<span class="token punctuation">(</span>directory<span class="token punctuation">)</span><span class="token punctuation">:</span>
            <span class="token keyword">if</span> <span class="token keyword">not</span> no_waring<span class="token punctuation">:</span>
                logger<span class="token punctuation">.</span>warning<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Directory not found: </span><span class="token interpolation"><span class="token punctuation">{</span>directory<span class="token punctuation">}</span></span><span class="token string">&#39;</span></span><span class="token punctuation">)</span>
            <span class="token keyword">continue</span>
        <span class="token keyword">for</span> <span class="token builtin">file</span> <span class="token keyword">in</span> os<span class="token punctuation">.</span>listdir<span class="token punctuation">(</span>directory<span class="token punctuation">)</span><span class="token punctuation">:</span>
            <span class="token keyword">if</span> <span class="token builtin">file</span><span class="token punctuation">.</span>endswith<span class="token punctuation">(</span>_SUPPORTED_CONFIG_FORMATS<span class="token punctuation">)</span><span class="token punctuation">:</span>
                config<span class="token punctuation">.</span>update<span class="token punctuation">(</span>load_from_files<span class="token punctuation">(</span>os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>join<span class="token punctuation">(</span>directory<span class="token punctuation">,</span> <span class="token builtin">file</span><span class="token punctuation">)</span><span class="token punctuation">,</span> no_warning<span class="token operator">=</span>no_waring<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token keyword">return</span> config
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="def-load-config-in-default-no-waring-bool-dict-str-any" tabindex="-1"><a class="header-anchor" href="#def-load-config-in-default-no-waring-bool-dict-str-any"><span><em><strong>def</strong></em> <code>load_config_in_default(no_waring: bool) -&gt; dict[str, Any]</code></span></a></h3><p>从一个标准的轻雪项目加载配置文件</p><p>项目目录下的config.*和config目录下的所有配置文件</p><p>项目目录下的配置文件优先</p><details><summary>源代码</summary><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">def</span> <span class="token function">load_config_in_default</span><span class="token punctuation">(</span>no_waring<span class="token punctuation">:</span> <span class="token builtin">bool</span><span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">dict</span><span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> Any<span class="token punctuation">]</span><span class="token punctuation">:</span>
    <span class="token triple-quoted-string string">&quot;&quot;&quot;
    从一个标准的轻雪项目加载配置文件
    项目目录下的config.*和config目录下的所有配置文件
    项目目录下的配置文件优先
    &quot;&quot;&quot;</span>
    config <span class="token operator">=</span> load_configs_from_dirs<span class="token punctuation">(</span><span class="token string">&#39;config&#39;</span><span class="token punctuation">,</span> no_waring<span class="token operator">=</span>no_waring<span class="token punctuation">)</span>
    config<span class="token punctuation">.</span>update<span class="token punctuation">(</span>load_from_files<span class="token punctuation">(</span><span class="token string">&#39;config.yaml&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;config.toml&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;config.json&#39;</span><span class="token punctuation">,</span> <span class="token string">&#39;config.yml&#39;</span><span class="token punctuation">,</span> no_warning<span class="token operator">=</span>no_waring<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token keyword">return</span> config
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="class-satorinodeconfig-basemodel" tabindex="-1"><a class="header-anchor" href="#class-satorinodeconfig-basemodel"><span><em><strong>class</strong></em> <code>SatoriNodeConfig(BaseModel)</code></span></a></h3><h3 id="class-satoriconfig-basemodel" tabindex="-1"><a class="header-anchor" href="#class-satoriconfig-basemodel"><span><em><strong>class</strong></em> <code>SatoriConfig(BaseModel)</code></span></a></h3><h3 id="class-basicconfig-basemodel" tabindex="-1"><a class="header-anchor" href="#class-basicconfig-basemodel"><span><em><strong>class</strong></em> <code>BasicConfig(BaseModel)</code></span></a></h3><h3 id="var-new-config-copy-deepcopy-config" tabindex="-1"><a class="header-anchor" href="#var-new-config-copy-deepcopy-config"><span><em><strong>var</strong></em> <code>new_config = copy.deepcopy(config)</code></span></a></h3><h3 id="var-config-yaml-safe-load-open-file-r-encoding-utf-8" tabindex="-1"><a class="header-anchor" href="#var-config-yaml-safe-load-open-file-r-encoding-utf-8"><span><em><strong>var</strong></em> <code>config = yaml.safe_load(open(file, &#39;r&#39;, encoding=&#39;utf-8&#39;))</code></span></a></h3><h3 id="var-config-json-load-open-file-r-encoding-utf-8" tabindex="-1"><a class="header-anchor" href="#var-config-json-load-open-file-r-encoding-utf-8"><span><em><strong>var</strong></em> <code>config = json.load(open(file, &#39;r&#39;, encoding=&#39;utf-8&#39;))</code></span></a></h3><h3 id="var-config-toml-load-open-file-r-encoding-utf-8" tabindex="-1"><a class="header-anchor" href="#var-config-toml-load-open-file-r-encoding-utf-8"><span><em><strong>var</strong></em> <code>config = toml.load(open(file, &#39;r&#39;, encoding=&#39;utf-8&#39;))</code></span></a></h3><h3 id="var-config" tabindex="-1"><a class="header-anchor" href="#var-config"><span><em><strong>var</strong></em> <code>config = {}</code></span></a></h3><h3 id="var-config-1" tabindex="-1"><a class="header-anchor" href="#var-config-1"><span><em><strong>var</strong></em> <code>config = {}</code></span></a></h3><h3 id="var-config-load-configs-from-dirs-config-no-waring-no-waring" tabindex="-1"><a class="header-anchor" href="#var-config-load-configs-from-dirs-config-no-waring-no-waring"><span><em><strong>var</strong></em> <code>config = load_configs_from_dirs(&#39;config&#39;, no_waring=no_waring)</code></span></a></h3>`,38),u=[p,c,l,r];function d(k,f){return a(),t("div",null,u)}const m=s(i,[["render",d],["__file","config.html.vue"]]),v=JSON.parse(`{"path":"/en/dev/api/config.html","title":"liteyuki.config","lang":"en-US","frontmatter":{"title":"liteyuki.config","order":1,"icon":"laptop-code","category":"API","description":"def flat_config(config: dict[str, Any]) -> dict[str, Any] 扁平化配置文件 {a:{b:{c:1}}} -> Args: Returns: 源代码 def load_from_yaml(file: str) -> dict[str, Any] Load config from yaml file ...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/config.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/config.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.config"}],["meta",{"property":"og:description","content":"def flat_config(config: dict[str, Any]) -> dict[str, Any] 扁平化配置文件 {a:{b:{c:1}}} -> Args: Returns: 源代码 def load_from_yaml(file: str) -> dict[str, Any] Load config from yaml file ..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-08-21T09:59:21.000Z"}],["meta",{"property":"article:modified_time","content":"2024-08-21T09:59:21.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.config\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-21T09:59:21.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"def flat_config(config: dict[str, Any]) -> dict[str, Any]","slug":"def-flat-config-config-dict-str-any-dict-str-any","link":"#def-flat-config-config-dict-str-any-dict-str-any","children":[]},{"level":3,"title":"def load_from_yaml(file: str) -> dict[str, Any]","slug":"def-load-from-yaml-file-str-dict-str-any","link":"#def-load-from-yaml-file-str-dict-str-any","children":[]},{"level":3,"title":"def load_from_json(file: str) -> dict[str, Any]","slug":"def-load-from-json-file-str-dict-str-any","link":"#def-load-from-json-file-str-dict-str-any","children":[]},{"level":3,"title":"def load_from_toml(file: str) -> dict[str, Any]","slug":"def-load-from-toml-file-str-dict-str-any","link":"#def-load-from-toml-file-str-dict-str-any","children":[]},{"level":3,"title":"def load_from_files() -> dict[str, Any]","slug":"def-load-from-files-dict-str-any","link":"#def-load-from-files-dict-str-any","children":[]},{"level":3,"title":"def load_configs_from_dirs() -> dict[str, Any]","slug":"def-load-configs-from-dirs-dict-str-any","link":"#def-load-configs-from-dirs-dict-str-any","children":[]},{"level":3,"title":"def load_config_in_default(no_waring: bool) -> dict[str, Any]","slug":"def-load-config-in-default-no-waring-bool-dict-str-any","link":"#def-load-config-in-default-no-waring-bool-dict-str-any","children":[]},{"level":3,"title":"class SatoriNodeConfig(BaseModel)","slug":"class-satorinodeconfig-basemodel","link":"#class-satorinodeconfig-basemodel","children":[]},{"level":3,"title":"class SatoriConfig(BaseModel)","slug":"class-satoriconfig-basemodel","link":"#class-satoriconfig-basemodel","children":[]},{"level":3,"title":"class BasicConfig(BaseModel)","slug":"class-basicconfig-basemodel","link":"#class-basicconfig-basemodel","children":[]},{"level":3,"title":"var new_config = copy.deepcopy(config)","slug":"var-new-config-copy-deepcopy-config","link":"#var-new-config-copy-deepcopy-config","children":[]},{"level":3,"title":"var config = yaml.safe_load(open(file, 'r', encoding='utf-8'))","slug":"var-config-yaml-safe-load-open-file-r-encoding-utf-8","link":"#var-config-yaml-safe-load-open-file-r-encoding-utf-8","children":[]},{"level":3,"title":"var config = json.load(open(file, 'r', encoding='utf-8'))","slug":"var-config-json-load-open-file-r-encoding-utf-8","link":"#var-config-json-load-open-file-r-encoding-utf-8","children":[]},{"level":3,"title":"var config = toml.load(open(file, 'r', encoding='utf-8'))","slug":"var-config-toml-load-open-file-r-encoding-utf-8","link":"#var-config-toml-load-open-file-r-encoding-utf-8","children":[]},{"level":3,"title":"var config = {}","slug":"var-config","link":"#var-config","children":[]},{"level":3,"title":"var config = {}","slug":"var-config-1","link":"#var-config-1","children":[]},{"level":3,"title":"var config = load_configs_from_dirs('config', no_waring=no_waring)","slug":"var-config-load-configs-from-dirs-config-no-waring-no-waring","link":"#var-config-load-configs-from-dirs-config-no-waring-no-waring","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724234361000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":1}]},"readingTime":{"minutes":2.5,"words":749},"filePathRelative":"en/dev/api/config.md","localizedDate":"August 21, 2024","autoDesc":true}`);export{m as comp,v as data};
