1
0
forked from bot/app
LiteyukiBot/assets/utils.html-Bot2AHUf.js

9 lines
6.6 KiB
JavaScript

import{_ as e,o as a,c as o,e as l}from"./app-Dk7jq3Nw.js";const t={},n=l(`<h3 id="def-is-coroutine-callable-call-callable-any-bool" tabindex="-1"><a class="header-anchor" href="#def-is-coroutine-callable-call-callable-any-bool"><span><em><strong>def</strong></em> <code>is_coroutine_callable(call: Callable[..., Any]) -&gt; bool</code></span></a></h3><p>判断是否为协程可调用对象</p><p>Args:</p><pre><code>call: 可调用对象
</code></pre><p>Returns:</p><pre><code>bool: 是否为协程可调用对象
</code></pre><h3 id="def-run-coroutine-none" tabindex="-1"><a class="header-anchor" href="#def-run-coroutine-none"><span><em><strong>def</strong></em> <code>run_coroutine() -&gt; None</code></span></a></h3><p>运行协程</p><p>Args:</p><pre><code>coro:
</code></pre><p>Returns:</p><h3 id="def-path-to-module-name-path-path-str" tabindex="-1"><a class="header-anchor" href="#def-path-to-module-name-path-path-str"><span><em><strong>def</strong></em> <code>path_to_module_name(path: Path) -&gt; str</code></span></a></h3><p>转换路径为模块名</p><p>Args:</p><pre><code>path: 路径a/b/c/d -&gt; a.b.c.d
</code></pre><p>Returns:</p><pre><code>str: 模块名
</code></pre><h3 id="def-async-wrapper-func-callable-any-callable-coroutine" tabindex="-1"><a class="header-anchor" href="#def-async-wrapper-func-callable-any-callable-coroutine"><span><em><strong>def</strong></em> <code>async_wrapper(func: Callable[..., Any]) -&gt; Callable[..., Coroutine]</code></span></a></h3><p>异步包装器</p><p>Args:</p><pre><code>func: Sync Callable
</code></pre><p>Returns:</p><pre><code>Coroutine: Asynchronous Callable
</code></pre><h3 id="async-def-wrapper-none" tabindex="-1"><a class="header-anchor" href="#async-def-wrapper-none"><span><em><strong>async def</strong></em> <code>wrapper() -&gt; None</code></span></a></h3><h3 id="var-is-main-process-multiprocessing-current-process-name-mainprocess" tabindex="-1"><a class="header-anchor" href="#var-is-main-process-multiprocessing-current-process-name-mainprocess"><span><em><strong>var</strong></em> <code>IS_MAIN_PROCESS = multiprocessing.current_process().name == &#39;MainProcess&#39;</code></span></a></h3><h3 id="var-func-getattr-call-call-none" tabindex="-1"><a class="header-anchor" href="#var-func-getattr-call-call-none"><span><em><strong>var</strong></em> <code>func_ = getattr(call, &#39;__call__&#39;, None)</code></span></a></h3><h3 id="var-rel-path-path-resolve-relative-to-path-cwd-resolve" tabindex="-1"><a class="header-anchor" href="#var-rel-path-path-resolve-relative-to-path-cwd-resolve"><span><em><strong>var</strong></em> <code>rel_path = path.resolve().relative_to(Path.cwd().resolve())</code></span></a></h3><h3 id="var-loop-asyncio-get-event-loop" tabindex="-1"><a class="header-anchor" href="#var-loop-asyncio-get-event-loop"><span><em><strong>var</strong></em> <code>loop = asyncio.get_event_loop()</code></span></a></h3><h3 id="var-loop-asyncio-new-event-loop" tabindex="-1"><a class="header-anchor" href="#var-loop-asyncio-new-event-loop"><span><em><strong>var</strong></em> <code>loop = asyncio.new_event_loop()</code></span></a></h3>`,29),r=[n];function c(s,p){return a(),o("div",null,r)}const d=e(t,[["render",c],["__file","utils.html.vue"]]),h=JSON.parse(`{"path":"/en/dev/api/utils.html","title":"liteyuki.utils","lang":"en-US","frontmatter":{"title":"liteyuki.utils","order":1,"icon":"laptop-code","category":"API","description":"def is_coroutine_callable(call: Callable[..., Any]) -> bool 判断是否为协程可调用对象 Args: Returns: def run_coroutine() -> None 运行协程 Args: Returns: def path_to_module_name(path: Path) -> st...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/utils.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/utils.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.utils"}],["meta",{"property":"og:description","content":"def is_coroutine_callable(call: Callable[..., Any]) -> bool 判断是否为协程可调用对象 Args: Returns: def run_coroutine() -> None 运行协程 Args: Returns: def path_to_module_name(path: Path) -> st..."}],["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.utils\\",\\"image\\":[\\"\\"],\\"dateModified\\":null,\\"author\\":[]}"]]},"headers":[{"level":3,"title":"def is_coroutine_callable(call: Callable[..., Any]) -> bool","slug":"def-is-coroutine-callable-call-callable-any-bool","link":"#def-is-coroutine-callable-call-callable-any-bool","children":[]},{"level":3,"title":"def run_coroutine() -> None","slug":"def-run-coroutine-none","link":"#def-run-coroutine-none","children":[]},{"level":3,"title":"def path_to_module_name(path: Path) -> str","slug":"def-path-to-module-name-path-path-str","link":"#def-path-to-module-name-path-path-str","children":[]},{"level":3,"title":"def async_wrapper(func: Callable[..., Any]) -> Callable[..., Coroutine]","slug":"def-async-wrapper-func-callable-any-callable-coroutine","link":"#def-async-wrapper-func-callable-any-callable-coroutine","children":[]},{"level":3,"title":"async def wrapper() -> None","slug":"async-def-wrapper-none","link":"#async-def-wrapper-none","children":[]},{"level":3,"title":"var IS_MAIN_PROCESS = multiprocessing.current_process().name == 'MainProcess'","slug":"var-is-main-process-multiprocessing-current-process-name-mainprocess","link":"#var-is-main-process-multiprocessing-current-process-name-mainprocess","children":[]},{"level":3,"title":"var func_ = getattr(call, '__call__', None)","slug":"var-func-getattr-call-call-none","link":"#var-func-getattr-call-call-none","children":[]},{"level":3,"title":"var rel_path = path.resolve().relative_to(Path.cwd().resolve())","slug":"var-rel-path-path-resolve-relative-to-path-cwd-resolve","link":"#var-rel-path-path-resolve-relative-to-path-cwd-resolve","children":[]},{"level":3,"title":"var loop = asyncio.get_event_loop()","slug":"var-loop-asyncio-get-event-loop","link":"#var-loop-asyncio-get-event-loop","children":[]},{"level":3,"title":"var loop = asyncio.new_event_loop()","slug":"var-loop-asyncio-new-event-loop","link":"#var-loop-asyncio-new-event-loop","children":[]}],"git":{"createdTime":null,"updatedTime":null,"contributors":[]},"readingTime":{"minutes":0.43,"words":130},"filePathRelative":"en/dev/api/utils.md","autoDesc":true}`);export{d as comp,h as data};