app/assets/load.html-C5yFvCMo.js

87 lines
30 KiB
JavaScript
Raw Normal View History

import{_ as p,r as o,o as e,c as i,b as s,d as n,a as l,w as c,e as a}from"./app-BvUYPzLF.js";const u={},r=a(`<h1 id="liteyuki-plugin-load" tabindex="-1"><a class="header-anchor" href="#liteyuki-plugin-load"><span>liteyuki.plugin.load</span></a></h1><p><strong>Description</strong>: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved</p><p>@Time : 2024/7/23 下午11:59 @Author : snowykami @Email : snowykami@outlook.com @File : load.py @Software: PyCharm</p><h3 id="def-load-plugin-module-path-str-path-optional-plugin" tabindex="-1"><a class="header-anchor" href="#def-load-plugin-module-path-str-path-optional-plugin"><span><em><strong>def</strong></em> <code>load_plugin(module_path: str | Path) -&gt; Optional[Plugin]</code></span></a></h3><p><strong>Description</strong>: 加载单个插件,可以是本地插件或是通过 <code>pip</code> 安装的插件。</p><p><strong>Arguments</strong>:</p><blockquote><ul><li>module_path: 插件名称 <code>path.to.your.plugin</code></li><li>或插件路径 <code>pathlib.Path(path/to/your/plugin)</code>:</li></ul></blockquote><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/plugin/load.py#L30" target="_blank">View on GitHub</a></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_plugin</span><span class="token punctuation">(</span>module_path<span class="token punctuation">:</span> <span class="token builtin">str</span> <span class="token operator">|</span> Path<span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> Optional<span class="token punctuation">[</span>Plugin<span class="token punctuation">]</span><span class="token punctuation">:</span>
<span class="token triple-quoted-string string">&quot;&quot;&quot;加载单个插件可以是本地插件或是通过 \`pip\` 安装的插件。
参数:
module_path: 插件名称 \`path.to.your.plugin\`
或插件路径 \`pathlib.Path(path/to/your/plugin)\`
&quot;&quot;&quot;</span>
module_path <span class="token operator">=</span> path_to_module_name<span class="token punctuation">(</span>Path<span class="token punctuation">(</span>module_path<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>module_path<span class="token punctuation">,</span> Path<span class="token punctuation">)</span> <span class="token keyword">else</span> module_path
<span class="token keyword">try</span><span class="token punctuation">:</span>
module <span class="token operator">=</span> import_module<span class="token punctuation">(</span>module_path<span class="token punctuation">)</span>
_plugins<span class="token punctuation">[</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">]</span> <span class="token operator">=</span> Plugin<span class="token punctuation">(</span>name<span class="token operator">=</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">,</span> module<span class="token operator">=</span>module<span class="token punctuation">,</span> module_name<span class="token operator">=</span>module_path<span class="token punctuation">)</span>
<span class="token keyword">if</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">&#39;__plugin_metadata__&#39;</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
metadata<span class="token punctuation">:</span> <span class="token string">&#39;PluginMetadata&#39;</span> <span class="token operator">=</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">[</span><span class="token string">&#39;__plugin_metadata__&#39;</span><span class="token punctuation">]</span>
display_name <span class="token operator">=</span> module<span class="token punctuation">.</span>__name__<span class="token punctuation">.</span>split<span class="token punctuation">(</span><span class="token string">&#39;.&#39;</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">]</span>
<span class="token keyword">elif</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">&#39;__liteyuki_plugin_meta__&#39;</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
metadata<span class="token punctuation">:</span> <span class="token string">&#39;PluginMetadata&#39;</span> <span class="token operator">=</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">[</span><span class="token string">&#39;__liteyuki_plugin_meta__&#39;</span><span class="token punctuation">]</span>
display_name <span class="token operator">=</span> format_display_name<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&quot;</span><span class="token interpolation"><span class="token punctuation">{</span>metadata<span class="token punctuation">.</span>name<span class="token punctuation">}</span></span><span class="token string">(</span><span class="token interpolation"><span class="token punctuation">{</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">.</span>split<span class="token punctuation">(</span><span class="token string">&#39;.&#39;</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">}</span></span><span class="token string">)&quot;</span></span><span class="token punctuation">,</span> metadata<span class="token punctuation">.</span><span class="token builtin">type</span><span class="token punctuation">)</span>
<span class="token keyword">elif</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">&#39;__plugin_meta__&#39;</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
metadata<span class="token punctuation">:</span> <span class="token string">&#39;PluginMetadata&#39;</span> <span class="token operator">=</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">[</span><span class="token string">&#39;__plugin_meta__&#39;</span><span class="token punctuation">]</span>
display_name <span class="token operator">=</span> format_display_name<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&quot;</span><span class="token interpolation"><span class="token punctuation">{</span>metadata<span class="token punctuation">.</span>name<span class="token punctuation">}</span></span><span class="token string">(</span><span class="token interpolation"><span class="token punctuation">{</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">.</span>split<span class="token punctuation">(</span><span class="token string">&#39;.&#39;</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">}</span></span><span class="token string">)&quot;</span></span><span class="token punctuation">,</span> metadata<span class="token punctuation">.</span><span class="token builtin">type</span><span class="token punctuation">)</span>
<span class="token keyword">else</span><span class="token punctuation">:</span>
logger<span class="token punctuation">.</span>opt<span class="token punctuation">(</span>colors<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">.</span>warning<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;The metadata of Liteyuki plugin &quot;</span><span class="token interpolation"><span class="token punctuation">{</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">}</span></span><span class="token string">&quot; is not specified, use empty.&#39;</span></span><span class="token punctuation">)</span>
metadata <span class="token operator">=</span> PluginMetadata<span class="token punctuation">(</span>name<span class="token operator">=</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">)</span>
display_name <span class="token operator">=</span> module<span class="token punctuation">.</span>__name__<span class="token punctuation">.</span>split<span class="token punctuation">(</span><span class="token string">&#39;.&#39;</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">]</span>
_plugins<span class="token punctuation">[</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">]</span><span class="token punctuation">.</span>metadata <span class="token operator">=</span> metadata
logger<span class="token punctuation">.</span>opt<span class="token punctuation">(</span>colors<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">.</span>success<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Succeeded to load liteyuki plugin &quot;</span><span class="token interpolation"><span class="token punctuation">{</span>display_name<span class="token punctuation">}</span></span><span class="token string">&quot;&#39;</span></span><span class="token punctuation">)</span>
<span class="token keyword">return</span> _plugins<span class="token punctuation">[</span>module<span class="token punctuation">.</span>__name__<span class="token punctuation">]</span>
<span class="token keyword">except</span> Exception <span class="token keyword">as</span> e<span class="token punctuation">:</span>
logger<span class="token punctuation">.</span>opt<span class="token punctuation">(</span>colors<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span><span class="token punctuation">.</span>success<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f&#39;Failed to load liteyuki plugin &quot;&lt;r&gt;</span><span class="token interpolation"><span class="token punctuation">{</span>module_path<span class="token punctuation">}</span></span><span class="token string">&lt;/r&gt;&quot;&#39;</span></span><span class="token punctuation">)</span>
traceback<span class="token punctuation">.</span>print_exc<span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">return</span> <span class="token boolean">None</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 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 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-plugins-plugin-dir-str-ignore-warning-bool-true-set-plugin" tabindex="-1"><a class="header-anchor" href="#def-load-plugins-plugin-dir-str-ignore-warning-bool-true-set-plugin"><span><em><strong>def</strong></em> <code>load_plugins(*plugin_dir: str, *, ignore_warning: bool = True) -&gt; set[Plugin]</code></span></a></h3><p><strong>Description</strong>: </p><p><strong>Arguments</strong>:</p><blockquote><ul><li>plugin_dir: </li><li>ignore_warning: </li></ul></blockquote><details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/plugin/load.py#L88" target="_blank">View on GitHub</a></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_plugins</span><span class="token punctuation">(</span><span class="token operator">*</span>plugin_dir<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> ignore_warning<span class="token punctuation">:</span> <span class="token builtin">bool</span><span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">set</span><span class="token punctuation">[</span>Plugin<span class="token punctuation">]</span><span class="token punctuation">:</span>
<span class="token triple-quoted-string string">&quot;&quot;&quot;导入文件夹下多个插件
参数:
plugin_dir: 文件夹路径
ignore_warning: 是否忽略警告通常是目录不存在或目录为空
&quot;&quot;&quot;</span>
plugins <span class="token operator">=</span> <span class="token builtin">set</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token keyword">for</span> dir_path <span class="token keyword">in</span> plugin_dir<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>dir_path<span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">if</span> <span class="token keyword">not</span> ignore_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&quot;Plugins dir &#39;</span><span class="token interpolation"><span class="token punctuation">{</span>dir_path<span class="token punctuation">}</span></span><span class="token string">&#39; does not exist.&quot;</span></span><span class="token punctuation">)</span>
<span class="token keyword">continue</span>
<span class="token keyword">if</span> <span class="token keyword">not</span> os<span class="token punctuation">.</span>listdir<span class="token punctuation">(</span>dir_path<span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">if</span> <span class="token keyword">not</span> ignore_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&quot;Plugins dir &#39;</span><span class="token interpolation"><span class="token punctuation">{</span>dir_path<span class="token punctuation">}</span></span><span class="token string">&#39; is empty.&quot;</span></span><span class="token punctuation">)</span>
<span class="token keyword">continue</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>isdir<span class="token punctuation">(</span>dir_path<span class="token punctuation">)</span><span class="token punctuation">:</span>
<span class="token keyword">if</span> <span class="token keyword">not</span> ignore_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&quot;Plugins dir &#39;</span><span class="token interpolation"><span class="token punctuation">{</span>dir_path<span class="token punctuation">}</span></span><span class="token string">&#39; is not a directory.&quot;</span></span><span class="token punctuation">)</span>
<span class="token keyword">continue</span>
<span class="token keyword">for</span> f <span class="token keyword">in</span> os<span class="token punctuation">.</span>listdir<span class="token punctuation">(</span>dir_path<span class="token punctuation">)</span><span class="token punctuation">:</span>
path <span class="token operator">=</span> Path<span class="token punctuation">(</span>os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>join<span class="token punctuation">(</span>dir_path<span class="token punctuation">,</span> f<span class="token punctuation">)</span><span class="token punctuation">)</span>
module_name <span class="token operator">=</span> <span class="token boolean">None</span>
<span class="token keyword">if</span> os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>isfile<span class="token punctuation">(</span>path<span class="token punctuation">)</span> <span class="token keyword">and</span> f<span class="token punctuation">.</span>endswith<span class="token punctuation">(</span><span class="token string">&#39;.py&#39;</span><span class="token punctuation">)</span> <span class="token keyword">and</span> <span class="token punctuation">(</span>f <span class="token operator">!=</span> <span class="token string">&#39;__init__.py&#39;</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
module_name <span class="token operator">=</span> <span class="token string-interpolation"><span class="token string">f&#39;</span><span class="token interpolation"><span class="token punctuation">{</span>path_to_module_name<span class="token punctuation">(</span>Path<span class="token punctuation">(</span>dir_path<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">.</span><span class="token interpolation"><span class="token punctuation">{</span>f<span class="token punctuation">[</span><span class="token punctuation">:</span><span class="token format-spec">-3]</span><span class="token punctuation">}</span></span><span class="token string">&#39;</span></span>
<span class="token keyword">elif</span> os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>isdir<span class="token punctuation">(</span>path<span class="token punctuation">)</span> <span class="token keyword">and</span> os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>exists<span class="token punctuation">(</span>os<span class="token punctuation">.</span>path<span class="token punctuation">.</span>join<span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token string">&#39;__init__.py&#39;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
module_name <span class="token operator">=</span> path_to_module_name<span class="token punctuation">(</span>path<span class="token punctuation">)</span>
<span class="token keyword">if</span> module_name<span class="token punctuation">:</span>
load_plugin<span class="token punctuation">(</span>module_name<span class="token punctuation">)</span>
<span class="token keyword">if</span> _plugins<span class="token punctuation">.</span>get<span class="token punctuation">(</span>module_name<span class="token punctuation">)</span><span class="token punctuation">:</span>
plugins<span class="token punctuation">.</span>add<span class="token punctuation">(</span>_plugins<span class="token punctuation">[</span>module_name<span class="token punctuation">]</span><span class="token punctuation">)</span>
<span class="token keyword">return</span> plugins
</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 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-format-display-name-display-name-str-plugin-type-plugintype-str" tabindex="-1"><a class="header-anchor" href="#def-format-display-name-display-name-str-plugin-type-plugintype-str"><span><em><strong>def</strong></em> <code>format_display_name(display_name: str, plugin_type: PluginType) -&gt; str</code></span></a></h3><p><strong>Description</strong>: </p><p><strong>Arguments</strong>:</p><blockquote><ul><li>display_name: </li><li>plugin_type: </li></ul></blockquote>`,17),k=s("strong",null,"Return",-1),d=a(`<details><summary><b>Source code</b> or <a href="https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/plugin/load.py#L132" target="_blank">View on GitHub</a></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">format_display_name</span><span class="token punctuation">(</span>display_name<span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">,</span> plugin_type<span class="token punctuation">:</span> PluginType<span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">&gt;</span> <span class="token builtin">str</span><span class="token punctuation">:</span>
<span class="token triple-quoted-string string">&quot;&quot;&quot;
设置插件名称颜色根据不同类型插件设置颜色
Args:
display_name: 插件名称
plugin_type: 插件类型
Returns:
str: 设置后的插件名称 &lt;y&gt;name&lt;/y&gt;
&quot;&quot;&quot;</span>
color <span class="token operator">=</span> <span class="token string">&#39;y&#39;</span>
<span class="token keyword">match</span> plugin_type<span class="token punctuation">:</span>
<span class="token keyword">case</span> PluginType<span class="token punctuation">.</span>APPLICATION<span class="token punctuation">:</span>
color <span class="token operator">=</span> <span class="token string">&#39;m&#39;</span>
<span class="token keyword">case</span> PluginType<span class="token punctuation">.</span>TEST<span class="token punctuation">:</span>
color <span class="token operator">=</span> <span class="token string">&#39;g&#39;</span>
<span class="token keyword">case</span> PluginType<span class="token punctuation">.</span>MODULE<span class="token punctuation">:</span>
color <span class="token operator">=</span> <span class="token string">&#39;e&#39;</span>
<span class="token keyword">case</span> PluginType<span class="token punctuation">.</span>SERVICE<span class="token punctuation">:</span>
color <span class="token operator">=</span> <span class="token string">&#39;c&#39;</span>
<span class="token keyword">return</span> <span class="token string-interpolation"><span class="token string">f&#39;&lt;</span><span class="token interpolation"><span class="token punctuation">{</span>color<span class="token punctuation">}</span></span><span class="token string">&gt;</span><span class="token interpolation"><span class="token punctuation">{</span>display_name<span class="token punctuation">}</span></span><span class="token string"> [</span><span class="token interpolation"><span class="token punctuation">{</span>plugin_type<span class="token punctuation">.</span>name<span class="token punctuation">}</span></span><span class="token string">]&lt;/</span><span class="token interpolation"><span class="token punctuation">{</span>color<span class="token punctuation">}</span></span><span class="token string">&gt;&#39;</span></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 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>`,1);function m(g,_){const t=o("y");return e(),i("div",null,[r,s("p",null,[k,n(": str: "),l(t,null,{default:c(()=>[n("name")]),_:1})]),d])}const y=p(u,[["render",m],["__file","load.html.vue"]]),b=JSON.parse('{"path":"/en/dev/api/plugin/load.html","title":"liteyuki.plugin.load","lang":"en-US","frontmatter":{"title":"liteyuki.plugin.load","lastUpdated":false,"description":"liteyuki.plugin.load Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/7/23 11:59 @Author : snowykami @Email : snowykami@outlook.com @File ...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/plugin/load.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/plugin/load.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.plugin.load"}],["meta",{"property":"og:description","content":"liteyuki.plugin.load Description: Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved @Time : 2024/7/23 11:59 @Author : snowykami @Email : snowykami@outlook.com @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-29T06:19:39.000Z"}],["meta",{"property":"article:modified_time","content":"2024-08-29T06:19:39.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.plugin.load\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-29T06:19:39.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":3,"title":"def load_plugin(module_path: str | Path) -> Optional[Plugin]","slug":"def-load-plugin-module-path-str-path-optional-plugin","link":"#def-load-plugin-module-path-str-path-optional-plugin","children":[]},{"level":3,"title":"def load_plugins(*plugin_dir: str, *, ignore_warning: bool = True) -> set[Plugin]","slug":"def-load-plugins-plugin-dir-str-ignore-warning-bool-true-set-plugin","link":"#def-load-plugins-plugin-dir-str-ignore-warning-bool-true-set-plugin","children":[]},{"level":3,"title":"def format_display_name(display_name: str, plugin_type: PluginType) -> str","slug":"def-format-display-name-display-name-str-plugin-type-plugintype-str","link":"#def-format-display-name-display-name-str-plugin-type-plugintype-str","children":[]}],"git":{"createdTime":1724234361000,"updatedTime":1724912379000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":2}]},"readingTime":{"minutes":2.14,"words":641},"filePathRelative":"en/dev/api/plugin/load.md","localizedDate":"August 21, 2024","autoDesc":true}');export{y as comp,b as data};