pycoze 0.1.324__py3-none-any.whl → 0.1.325__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pycoze/reference/lib.py +9 -3
- {pycoze-0.1.324.dist-info → pycoze-0.1.325.dist-info}/METADATA +1 -1
- {pycoze-0.1.324.dist-info → pycoze-0.1.325.dist-info}/RECORD +6 -6
- {pycoze-0.1.324.dist-info → pycoze-0.1.325.dist-info}/LICENSE +0 -0
- {pycoze-0.1.324.dist-info → pycoze-0.1.325.dist-info}/WHEEL +0 -0
- {pycoze-0.1.324.dist-info → pycoze-0.1.325.dist-info}/top_level.txt +0 -0
pycoze/reference/lib.py
CHANGED
@@ -8,6 +8,9 @@ import asyncio
|
|
8
8
|
import inspect
|
9
9
|
import asyncio
|
10
10
|
|
11
|
+
import inspect
|
12
|
+
import asyncio
|
13
|
+
|
11
14
|
def call_func(func, args=None, kwargs=None):
|
12
15
|
if args is None:
|
13
16
|
args = ()
|
@@ -19,7 +22,7 @@ def call_func(func, args=None, kwargs=None):
|
|
19
22
|
elif inspect.iscoroutinefunction(func):
|
20
23
|
# 确保 func 是协程函数,而不是协程对象
|
21
24
|
coro = func(*args, **kwargs) if inspect.iscoroutinefunction(func) else func
|
22
|
-
|
25
|
+
|
23
26
|
try:
|
24
27
|
# 尝试获取当前运行的事件循环
|
25
28
|
loop = asyncio.get_running_loop()
|
@@ -27,8 +30,11 @@ def call_func(func, args=None, kwargs=None):
|
|
27
30
|
# 如果没有运行的事件循环,使用 asyncio.run()
|
28
31
|
return asyncio.run(coro)
|
29
32
|
else:
|
30
|
-
#
|
31
|
-
|
33
|
+
# 如果事件循环已经在运行,创建一个新任务并等待它完成
|
34
|
+
async def run_coro():
|
35
|
+
return await coro
|
36
|
+
# 创建一个新任务并等待它完成
|
37
|
+
return loop.run_until_complete(run_coro())
|
32
38
|
else:
|
33
39
|
return func(*args, **kwargs)
|
34
40
|
|
@@ -20,7 +20,7 @@ pycoze/bot/prompt.md,sha256=ehjdvZ-se9NaH0OSiDEvrFE9kvdj9MTZlWZUTxPY780,15743
|
|
20
20
|
pycoze/bot/tools.py,sha256=HqfBaJjS9Jg9-MGObD5Iegs8NZsM63DIPbaoMRZR5ms,9737
|
21
21
|
pycoze/reference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
pycoze/reference/bot.py,sha256=pxHVYo0G3P3YZ--vBYbMEiEyBoxxPwaO5dMTf9WFMSc,2014
|
23
|
-
pycoze/reference/lib.py,sha256=
|
23
|
+
pycoze/reference/lib.py,sha256=FMTLPXgWWo21fx0JHIc7sKSZAX6ooQuMwm6GSQ9aaPI,3361
|
24
24
|
pycoze/reference/tool.py,sha256=h7G3KSoZYWq5IJu6E0-shIQ3XiJeJsgSM85GxEnhF98,1107
|
25
25
|
pycoze/reference/workflow.py,sha256=whQtw_FAxvlSbjow1oNFLdytPjjRs_pDBbQmNjaX6zc,1340
|
26
26
|
pycoze/ui/__init__.py,sha256=uaXet23wUk64TcZjpBX8qOx4aUhwA_ucrmcxy7Q4Qr4,929
|
@@ -33,8 +33,8 @@ pycoze/utils/arg.py,sha256=jop1tBfe5hYkHW1NSpCeaZBEznkgguBscj_7M2dWfrs,503
|
|
33
33
|
pycoze/utils/env.py,sha256=5pWlXfM1F5ZU9hhv1rHlDEanjEW5wf0nbyez9bNRqqA,559
|
34
34
|
pycoze/utils/socket.py,sha256=bZbFFRH4mfThzRqt55BAAGQ6eICx_ja4x8UGGrUdAm8,2428
|
35
35
|
pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
|
36
|
-
pycoze-0.1.
|
37
|
-
pycoze-0.1.
|
38
|
-
pycoze-0.1.
|
39
|
-
pycoze-0.1.
|
40
|
-
pycoze-0.1.
|
36
|
+
pycoze-0.1.325.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
|
37
|
+
pycoze-0.1.325.dist-info/METADATA,sha256=aS8TCcV6kFcdDRQnVIN2KTSjzTK1D4sIeZ9yBqU3Luw,854
|
38
|
+
pycoze-0.1.325.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
39
|
+
pycoze-0.1.325.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
|
40
|
+
pycoze-0.1.325.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|