assembly-opencv 1.0.0__py3-none-any.whl → 1.0.1__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.
Config/Gloab.py ADDED
@@ -0,0 +1,3 @@
1
+
2
+ operator_menus = []
3
+ library_tree_data = []
Config/__init__.py ADDED
File without changes
@@ -0,0 +1,107 @@
1
+ import json
2
+ import time
3
+ import traceback
4
+ from functools import wraps
5
+ import inspect
6
+ from Config import Gloab
7
+
8
+
9
+ def func_description(title: str = "", description: str = ""):
10
+ """装饰器:为函数添加描述信息"""
11
+
12
+ def decorator(func):
13
+ @wraps(func)
14
+ def wrapper(*args, **kwargs):
15
+ print(f"Title: {title}")
16
+ print(f"Description: {description}")
17
+ print(f"Function: {func.__name__}")
18
+ print(f"class: {func.__qualname__.split('.')[0]}")
19
+ print(f"Args len: {len(args)}")
20
+ print(f"Kwargs: {kwargs}")
21
+
22
+ try:
23
+ start_time = time.time()
24
+ result = func(*args, **kwargs)
25
+ end_time = time.time()
26
+ print(f"Time elapsed: {end_time - start_time:.4f}s")
27
+
28
+ return result
29
+ except Exception as e:
30
+ print(f"An error occurred in function '{traceback.format_exc()}")
31
+ return None
32
+
33
+ return wrapper
34
+
35
+ return decorator
36
+
37
+
38
+ def class_description(title: str = "", description: str = "", level: int = 999):
39
+ """装饰器:为类添加描述信息"""
40
+
41
+ def decorator(cls):
42
+ original_init = cls.__init__
43
+
44
+ @wraps(original_init)
45
+ def new_init(self, *args, **kwargs):
46
+
47
+ menu_info = {"group_name": cls.__name__, "group_cn_name": title, "group_description": description,
48
+ "level": level,
49
+ "func_list": []}
50
+ for item in list(cls.__dict__.keys()):
51
+ if not item.startswith('__'):
52
+
53
+ func_info = {}
54
+ func = getattr(cls, item)
55
+ try:
56
+ source_code = inspect.getsource(func)
57
+ func_info["source_code"] = source_code
58
+ except Exception as e:
59
+ print(f"获取源码失败: {e}")
60
+ func_info["source_code"] = ""
61
+ # print(f"func_info: {func_info['source_code']}")
62
+
63
+ doc = func.__doc__
64
+ if doc:
65
+ if ":name" not in doc:
66
+ continue
67
+ docs = doc.split('\n')
68
+
69
+ for d in docs:
70
+ if ":name" in d:
71
+ func_info["func_name"] = item
72
+ func_info["func_cn_name"] = d.split(':name')[1].strip()
73
+ func_info["param_list"] = []
74
+ if ":param" in d:
75
+ params = d.split(':param')[1].strip().split(':')
76
+
77
+ param_name = params[0].strip() if params else ""
78
+ param_cn_name = params[1].strip() if len(
79
+ params) >= 2 else param_name # 不足时用 param_name 代替
80
+ param_type = params[2].strip() if len(params) >= 3 else ""
81
+ param_menu = params[3].strip() if len(params) >= 4 else []
82
+
83
+ func_info["param_list"].append(
84
+ {"param_name": param_name, "param_cn_name": param_cn_name, "param_type": param_type,
85
+ "param_menu": param_menu, "param_value": ""})
86
+ if ":return" in d:
87
+ results = d.split(':return')[1].strip().split(':')
88
+
89
+ if len(results) == 2:
90
+ func_info["return_type"] = results[0].strip()
91
+ func_info["return"] = results[1].strip()
92
+
93
+ menu_info["func_list"].append(func_info)
94
+
95
+ Gloab.operator_menus.append(menu_info)
96
+ try:
97
+ start_time = time.time()
98
+ original_init(self, *args, **kwargs)
99
+ end_time = time.time()
100
+ print(f"{cls.__name__} class init time elapsed: {end_time - start_time:.4f}s")
101
+ except Exception as e:
102
+ print(f"An error occurred in class '{cls.__name__}' initialization: {traceback.format_exc()}")
103
+
104
+ cls.__init__ = new_init
105
+ return cls
106
+
107
+ return decorator
File without changes
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: assembly-opencv
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Image processing utilities for Python with OpenCV
5
5
  Home-page:
6
6
  Author: Zven
7
- Author-email: zven@zven.xyz
7
+ Author-email: jdld.xzw@gmail.com
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
@@ -1,3 +1,5 @@
1
+ Config/Gloab.py,sha256=SYafuVTBz0etKaoM04wKV7lNsO5AOyccS6G1JF5JgCE,45
2
+ Config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1
3
  assembly/CornerDetection.py,sha256=3aa6zilFuU8neTyeJgqTMuVobQRmJKbYyrNgD8O5pYI,4195
2
4
  assembly/DrawImage.py,sha256=g9t3OBeX_TcdrLK_nNv0rKpsk-NrTs6ng_sYj5t92Xo,10630
3
5
  assembly/EdgeDetection.py,sha256=MTMqf-N1eMMctsyGQnOoGY7qnon5O1O5eRm1OYXd_Z4,7743
@@ -9,7 +11,9 @@ assembly/ImageSegmentation.py,sha256=8pw-gyEO6FeMqUMbSsB7JL86-_0j9lSLAXMTi7i2HCg
9
11
  assembly/MorphologicalChange.py,sha256=XbZyVdkJXKmsWok9JOa8toH1GS-pmXrwdm8R757r_fU,9919
10
12
  assembly/PolygonOperation.py,sha256=DLEvWEUFY_Rxeiqy1WxKw3qNOkR8eWbiUfuZy9VVyVI,10915
11
13
  assembly/__init__.py,sha256=DYzr16XXFUEKvmyqqsnB5BQispL1MRaGGUxyv62dnik,3951
12
- assembly_opencv-1.0.0.dist-info/METADATA,sha256=h5kxDVVj8Vb1bDdxSq3MGrIl0UVuuNJOoR5-uvnaPtk,510
13
- assembly_opencv-1.0.0.dist-info/WHEEL,sha256=hPN0AlP2dZM_3ZJZWP4WooepkmU9wzjGgCLCeFjkHLA,92
14
- assembly_opencv-1.0.0.dist-info/top_level.txt,sha256=Lz_5VS2mRAR7AduMlKl3vVyAOekcs_JNGew8waVVLas,9
15
- assembly_opencv-1.0.0.dist-info/RECORD,,
14
+ assembly/description/Decoration.py,sha256=HFhKt9nRZ407A9avBf-RFOFaM6I-zJOeXEXww-HQPoo,4413
15
+ assembly/description/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ assembly_opencv-1.0.1.dist-info/METADATA,sha256=GU_gxkZ4h7cH4uiWEVCysMXN3rBQwVrwtrCUPE7vD5A,515
17
+ assembly_opencv-1.0.1.dist-info/WHEEL,sha256=hPN0AlP2dZM_3ZJZWP4WooepkmU9wzjGgCLCeFjkHLA,92
18
+ assembly_opencv-1.0.1.dist-info/top_level.txt,sha256=RPfUWNlC2u4ZiHEEh8Gye23J4S6pWyawYBLDM6tzAbQ,16
19
+ assembly_opencv-1.0.1.dist-info/RECORD,,