MeUtils 2024.11.28.19.22.20__py3-none-any.whl → 2024.11.28.20.2.36__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MeUtils
3
- Version: 2024.11.28.19.22.20
3
+ Version: 2024.11.28.20.2.36
4
4
  Summary: description
5
5
  Home-page: https://github.com/yuanjie-ai/MeUtils
6
6
  Author: yuanjie
@@ -61,42 +61,42 @@ Requires-Dist: sse-starlette ; extra == 'ai'
61
61
  Requires-Dist: openai ; extra == 'ai'
62
62
  Requires-Dist: langchain ; extra == 'ai'
63
63
  Provides-Extra: all
64
- Requires-Dist: langchain ; extra == 'all'
65
- Requires-Dist: missingno ; extra == 'all'
66
- Requires-Dist: thefuck ; extra == 'all'
67
- Requires-Dist: thriftpy2 ; extra == 'all'
68
- Requires-Dist: uvicorn ; extra == 'all'
69
- Requires-Dist: sse-starlette ; extra == 'all'
64
+ Requires-Dist: redis-py-cluster ; extra == 'all'
65
+ Requires-Dist: fastapi[all] ; extra == 'all'
70
66
  Requires-Dist: fastapi ; extra == 'all'
71
- Requires-Dist: pymilvus ; extra == 'all'
72
- Requires-Dist: filetype ; extra == 'all'
73
- Requires-Dist: jmespath ; extra == 'all'
74
- Requires-Dist: dataframe-image ; extra == 'all'
67
+ Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
75
68
  Requires-Dist: reportlab ; extra == 'all'
76
- Requires-Dist: polars ; extra == 'all'
77
- Requires-Dist: schedule ; extra == 'all'
78
- Requires-Dist: sqlalchemy ; extra == 'all'
79
- Requires-Dist: simplejson ; extra == 'all'
80
- Requires-Dist: fastapi[all] ; extra == 'all'
81
- Requires-Dist: pyarrow ; extra == 'all'
69
+ Requires-Dist: seaborn ; extra == 'all'
70
+ Requires-Dist: jinja2 ; extra == 'all'
82
71
  Requires-Dist: pymongo ; extra == 'all'
72
+ Requires-Dist: schedule ; extra == 'all'
83
73
  Requires-Dist: geopy ; extra == 'all'
74
+ Requires-Dist: pymupd ; extra == 'all'
75
+ Requires-Dist: sqlalchemy ; extra == 'all'
76
+ Requires-Dist: asyncmy ; extra == 'all'
77
+ Requires-Dist: dataframe-image ; extra == 'all'
78
+ Requires-Dist: gunicorn ; extra == 'all'
79
+ Requires-Dist: missingno ; extra == 'all'
80
+ Requires-Dist: pymilvus ; extra == 'all'
84
81
  Requires-Dist: faiss-cpu ; extra == 'all'
85
- Requires-Dist: streamlit ; extra == 'all'
86
- Requires-Dist: pymysql ; extra == 'all'
87
- Requires-Dist: redis-py-cluster ; extra == 'all'
88
- Requires-Dist: pretty-errors ; extra == 'all'
82
+ Requires-Dist: simplejson ; extra == 'all'
83
+ Requires-Dist: pandas-summary ; extra == 'all'
89
84
  Requires-Dist: iteration-utilities ; extra == 'all'
90
- Requires-Dist: jinja2 ; extra == 'all'
85
+ Requires-Dist: polars ; extra == 'all'
86
+ Requires-Dist: pretty-errors ; extra == 'all'
91
87
  Requires-Dist: openai ; extra == 'all'
92
- Requires-Dist: pandas-summary ; extra == 'all'
93
88
  Requires-Dist: jieba ; extra == 'all'
94
- Requires-Dist: seaborn ; extra == 'all'
95
- Requires-Dist: asyncmy ; extra == 'all'
96
- Requires-Dist: gunicorn ; extra == 'all'
89
+ Requires-Dist: filetype ; extra == 'all'
90
+ Requires-Dist: uvicorn ; extra == 'all'
91
+ Requires-Dist: thefuck ; extra == 'all'
92
+ Requires-Dist: jmespath ; extra == 'all'
93
+ Requires-Dist: langchain ; extra == 'all'
94
+ Requires-Dist: sse-starlette ; extra == 'all'
95
+ Requires-Dist: thriftpy2 ; extra == 'all'
97
96
  Requires-Dist: cachetools ; extra == 'all'
98
- Requires-Dist: pymupd ; extra == 'all'
99
- Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
97
+ Requires-Dist: pyarrow ; extra == 'all'
98
+ Requires-Dist: streamlit ; extra == 'all'
99
+ Requires-Dist: pymysql ; extra == 'all'
100
100
  Provides-Extra: ann
101
101
  Requires-Dist: pymilvus ; extra == 'ann'
102
102
  Requires-Dist: faiss-cpu ; extra == 'ann'
@@ -423,11 +423,12 @@ meutils/async_task/通用设计.py,sha256=kGdrJHJu9VoOkyGHREn0KUtBTibAaLIcG0O6hE
423
423
  meutils/async_task/tasks/__init__.py,sha256=2ilRdLq7JNpFU_xFc54r5JGOuNhx5r-zoyXqxC4WWIg,244
424
424
  meutils/async_task/tasks/_all.py,sha256=Vz63k9yvgj-IBGjekm0u2t571TTT0nMRMqcPvPqJAbY,533
425
425
  meutils/async_task/tasks/kling.py,sha256=Z2Z0orhh3VFUkvfTr66lO4fw9hLoxoVBv3Vz6gxEU-8,516
426
- meutils/async_task/tasks/test.py,sha256=zgxrlNlPoAlwa6aissSEcwKpT_JGma4ci7qaPfMHfZI,1014
426
+ meutils/async_task/tasks/test.py,sha256=sPqTbnCocNFmSOH2qRBUQWWVsFyzrcV0ngZ-1ckBrZY,1202
427
427
  meutils/async_task/tasks/vidu.py,sha256=obBG4_bf1oPIlLxeca1s1dGOnlyam2xYRy-8TrH3ZTk,620
428
428
  meutils/async_utils/__init__.py,sha256=IiJLRm258jkM4xAjUKOD7tVwHIemj7_1CuzXCu3TuQU,284
429
+ meutils/async_utils/asyncer_.py,sha256=S1Sp5WZx_uKM7kJyRVYU8QhmbjOh61JmfN2IN_PJNX4,736
429
430
  meutils/async_utils/background.py,sha256=dl6UaMIFBZDB1uxSZzGFJdSnpt3Xo0flK7gwsokVy78,1464
430
- meutils/async_utils/common.py,sha256=ZPKdloCCXkO6xLxUBiGc2p5YJotsb4PaqfinI-CnZm8,4674
431
+ meutils/async_utils/common.py,sha256=WIQ7CVaZiaUeFA3IInM_4uaehJQiTdr_g3Q_8_yQrgc,4899
431
432
  meutils/async_utils/test.py,sha256=lkZdgSzzgVg8hYVcaBNEJ3KBvFTEfjbXZVvtknQZsRQ,1155
432
433
  meutils/cache/__init__.py,sha256=7ke7BKRUkp1raYrsgOIojHHdeHYNstw9APIdBNDNRzc,2129
433
434
  meutils/clis/__init__.py,sha256=2Fhn43X8kFP6FpAnnAMiPcdnjUwQaukiIr2uGB6mGAY,279
@@ -457,7 +458,7 @@ meutils/config_utils/lark_utils/demo.py,sha256=3g0Fs7oLaeW75T60gYWMLgyNg1OnfOjfH
457
458
  meutils/config_utils/lark_utils/x.py,sha256=MlMQGhehP9xMEgetxVCX68XFaosfKoW1JA5cZ3JqN2w,1857
458
459
  meutils/crawlers/__init__.py,sha256=TBU4xA-IOsHV-0yIkW7YXxn_QT7TT8NncqxO7IykEfs,271
459
460
  meutils/data/SimHei.ttf,sha256=-XEnekS5yHP_URkT4XBI2w22ylV-KxudhkeIYFbrILA,10062565
460
- meutils/data/VERSION,sha256=za9ZTNtfARZhwHpHhpujUJc40yAgqaSLpZas4p7-MPI,19
461
+ meutils/data/VERSION,sha256=qsSy9dnRgjtdSs_SqrxScnUjyNuZNk2NKIY-duD8EFU,19
461
462
  meutils/data/_FLAG,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
462
463
  meutils/data/_SUCCESS,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
463
464
  meutils/data/__init__.py,sha256=Hfwkkxs4zHqKhxht0YrhS566a9P5axtmgNvM5wF8ceQ,243
@@ -790,9 +791,9 @@ meutils/tools/seize.py,sha256=nOKAS63w-Lbi48I0m2MPhdsokUTwxco0laPxYVmW4Mw,1064
790
791
  meutils/tools/service_monitor.py,sha256=ibsLtBN2g2DL7ZnLJ8vhiZOiOcqTAyx711djDdBK-3M,1255
791
792
  meutils/tools/sys_monitor.py,sha256=6MoyzrItqDUOSjfHcMJmMofQkEPTW36CT_aKui0rg84,429
792
793
  meutils/tools/token_monitor.py,sha256=Np-YK-R4P4IPAXyZvMxwvXI4sFmNJQAQK1lSegNaYpA,997
793
- MeUtils-2024.11.28.19.22.20.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
794
- MeUtils-2024.11.28.19.22.20.dist-info/METADATA,sha256=ZdJt2B_5YFSj1ET1J4KT7zlMpOqufqtuDmHleS-SJwQ,6144
795
- MeUtils-2024.11.28.19.22.20.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
796
- MeUtils-2024.11.28.19.22.20.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
797
- MeUtils-2024.11.28.19.22.20.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
798
- MeUtils-2024.11.28.19.22.20.dist-info/RECORD,,
794
+ MeUtils-2024.11.28.20.2.36.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
795
+ MeUtils-2024.11.28.20.2.36.dist-info/METADATA,sha256=dyl9mEIDsBHfiFpTBBwPurKOjbmjCim_qsDEJuwembY,6143
796
+ MeUtils-2024.11.28.20.2.36.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
797
+ MeUtils-2024.11.28.20.2.36.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
798
+ MeUtils-2024.11.28.20.2.36.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
799
+ MeUtils-2024.11.28.20.2.36.dist-info/RECORD,,
@@ -9,9 +9,8 @@
9
9
  # @Description :
10
10
 
11
11
  from meutils.pipe import *
12
- from meutils.async_utils import async_to_sync
13
12
  from meutils.decorators.retry import retrying
14
-
13
+ from meutils.async_utils import async_to_sync_pro
15
14
  from meutils.async_task import worker, shared_task
16
15
 
17
16
 
@@ -23,8 +22,12 @@ def do_sync_task(sleep=10, **kwargs):
23
22
  return kwargs
24
23
 
25
24
 
26
- @shared_task()
27
- @async_to_sync
25
+ # AttributeError: 'AsyncToSync' object has no attribute '__name__'. Did you mean: '__ne__'?
26
+
27
+
28
+ # @shared_task(name='meutils.async_task.tasks.test.proxy_task')
29
+ @shared_task
30
+ @async_to_sync_pro
28
31
  async def ado_sync_task(**kwargs):
29
32
  logger.debug("同步任务+协程")
30
33
  await asyncio.sleep(10)
@@ -45,4 +48,5 @@ def proxy_task(**kwargs):
45
48
 
46
49
 
47
50
  if __name__ == '__main__':
48
- print(do_sync_task.apply_async(kwargs={'a': 1, 'b': 2}))
51
+ # print(do_sync_task.apply_async(kwargs={'a': 1, 'b': 2}))
52
+ print(AsyncToSync)
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : x
5
+ # @Time : 2024/11/28 19:30
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description : https://github.com/fastapi/asyncer
10
+
11
+ from meutils.pipe import *
12
+ import time
13
+
14
+ import anyio
15
+ from asyncer import asyncify, syncify
16
+
17
+ @asyncify
18
+ def do_sync_work(name: str):
19
+ time.sleep(1)
20
+ return f"Hello, {name}"
21
+
22
+
23
+ @syncify
24
+ async def do_async_work(name: str):
25
+ await asyncio.sleep(1)
26
+ return f"Hello, a{name}"
27
+
28
+ async def main():
29
+ message = await asyncify(do_sync_work)(name="World")
30
+ print(message)
31
+
32
+
33
+ if __name__ == '__main__':
34
+
35
+
36
+ # arun(do_sync_work('xx'))
37
+ arun(do_async_work('xxx'))
@@ -20,6 +20,15 @@ from httpx import Client, AsyncClient
20
20
  from loguru import logger
21
21
  from pprint import pprint
22
22
  from aiostream import stream
23
+ from functools import wraps
24
+
25
+
26
+ def async_to_sync_pro(func):
27
+ @wraps(func) # 添加这行来保留原函数的属性
28
+ def wrapper(*args, **kwargs):
29
+ return async_to_sync(func)(*args, **kwargs)
30
+
31
+ return wrapper
23
32
 
24
33
 
25
34
  async def achain(*iterables: Union[Iterator[Any], AsyncIterator[Any]], delay: int = 0) -> AsyncIterator[Any]:
meutils/data/VERSION CHANGED
@@ -1 +1 @@
1
- 2024.11.28.19.22.20
1
+ 2024.11.28.20.02.36