2024-08-31 19:08:18 +08:00
<!DOCTYPE html>
< html lang = "en-US" dir = "ltr" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width,initial-scale=1" >
< title > liteyuki.utils | LiteyukiBot< / title >
< meta name = "description" content = "A high-performance, easy-to-use chatbot framework and application" >
2024-11-09 23:53:05 +08:00
< meta name = "generator" content = "VitePress v1.5.0" >
2024-11-21 19:54:36 +08:00
< link rel = "preload stylesheet" href = "/assets/style.BfN3dudV.css" as = "style" >
2024-11-09 23:53:05 +08:00
< link rel = "preload stylesheet" href = "/vp-icons.css" as = "style" >
2024-08-31 19:08:18 +08:00
2024-11-21 19:54:36 +08:00
< script type = "module" src = "/assets/app.BPrFwhCc.js" > < / script >
2024-08-31 19:08:18 +08:00
< link rel = "preload" href = "/assets/inter-roman-latin.Di8DUHzh.woff2" as = "font" type = "font/woff2" crossorigin = "" >
2024-11-21 19:54:36 +08:00
< link rel = "modulepreload" href = "/assets/chunks/theme.BxnBdNII.js" >
< link rel = "modulepreload" href = "/assets/chunks/framework.Z6UMW4JZ.js" >
< link rel = "modulepreload" href = "/assets/en_dev_api_utils.md.CH7CaLlN.lean.js" >
2024-08-31 19:08:18 +08:00
< link rel = "icon" type = "image/x-icon" href = "favicon.ico" >
< link rel = "stylesheet" href = "https://fonts.font.im/css?family=Cousine:400,400i,700,700i|Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" >
< script id = "check-dark-mode" > ( ( ) => { const e = localStorage . getItem ( "vitepress-theme-appearance" ) || "auto" , a = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ; ( ! e || e === "auto" ? a : e === "dark" ) && document . documentElement . classList . add ( "dark" ) } ) ( ) ; < / script >
< script id = "check-mac-os" > document . documentElement . classList . toggle ( "mac" , /Mac|iPhone|iPod|iPad/i . test ( navigator . platform ) ) ; < / script >
< / head >
< body >
2024-11-21 19:54:36 +08:00
< div id = "app" > < div class = "Layout" data-v-2391887b data-v-23f2dbb5 > <!-- [ --> <!-- ] --> <!-- [ --> < span tabindex = "-1" data-v-98f7e91e > < / span > < a href = "#VPContent" class = "VPSkipLink visually-hidden" data-v-98f7e91e > Skip to content < / a > <!-- ] --> <!-- --> < header class = "VPNav" data-v-23f2dbb5 data-v-429592cd > < div class = "VPNavBar" data-v-429592cd data-v-10635b05 > < div class = "wrapper" data-v-10635b05 > < div class = "container" data-v-10635b05 > < div class = "title" data-v-10635b05 > < div class = "VPNavBarTitle has-sidebar" data-v-10635b05 data-v-c02215d3 > < a class = "title" href = "/en/" data-v-c02215d3 > <!-- [ --> <!-- ] --> <!-- [ --> <!-- [ --> <!-- [ --> < img class = "VPImage dark logo" src = "/liteyuki-dark.svg" alt = "LiteyukiBot Logo" data-v-2d9b5d5a > <!-- ] --> <!-- [ --> < img class = "VPImage light logo" src = "/liteyuki.svg" alt = "LiteyukiBot Logo" data-v-2d9b5d5a > <!-- ] --> <!-- ] --> <!-- ] --> < span data-v-c02215d3 > LiteyukiBot< / span > <!-- [ --> <!-- ] --> < / a > < / div > < / div > < div class = "content" data-v-10635b05 > < div class = "content-body" data-v-10635b05 > <!-- [ --> <!-- ] --> < div class = "VPNavBarSearch search" data-v-10635b05 > <!-- [ --> <!-- --> < div id = "local-search" > < button type = "button" class = "DocSearch DocSearch-Button" aria-label = "Search" > < span class = "DocSearch-Button-Container" > < span class = "vp-icon DocSearch-Search-Icon" > < / span > < span class = "DocSearch-Button-Placeholder" > Search< / span > < / span > < span class = "DocSearch-Button-Keys" > < kbd class = "DocSearch-Button-Key" > < / kbd > < kbd class = "DocSearch-Button-Key" > K< / kbd > < / span > < / button > < / div > <!-- ] --> < / div > < nav aria-labelledby = "main-nav-aria-label" class = "VPNavBarMenu menu" data-v-10635b05 data-v-c770cea4 > < span id = "main-nav-aria-label" class = "visually-hidden" data-v-c770cea4 > Main Navigation < / span > <!-- [ --> <!-- [ --> < a class = "VPLink link VPNavBarMenuLink" href = "/en/deploy/install.html" tabindex = "0" data-v-c770cea4 data-v-585d7f08 > <!-- [ --> < span data-v-585d7f08 > Deploy< / span > <!-- ] --> < / a > <!-- ] --> <!-- [ --> < a class = "VPLink link VPNavBarMenuLink" href = "/en/usage/basic.html" tabindex = "0" data-v-c770cea4 data-v-585d7f08 > <!-- [ --> < span data-v-585d7f08 > Usage< / span > <!-- ] --> < / a > <!-- ] --> <!-- [ --> < a class = "VPLink link VPNavBarMenuLink" href = "/en/store/resource.html" tabindex = "0" data-v-c770cea4 data-v-585d7f08 > <!-- [ --> < span data-v-585d7f08 > Extension< / span > <!-- ] --> < / a > <!-- ] --> <!-- [ --> < a class = "VPLink link VPNavBarMenuLink" href = "/en/dev/guide.html" tabindex = "0" data-v-c770cea4 data-v-585d7f08 > <!-- [ --> < span data-v-585d7f08 > Develop< / span > <!-- ] --> < / a > <!-- ] --> <!-- ] --> < / nav > < div class = "VPFlyout VPNavBarTranslations translations" data-v-10635b05 data-v-ea07652c data-v-00df721d > < button type = "button" class = "button" aria-haspopup = "true" aria-expanded = "false" aria-label = "Language" data-v-00df721d > < span class = "text" data-v-00df721d > < span class = "vpi-languages option-icon" data-v-00df721d > < / span > <!-- --> < span class = "vpi-chevron-down text-icon" data-v-00df721d > < / span > < / span > < / button > < div class = "menu" data-v-00df721d > < div class = "VPMenu" data-v-00df721d data-v-464b5fd9 > <!-- --> <!-- [ --> <!-- [ --> < div class = "items" data-v-ea07652c > < p class = "title" data-v-ea07652c > English< / p > <!-- [ --> < div class = "VPMenuLink" data-v-ea07652c data-v-a5f22fa3 > < a class = "VPLink link" href = "/dev/api/utils.html" data-v-a5f22fa3 > <!-- [ --> < span data-v-a5f22fa3 > 简体中文< / span > <!-- ] --> < / a > < / div > <!-- ] --> < / div > <!-- ] --> <!-- ] --> < / div > < / div > < / div > < div class = "VPNavBarAppearance appearance" data-v-10635b05 data-v-728194a1 > < button class = "VPSwitch VPSwitchAppearance" type = "button" role = "switch" title aria-checked = "false" data-v-728194a1 data-v-e93e4f13 data-v-bbaa0fff > < span class = "check" data-v-bbaa0fff > < span class = "icon" data-v-bbaa0fff > <!-- [ --> < span class = "vpi-sun sun" data-v-e93e4f13 > < / span > < span class = "vpi-moon moon" data-v-e93e4f13 > < / span > <!-- ] --> < / span > < / span > < / button > < / div > < div class = "VPSocialLinks VPNavBarSocialLinks social-links" data-v-10635b05 data-v-a6a40077 data-v-2b2d05f2 > <!-- [ --> < a class = "VPSocialLink no-icon" href = "https://github.com/LiteyukiStudio/LiteyukiBot" aria-label = "github" target = "_blank" rel = "noopener" data-v-2b2d05f2 data-v-d27afe3a > < span class = "vpi-social-github" > < / span > < / a > < a class = "VPSocialLink no-icon" href = "http
2024-08-31 19:08:18 +08:00
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > if< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > inspect.isroutine(call):< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > return< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > inspect.iscoroutinefunction(call)< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > if< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > inspect.isclass(call):< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > return< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > False< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > func_ < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > getattr< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > (call, < / span > < span style = "--shiki-light:#032F62;--shiki-dark:#9ECBFF;" > ' __call__' < / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > , < / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > None< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > )< / span > < / span >
2024-09-07 04:43:24 +08:00
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > return< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > inspect.iscoroutinefunction(func_)< / span > < / span > < / code > < / pre > < / div > < / details > < hr > < h3 id = "func-run-coroutine-coro-coroutine" tabindex = "-1" > < em > < strong > func< / strong > < / em > < code > run_coroutine(*coro: Coroutine)< / code > < a class = "header-anchor" href = "#func-run-coroutine-coro-coroutine" aria-label = "Permalink to "***func*** `run_coroutine(*coro: Coroutine)`"" > < / a > < / h3 > < p > < strong > Description< / strong > : 运行协程< / p > < p > < strong > Arguments< / strong > :< / p > < blockquote > < ul > < li > coro:< / li > < / ul > < / blockquote > < details > < summary > < b > Source code< / b > or < a href = "https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/utils.py#L33" target = "_blank" > View on GitHub< / a > < / summary > < div class = "language-python vp-adaptive-theme" > < button title = "Copy Code" class = "copy" > < / button > < span class = "lang" > python< / span > < pre class = "shiki shiki-themes github-light github-dark vp-code" tabindex = "0" > < code > < span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > def< / span > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > run_coroutine< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > (< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > *< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > coro: Coroutine):< / span > < / span >
2024-08-31 19:08:18 +08:00
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > try< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > :< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > loop < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > asyncio.get_running_loop()< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > if< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > loop.is_running():< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > for< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > c < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > in< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > coro:< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > asyncio.ensure_future(c)< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > else< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > :< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > for< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > c < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > in< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > coro:< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > loop.run_until_complete(c)< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > except< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > RuntimeError< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > :< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > loop < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > asyncio.new_event_loop()< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > asyncio.set_event_loop(loop)< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > loop.run_until_complete(asyncio.gather(< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > *< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > coro))< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > loop.close()< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > except< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > Exception< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > as< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > e:< / span > < / span >
2024-09-07 04:43:24 +08:00
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > logger.error(< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > f< / span > < span style = "--shiki-light:#032F62;--shiki-dark:#9ECBFF;" > ' Exception occurred: < / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > {< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > e< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > }< / span > < span style = "--shiki-light:#032F62;--shiki-dark:#9ECBFF;" > ' < / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > )< / span > < / span > < / code > < / pre > < / div > < / details > < hr > < h3 id = "func-run-coroutine-in-thread-coro-coroutine" tabindex = "-1" > < em > < strong > func< / strong > < / em > < code > run_coroutine_in_thread(*coro: Coroutine)< / code > < a class = "header-anchor" href = "#func-run-coroutine-in-thread-coro-coroutine" aria-label = "Permalink to "***func*** `run_coroutine_in_thread(*coro: Coroutine)`"" > < / a > < / h3 > < p > < strong > Description< / strong > : 在新线程中运行协程< / p > < p > < strong > Arguments< / strong > :< / p > < blockquote > < ul > < li > coro:< / li > < / ul > < / blockquote > < details > < summary > < b > Source code< / b > or < a href = "https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/utils.py#L66" target = "_blank" > View on GitHub< / a > < / summary > < div class = "language-python vp-adaptive-theme" > < button title = "Copy Code" class = "copy" > < / button > < span class = "lang" > python< / span > < pre class = "shiki shiki-themes github-light github-dark vp-code" tabindex = "0" > < code > < span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > def< / span > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > run_coroutine_in_thread< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > (< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > *< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > coro: Coroutine):< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > threading.Thread(< / span > < span style = "--shiki-light:#E36209;--shiki-dark:#FFAB70;" > target< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > run_coroutine, < / span > < span style = "--shiki-light:#E36209;--shiki-dark:#FFAB70;" > args< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > coro, < / span > < span style = "--shiki-light:#E36209;--shiki-dark:#FFAB70;" > daemon< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > True< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > ).start()< / span > < / span > < / code > < / pre > < / div > < / details > < hr > < h3 id = "func-path-to-module-name-path-path-str" tabindex = "-1" > < em > < strong > func< / strong > < / em > < code > path_to_module_name(path: Path) -> str< / code > < a class = "header-anchor" href = "#func-path-to-module-name-path-path-str" aria-label = "Permalink to "***func*** `path_to_module_name(path: Path) -> str`"" > < / a > < / h3 > < p > < strong > Description< / strong > : 转换路径为模块名< / p > < p > < strong > Arguments< / strong > :< / p > < blockquote > < ul > < li > path: 路径a/b/c/d -> a.b.c.d< / li > < / ul > < / blockquote > < p > < strong > Return< / strong > : str: 模块名< / p > < details > < summary > < b > Source code< / b > or < a href = "https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/utils.py#L78" target = "_blank" > View on GitHub< / a > < / summary > < div class = "language-python vp-adaptive-theme" > < button title = "Copy Code" class = "copy" > < / button > < span class = "lang" > python< / span > < pre class = "shiki shiki-themes github-light github-dark vp-code" tabindex = "0" > < code > < span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > def< / span > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > path_to_module_name< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > (path: Path) -> < / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > str< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > :< / span > < / span >
2024-08-31 19:08:18 +08:00
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > rel_path < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > path.resolve().relative_to(Path.cwd().resolve())< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > if< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > rel_path.stem < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > ==< / span > < span style = "--shiki-light:#032F62;--shiki-dark:#9ECBFF;" > ' __init__' < / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > :< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > return< / span > < span style = "--shiki-light:#032F62;--shiki-dark:#9ECBFF;" > ' .' < / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > .join(rel_path.parts[:< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > -< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > 1< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > ])< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > else< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > :< / span > < / span >
2024-09-07 04:43:24 +08:00
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > return< / span > < span style = "--shiki-light:#032F62;--shiki-dark:#9ECBFF;" > ' .' < / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > .join(rel_path.parts[:< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > -< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > 1< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > ] < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > +< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > (rel_path.stem,))< / span > < / span > < / code > < / pre > < / div > < / details > < hr > < h3 id = "func-async-wrapper-func-callable-any-callable-coroutine" tabindex = "-1" > < em > < strong > func< / strong > < / em > < code > async_wrapper(func: Callable[..., Any]) -> Callable[..., Coroutine]< / code > < a class = "header-anchor" href = "#func-async-wrapper-func-callable-any-callable-coroutine" aria-label = "Permalink to "***func*** `async_wrapper(func: Callable[..., Any]) -> Callable[..., Coroutine]`"" > < / a > < / h3 > < p > < strong > Description< / strong > : 异步包装器< / p > < p > < strong > Arguments< / strong > :< / p > < blockquote > < ul > < li > func: Sync Callable< / li > < / ul > < / blockquote > < p > < strong > Return< / strong > : Coroutine: Asynchronous Callable< / p > < details > < summary > < b > Source code< / b > or < a href = "https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/utils.py#L93" target = "_blank" > View on GitHub< / a > < / summary > < div class = "language-python vp-adaptive-theme" > < button title = "Copy Code" class = "copy" > < / button > < span class = "lang" > python< / span > < pre class = "shiki shiki-themes github-light github-dark vp-code" tabindex = "0" > < code > < span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > def< / span > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > async_wrapper< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > (func: Callable[< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > ...< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > , Any]) -> Callable[< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > ...< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > , Coroutine]:< / span > < / span >
2024-08-31 19:08:18 +08:00
< span class = "line" > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > async< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > def< / span > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > wrapper< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > (< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > *< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > args, < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > **< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > kwargs):< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > return< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > func(< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > *< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > args, < / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > **< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > kwargs)< / span > < / span >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > wrapper.< / span > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > __signature__< / span > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > =< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > inspect.signature(func)< / span > < / span >
2024-11-21 19:54:36 +08:00
< span class = "line" > < span style = "--shiki-light:#D73A49;--shiki-dark:#F97583;" > return< / span > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > wrapper< / span > < / span > < / code > < / pre > < / div > < / details > < / div > < / div > < / main > < footer class = "VPDocFooter" data-v-d6b08857 data-v-91eea559 > <!-- [ --> <!-- ] --> < div class = "edit-info" data-v-91eea559 > < div class = "edit-link" data-v-91eea559 > < a class = "VPLink link vp-external-link-icon no-icon edit-link-button" href = "https://github.com/LiteyukiStudio/LiteyukiBot/tree/main/liteyuki/utils.py" target = "_blank" rel = "noreferrer" data-v-91eea559 > <!-- [ --> < span class = "vpi-square-pen edit-link-icon" data-v-91eea559 > < / span > Edit this page on GitHub<!-- ] --> < / a > < / div > < div class = "last-updated" data-v-91eea559 > < p class = "VPLastUpdated" data-v-91eea559 data-v-67b027c0 > Last updated: < time datetime = "2024-08-31T10:57:48.000Z" data-v-67b027c0 > < / time > < / p > < / div > < / div > < nav class = "prev-next" aria-labelledby = "doc-footer-aria-label" data-v-91eea559 > < span class = "visually-hidden" id = "doc-footer-aria-label" data-v-91eea559 > Pager< / span > < div class = "pager" data-v-91eea559 > < a class = "VPLink link pager-link prev" href = "/en/dev/api/session/rule.html" data-v-91eea559 > <!-- [ --> < span class = "desc" data-v-91eea559 > Prev Page< / span > < span class = "title" data-v-91eea559 > liteyuki.session.rule< / span > <!-- ] --> < / a > < / div > < div class = "pager" data-v-91eea559 > < a class = "VPLink link pager-link next" href = "/en/dev/api/" data-v-91eea559 > <!-- [ --> < span class = "desc" data-v-91eea559 > Next Page< / span > < span class = "title" data-v-91eea559 > liteyuki API< / span > <!-- ] --> < / a > < / div > < / nav > < / footer > <!-- [ --> <!-- ] --> < / div > < / div > < / div > <!-- [ --> <!-- ] --> < / div > < / div > < footer class = "VPFooter has-sidebar" data-v-23f2dbb5 data-v-a2f9475f > < div class = "container" data-v-a2f9475f > < p class = "message" data-v-a2f9475f > Documentation built with < a href = "https://vitepress.dev/" > VitePress< / a > | API references generated by < a href = "https://github.com/LiteyukiStudio/litedoc" > litedoc< / a > < / p > < p class = "copyright" data-v-a2f9475f > Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved< / p > < / div > < / footer > <!-- [ --> <!-- ] --> < / div > < / div >
< script > w i n d o w . _ _ V P _ H A S H _ M A P _ _ = J S O N . p a r s e ( " { \ " d e p l o y _ c o n f i g . m d \ " : \ " D X D U h 0 I Q \ " , \ " d e p l o y _ f a n d q . m d \ " : \ " W J V B p M I c \ " , \ " d e p l o y _ i n s t a l l . m d \ " : \ " x Q 7 _ c Y m n \ " , \ " d e v _ a p i _ b o t _ i n d e x . m d \ " : \ " B B S Y a 4 1 2 \ " , \ " d e v _ a p i _ b o t _ l i f e s p a n . m d \ " : \ " D I i U o N Q r \ " , \ " d e v _ a p i _ c o m m _ c h a n n e l . m d \ " : \ " D f v N c b - v \ " , \ " d e v _ a p i _ c o m m _ e v e n t . m d \ " : \ " D 2 2 Z P M R O \ " , \ " d e v _ a p i _ c o m m _ i n d e x . m d \ " : \ " 4 x Q q k P a L \ " , \ " d e v _ a p i _ c o m m _ s t o r a g e . m d \ " : \ " B Q i 3 v T - 6 \ " , \ " d e v _ a p i _ c o n f i g . m d \ " : \ " D a k K 5 w g v \ " , \ " d e v _ a p i _ c o r e _ i n d e x . m d \ " : \ " D D I 0 L X Z Q \ " , \ " d e v _ a p i _ c o r e _ m a n a g e r . m d \ " : \ " m h c X W v C p \ " , \ " d e v _ a p i _ d e v _ i n d e x . m d \ " : \ " C s u g C B S r \ " , \ " d e v _ a p i _ d e v _ o b s e r v e r . m d \ " : \ " C y n j h k U R \ " , \ " d e v _ a p i _ d e v _ p l u g i n . m d \ " : \ " D D M 2 M c Y a \ " , \ " d e v _ a p i _ e x c e p t i o n . m d \ " : \ " D O g H x E 0 z \ " , \ " d e v _ a p i _ i n d e x . m d \ " : \ " D 5 2 Y - H J X \ " , \ " d e v _ a p i _ l o g . m d \ " : \ " B y b O h f 5 0 \ " , \ " d e v _ a p i _ p l u g i n _ i n d e x . m d \ " : \ " D Z x V 6 T b _ \ " , \ " d e v _ a p i _ p l u g i n _ l o a d . m d \ " : \ " C o a g W w m x \ " , \ " d e v _ a p i _ p l u g i n _ m a n a g e r . m d \ " : \ " C n P 6 5 T n i \ " , \ " d e v _ a p i _ p l u g i n _ m o d e l . m d \ " : \ " B c o M N c w b \ " , \ " d e v _ a p i _ p l u g i n s _ i n d e x . m d \ " : \ " Z 4 R s d m 0 3 \ " , \ " d e v _ a p i _ p l u g i n s _ l i t e e c h o . m d \ " : \ " N _ e R U A P O \ " , \ " d e v _ a p i _ p l u g i n s _ p l u g i n _ l o a d e r _ i n d e x . m d \ " : \ " D W s F M H h o \ " , \ " d e v _ a p i _ s e s s i o n _ e v e n t . m d \ " : \ " B V x h 2 Z P O \ " , \ " d e v _ a p i _ s e s s i o n _ i n d e x . m d \ " : \ " 6 y Q B W g J r \ " , \ " d e v _ a p i _ s e s s i o n _ m a t c h e r . m d \ " : \ " D g o Y w e U Q \ " , \ " d e v _ a p i _ s e s s i o n _ m e s s a g e _ s e g m e n t s . m d \ " : \ " D i v W - W d 9 \ " , \ " d e v _ a p i _ s e s s i o n _ m o d e l s . m d \ " : \ " B g k 7 - M S v \ " , \ " d e v _ a p i _ s e s s i o n _ o n . m d \ " : \ " m d i 0 h 2 y r \ " , \ " d e v _ a p i _ s e s s i o n _ r u l e . m d \ " : \ " C D n Q t W E _ \ " , \ " d e v _ a p i _ u t i l s . m d \ " : \ " e M k V 5 a F U \ " , \ " d e v _ b e s t _ p r a c t i c e s . m d \ " : \ " c Q g c k a l O \ " , \ " d e v _ c o m m . m d \ " : \ " C d H I X 3 q u \ " , \ " d e v _ g u i d e . m d \ " : \ " B Z 0 j b P s h \ " , \ " d e v _ l y f u n c . m d \ " : \ " B F n T p i J 5 \ " , \ " d e v _ p l u g i n . m d \ " : \ " f h 6 M o H 8 y \ " , \ " d e v _ r e s o u r c e . m d \ " : \ " D M v Q f a D n \ " , \ " e n _ d e p l o y _ c o n f i g . m d \ " : \ " C 9 a W R G - M \ " , \ " e n _ d e p l o y _ f a n d q . m d \ " : \ " C y 9 C 9 q w 5 \ " , \ " e n _ d e p l o y _ i n s t a l l . m d \ " : \ " 7 t d r s 7 _ X \ " , \ " e n _ d e v _ a p i _ b o t _ i n d e x . m d \ " : \ " D - d Q t y Q d \ " , \ " e n _ d e v _ a p i _ b o t _ l i f e s p a n . m d \ " : \ " B h X M I e K 8 \ " , \ " e n _ d e v _ a p i _ c o m m _ c h a n n e l . m d \ " : \ " 9 o 4 T s T D 5 \ " , \ " e n _ d e v _ a p i _ c o m m _ e v e n t . m d \ " : \ " B 6 E w c g s c \ " , \ " e n _ d e v _ a p i _ c o m m _ i n d e x . m d \ " : \ " D 5 A P e n B y \ " , \ " e n _ d e v _ a p i _ c o m m _ s t o r a g e . m d \ " : \ " i L O c z A p S \ " , \ " e n _ d e v _ a p i _ c o n f i g . m d \ " : \ " C z t C B M a c \ " , \ " e n _ d e v _ a p i _ c o r e _ i n d e x . m d \ " : \ " B 0 E n r i o w \ " , \ " e n _ d e v _ a p i _ c o r e _ m a n a g e r . m d \ " : \ " B x S j a c F 3 \ " , \ " e n _ d e v _ a p i _ d e v _ i n d e x . m d \ " : \ " C 5 E Y x 4 Z - \ " , \ " e n _ d e v _ a p i _ d e v _ o b s e r v e r . m d \ " : \ " B Q e g 5 d Y N \ " , \ " e n _ d e v _ a p i _ d e v _ p l u g i n . m d \ " : \ " B d e V O R H v \ " , \ " e n _ d e v _ a p i _ e x c e p t i o n . m d \ " : \ " 1 T 6 A T W i f \ " , \ " e n _ d e v _ a p i _ i n d e x . m d \ " : \ " D X W 2 v E c 5 \ " , \ " e n _ d e v _ a p i _ l o g . m d \ " : \ " D I 2 P E A H Z \ " , \ " e n _ d e v _ a p i _ p l u g i n _ i n d e x . m d \ " : \ " D m y y E 7 _ n \ " , \ " e n _ d e v _ a p i _ p l u g i n _ l o a d . m d \ " : \ " C z s 4 u I S w \ " , \ " e n _ d e v _ a p i _ p l u g i n _ m a n a g e r . m d \ " : \ " C O X J r H d K \ " , \ " e n _ d e v _ a p i _ p l u g i n _ m o d e l . m d \ " : \ " B 6 L p R 1 I Q \ " , \ " e n _ d e v _ a p i _ p l u g i n s _ i n d e x . m d \ " : \ " l m o z Q L W q \ " , \ " e n _ d e v _ a p i _ p l u g i n s _ l i t e e c h o . m d \ " : \ " y C 9 z A c 3 N \ " , \ " e n _ d e v _ a p i _ p l u g i n s _ p l u g i n _ l o a d e r _ i n d e x . m d \ " : \ " e X b 8 X U Q w \ " , \ " e n _ d e v _ a p i _ s e s s i o n _ e v e n t . m d \ " : \ " B L - c 2 p A Q \ " , \ " e n _ d e v _ a p i _ s e s s i o n _ i n d e x . m d \ " : \ " D y 7 U w v C r \ " , \ " e n _ d e v _ a p i _ s e s s i o n _ m a t c h e r . m d \ " : \ " C R L H K g v R \ " , \ " e n _ d e v _ a p i _ s e s s i o n _ m e s s a g e _ s e g m e n t s . m d \ " : \ " 2 Y - K b 9 r Z \ " , \ " e n _ d e v _ a p i _ s e s s i o n _ m o d e l s . m d \ " : \ " h B D e - 9 E h \ " , \ " e n _ d e v _ a p i _ s e s s i o n _ o n . m d \ " : \ " C E r I _ u k T \ " , \ " e n _ d e v _ a p i _ s e s s i o n _ r u l e . m d \ " : \ " B a - M h C 1 J \ " , \ " e n _ d e v _ a p i _ u t i l s . m d \ " : \ " C H 7 C a L l N \ " , \ " e n _ d e v _ b e s t _ p r a c t i c e s . m d \ " : \ " W p E K W B u 2 \ " , \ " e n _ d e v _ c o m m . m d \ " : \ " O 0 K n d n d k \ " , \ " e n _ d e v _ g u i d e . m d \ " : \ " s O T F D F Z Y \ " , \ " e n _ d e v _ l y f u n c . m d \ " : \ " B Y 5 u Y u E V \ " , \ " e n _ d e v _ p l u g i n . m d \ " : \ " B R Q N 7 4 v y \ " , \ " e n _ d e v _ r e s o u r c e . m d \ " : \ " B i Y l U c x Z \ " , \ " e n _ i n d e x . m d \ " : \ " D f d h M t W K \ " , \ " e n _ s t o r e _ p l u g i n . m d \ " : \ " C v M n 7 n S M \ " , \ " e n _ s t o r e _ r e s o u r c e . m d \ " : \ " D 4 7 f j j F S \ " , \ " e n _ u s a g e _ a g r e e m e n t . m d \ " : \ " D k W D 4 h t 6 \ " , \ " e n _ u s a g e _ b a s i c . m d \ " : \ " C A N H E y e b \ " , \ " e n _ u s a g e _ e x t r a . m d \ " : \ " B F S m u k T P \ " , \ " i n d e x . m d \ " : \ " C k y b I I 2 w \ " , \ " s t o r e _ p l u g i n . m d \ " : \ " D _ d m 7 k n u \ " , \ " s t o r e _ r e s o u r c e . m d \ " : \ " B S h x 3 9 x 7 \ " , \ " u s a g e _ a g r e e m e n t . m d \ " : \ " B P 3 _ f X y C \ " , \ " u s a g e _ b a s i c . m d \ " : \ " B o d u i j 8 1 \ " , \ " u s a g e _ e x t r a . m d \ " : \ " B 8 D 1 7 a z U \ " } " ) ; f u n c t i o n d e s e r i a l i z e F u n c t i o n s ( r ) { r e t u r n A r r a y . i s A r r a y ( r ) ? r . m a p ( d e s e r i a l i z e F u n c t i o n s ) : t y p e o f r = = " o b j e c t " & & r ! = = n u l l ? O b j e c t . k e y s ( r ) . r e d u c e ( ( t , n ) = > ( t [ n ] = d e s e r i a l i z e F u n c t i o n s ( r [ n ] ) , t ) , { } ) : t y p e o f r = = " s t r i n g " & & r . s t a r t s W i t h ( " _ v p - f n _ " ) ? n e w F u n c t i o n ( ` r e t u r n $ { r . s l i c e ( 7 ) } ` ) ( ) : r } ; w i n d o w . _ _ V P _ S I T E _ D A T A _ _ = d e s e r i a l i z e F u n c t i o n s ( J S O N . p a r s e ( " { \ " l a n g \ " : \ " e n - U S \ " , \ " d i r \ " : \ " l t r \ " , \ " t i t l e \ " : \ " V i t e P r e s s \ " , \ " d e s c r i p t i o n \ " : \ " A V i t e P r e s s s i t e \ " , \ " b a s e \ " : \ " / \ " , \ " h e a d \ " : [ ] , \ " r o u t e r \ " : { \ " p r e f e t c h L i n k s \ " : t r u e } , \
2024-08-31 19:08:18 +08:00
< / body >
< / html >