2024-08-29 13:53:08 +08:00
|
|
|
|
import{_ as p,r as o,o as e,c as l,a,b as n,e as i,w as c,d as s}from"./app-EhCe7g9m.js";const u={},r=s(`<h3 id="func-load-plugin-optional-plugin" tabindex="-1"><a class="header-anchor" href="#func-load-plugin-optional-plugin"><span><em>func</em> <code>load_plugin() -> 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></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">></span> Optional<span class="token punctuation">[</span>Plugin<span class="token punctuation">]</span><span class="token punctuation">:</span>
|
2024-08-21 18:00:26 +08:00
|
|
|
|
<span class="token triple-quoted-string string">"""加载单个插件,可以是本地插件或是通过 \`pip\` 安装的插件。
|
|
|
|
|
|
|
|
|
|
参数:
|
|
|
|
|
module_path: 插件名称 \`path.to.your.plugin\`
|
|
|
|
|
或插件路径 \`pathlib.Path(path/to/your/plugin)\`
|
|
|
|
|
"""</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>
|
2024-08-24 01:47:27 +08:00
|
|
|
|
_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">'__plugin_metadata__'</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">'PluginMetadata'</span> <span class="token operator">=</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">[</span><span class="token string">'__plugin_metadata__'</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">'.'</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">'__liteyuki_plugin_meta__'</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">'PluginMetadata'</span> <span class="token operator">=</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">[</span><span class="token string">'__liteyuki_plugin_meta__'</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"</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">'.'</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">)"</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">'__plugin_meta__'</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
|
2024-08-21 18:00:26 +08:00
|
|
|
|
metadata<span class="token punctuation">:</span> <span class="token string">'PluginMetadata'</span> <span class="token operator">=</span> module<span class="token punctuation">.</span>__dict__<span class="token punctuation">[</span><span class="token string">'__plugin_meta__'</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"</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">'.'</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">)"</span></span><span class="token punctuation">,</span> metadata<span class="token punctuation">.</span><span class="token builtin">type</span><span class="token punctuation">)</span>
|
2024-08-24 01:47:27 +08:00
|
|
|
|
<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'The metadata of Liteyuki plugin "</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">" is not specified, use empty.'</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">'.'</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
|
2024-08-21 18:00:26 +08:00
|
|
|
|
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'Succeeded to load liteyuki plugin "</span><span class="token interpolation"><span class="token punctuation">{</span>display_name<span class="token punctuation">}</span></span><span class="token string">"'</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'Failed to load liteyuki plugin "<r></span><span class="token interpolation"><span class="token punctuation">{</span>module_path<span class="token punctuation">}</span></span><span class="token string"></r>"'</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>
|
2024-08-29 13:53:08 +08:00
|
|
|
|
</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="func-load-plugins-ignore-warning-bool-true-set-plugin" tabindex="-1"><a class="header-anchor" href="#func-load-plugins-ignore-warning-bool-true-set-plugin"><span><em>func</em> <code>load_plugins(*, ignore_warning: bool = True) -> 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></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">></span> <span class="token builtin">set</span><span class="token punctuation">[</span>Plugin<span class="token punctuation">]</span><span class="token punctuation">:</span>
|
2024-08-21 18:00:26 +08:00
|
|
|
|
<span class="token triple-quoted-string string">"""导入文件夹下多个插件
|
|
|
|
|
|
|
|
|
|
参数:
|
|
|
|
|
plugin_dir: 文件夹路径
|
|
|
|
|
ignore_warning: 是否忽略警告,通常是目录不存在或目录为空
|
|
|
|
|
"""</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"Plugins dir '</span><span class="token interpolation"><span class="token punctuation">{</span>dir_path<span class="token punctuation">}</span></span><span class="token string">' does not exist."</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"Plugins dir '</span><span class="token interpolation"><span class="token punctuation">{</span>dir_path<span class="token punctuation">}</span></span><span class="token string">' is empty."</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"Plugins dir '</span><span class="token interpolation"><span class="token punctuation">{</span>dir_path<span class="token punctuation">}</span></span><span class="token string">' is not a directory."</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">'.py'</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">'__init__.py'</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'</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">'</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">'__init__.py'</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
|
2024-08-29 13:53:08 +08:00
|
|
|
|
</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="func-format-display-name-str" tabindex="-1"><a class="header-anchor" href="#func-format-display-name-str"><span><em>func</em> <code>format_display_name() -> str</code></span></a></h3><p><strong>Description</strong>: 设置插件名称颜色,根据不同类型插件设置颜色</p>`,12),d=a("strong",null,"Return",-1),k=s(`<p><strong>Arguments</strong>:</p><blockquote><ul><li>display_name: 插件名称</li><li>plugin_type: 插件类型</li></ul></blockquote><details><summary><b>Source code</b></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">></span> <span class="token builtin">str</span><span class="token punctuation">:</span>
|
2024-08-21 18:00:26 +08:00
|
|
|
|
<span class="token triple-quoted-string string">"""
|
|
|
|
|
设置插件名称颜色,根据不同类型插件设置颜色
|
|
|
|
|
Args:
|
|
|
|
|
display_name: 插件名称
|
|
|
|
|
plugin_type: 插件类型
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
str: 设置后的插件名称 <y>name</y>
|
|
|
|
|
"""</span>
|
|
|
|
|
color <span class="token operator">=</span> <span class="token string">'y'</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">'m'</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">'g'</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">'e'</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">'c'</span>
|
|
|
|
|
<span class="token keyword">return</span> <span class="token string-interpolation"><span class="token string">f'<</span><span class="token interpolation"><span class="token punctuation">{</span>color<span class="token punctuation">}</span></span><span class="token string">></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">]</</span><span class="token interpolation"><span class="token punctuation">{</span>color<span class="token punctuation">}</span></span><span class="token string">>'</span></span>
|
2024-08-29 13:53:08 +08:00
|
|
|
|
</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><h3 id="var-plugins" tabindex="-1"><a class="header-anchor" href="#var-plugins"><span><em><strong>var</strong></em> <code>_plugins = {}</code></span></a></h3><ul><li><strong>Type</strong>: <code>dict[str, Plugin]</code></li></ul><h3 id="var-metadata-module-dict-plugin-metadata" tabindex="-1"><a class="header-anchor" href="#var-metadata-module-dict-plugin-metadata"><span><em><strong>var</strong></em> <code>metadata = module.__dict__['__plugin_metadata__']</code></span></a></h3><ul><li><strong>Type</strong>: <code>'PluginMetadata'</code></li></ul><h3 id="var-metadata-module-dict-liteyuki-plugin-meta" tabindex="-1"><a class="header-anchor" href="#var-metadata-module-dict-liteyuki-plugin-meta"><span><em><strong>var</strong></em> <code>metadata = module.__dict__['__liteyuki_plugin_meta__']</code></span></a></h3><ul><li><strong>Type</strong>: <code>'PluginMetadata'</code></li></ul><h3 id="var-metadata-module-dict-plugin-meta" tabindex="-1"><a class="header-anchor" href="#var-metadata-module-dict-plugin-meta"><span><em><strong>var</strong></em> <code>metadata = module.__dict__['__plugin_meta__']</code></span></a></h3><ul><li><strong>Type</strong>: <code>'PluginMetadata'</code></li></ul>`,11);function m(g,_){const t=o("y");return e(),l("div",null,[r,a("p",null,[d,n(": str: 设置后的插件名称 "),i(t,null,{default:c(()=>[n("name")]),_:1})]),k])}const b=p(u,[["render",m],["__file","load.html.vue"]]),y=JSON.parse(`{"path":"/en/api/plugin/load.html","title":"liteyuki.plugin.load","lang":"en-US","frontmatter":{"title":"liteyuki.plugin.load","description":"func load_plugin() -> Optional[Plugin] Description: 加载单个插件,可以是本地插件或是通过 pip 安装的插件。 Arguments: module_path: 插件名称 path.to.your.plugin 或插件路径 pathlib.Path(path/to/your/plugin): Sourc...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/api/plugin/load.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/api/plugin/load.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.plugin.load"}],["meta",{"property":"og:description","content":"func load_plugin() -> Optional[Plugin] Description: 加载单个插件,可以是本地插件或是通过 pip 安装的插件。 Arguments: module_path: 插件名称 path.to.your.plugin 或插件路径 pathlib.Path(path/to/your/plugin): Sourc..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.plugin.load\\",\\"image\\":[\\"\\"],\\"dateModified\\":null,\\"author\\":[]}"]]},"headers":[{"level":3,"title":"func load_plugin() -> Optional[Plugin]","slug":"func-load-plugin-optional-plugin","link":"#func-load-plugin-optional-plugin","children":[]},{"level":3,"title":"func load_plugins(*, ignore_warning: bool = True) -> set[Plugin]","slug":"func-load-plugins-ignore-warning-bool-true-set-plugin","link":"#func-load-plugins-ignore-warning-bool-true-set-plugin","children":[]},{"level":3,"title":"func format_di
|