pyxllib 0.0.43__py3-none-any.whl → 0.3.197__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.
Files changed (186) hide show
  1. pyxllib/__init__.py +9 -2
  2. pyxllib/algo/__init__.py +8 -0
  3. pyxllib/algo/disjoint.py +54 -0
  4. pyxllib/algo/geo.py +541 -0
  5. pyxllib/{util/mathlib.py → algo/intervals.py} +172 -36
  6. pyxllib/algo/matcher.py +389 -0
  7. pyxllib/algo/newbie.py +166 -0
  8. pyxllib/algo/pupil.py +629 -0
  9. pyxllib/algo/shapelylib.py +67 -0
  10. pyxllib/algo/specialist.py +241 -0
  11. pyxllib/algo/stat.py +494 -0
  12. pyxllib/algo/treelib.py +149 -0
  13. pyxllib/algo/unitlib.py +66 -0
  14. pyxllib/autogui/__init__.py +5 -0
  15. pyxllib/autogui/activewin.py +246 -0
  16. pyxllib/autogui/all.py +9 -0
  17. pyxllib/autogui/autogui.py +852 -0
  18. pyxllib/autogui/uiautolib.py +362 -0
  19. pyxllib/autogui/virtualkey.py +102 -0
  20. pyxllib/autogui/wechat.py +827 -0
  21. pyxllib/autogui/wechat_msg.py +421 -0
  22. pyxllib/autogui/wxautolib.py +84 -0
  23. pyxllib/cv/__init__.py +1 -11
  24. pyxllib/cv/expert.py +267 -0
  25. pyxllib/cv/{imlib.py → imfile.py} +18 -83
  26. pyxllib/cv/imhash.py +39 -0
  27. pyxllib/cv/pupil.py +9 -0
  28. pyxllib/cv/rgbfmt.py +1525 -0
  29. pyxllib/cv/slidercaptcha.py +137 -0
  30. pyxllib/cv/trackbartools.py +163 -49
  31. pyxllib/cv/xlcvlib.py +1040 -0
  32. pyxllib/cv/xlpillib.py +423 -0
  33. pyxllib/data/__init__.py +0 -0
  34. pyxllib/data/echarts.py +240 -0
  35. pyxllib/data/jsonlib.py +89 -0
  36. pyxllib/{util/oss2_.py → data/oss.py} +11 -9
  37. pyxllib/data/pglib.py +1127 -0
  38. pyxllib/data/sqlite.py +568 -0
  39. pyxllib/{util → data}/sqllib.py +13 -31
  40. pyxllib/ext/JLineViewer.py +505 -0
  41. pyxllib/ext/__init__.py +6 -0
  42. pyxllib/{util → ext}/demolib.py +119 -35
  43. pyxllib/ext/drissionlib.py +277 -0
  44. pyxllib/ext/kq5034lib.py +12 -0
  45. pyxllib/{util/main.py → ext/old.py} +122 -284
  46. pyxllib/ext/qt.py +449 -0
  47. pyxllib/ext/robustprocfile.py +497 -0
  48. pyxllib/ext/seleniumlib.py +76 -0
  49. pyxllib/{util/tklib.py → ext/tk.py} +10 -11
  50. pyxllib/ext/unixlib.py +827 -0
  51. pyxllib/ext/utools.py +351 -0
  52. pyxllib/{util/webhooklib.py → ext/webhook.py} +45 -17
  53. pyxllib/ext/win32lib.py +40 -0
  54. pyxllib/ext/wjxlib.py +88 -0
  55. pyxllib/ext/wpsapi.py +124 -0
  56. pyxllib/ext/xlwork.py +9 -0
  57. pyxllib/ext/yuquelib.py +1105 -0
  58. pyxllib/file/__init__.py +17 -0
  59. pyxllib/file/docxlib.py +761 -0
  60. pyxllib/{util → file}/gitlib.py +40 -27
  61. pyxllib/file/libreoffice.py +165 -0
  62. pyxllib/file/movielib.py +148 -0
  63. pyxllib/file/newbie.py +10 -0
  64. pyxllib/file/onenotelib.py +1469 -0
  65. pyxllib/file/packlib/__init__.py +330 -0
  66. pyxllib/{util → file/packlib}/zipfile.py +598 -195
  67. pyxllib/file/pdflib.py +426 -0
  68. pyxllib/file/pupil.py +185 -0
  69. pyxllib/file/specialist/__init__.py +685 -0
  70. pyxllib/{basic/_5_dirlib.py → file/specialist/dirlib.py} +364 -93
  71. pyxllib/file/specialist/download.py +193 -0
  72. pyxllib/file/specialist/filelib.py +2829 -0
  73. pyxllib/file/xlsxlib.py +3131 -0
  74. pyxllib/file/xlsyncfile.py +341 -0
  75. pyxllib/prog/__init__.py +5 -0
  76. pyxllib/prog/cachetools.py +64 -0
  77. pyxllib/prog/deprecatedlib.py +233 -0
  78. pyxllib/prog/filelock.py +42 -0
  79. pyxllib/prog/ipyexec.py +253 -0
  80. pyxllib/prog/multiprogs.py +940 -0
  81. pyxllib/prog/newbie.py +451 -0
  82. pyxllib/prog/pupil.py +1197 -0
  83. pyxllib/{sitepackages.py → prog/sitepackages.py} +5 -3
  84. pyxllib/prog/specialist/__init__.py +391 -0
  85. pyxllib/prog/specialist/bc.py +203 -0
  86. pyxllib/prog/specialist/browser.py +497 -0
  87. pyxllib/prog/specialist/common.py +347 -0
  88. pyxllib/prog/specialist/datetime.py +199 -0
  89. pyxllib/prog/specialist/tictoc.py +240 -0
  90. pyxllib/prog/specialist/xllog.py +180 -0
  91. pyxllib/prog/xlosenv.py +108 -0
  92. pyxllib/stdlib/__init__.py +17 -0
  93. pyxllib/{util → stdlib}/tablepyxl/__init__.py +1 -3
  94. pyxllib/{util → stdlib}/tablepyxl/style.py +1 -1
  95. pyxllib/{util → stdlib}/tablepyxl/tablepyxl.py +2 -4
  96. pyxllib/text/__init__.py +8 -0
  97. pyxllib/text/ahocorasick.py +39 -0
  98. pyxllib/text/airscript.js +744 -0
  99. pyxllib/text/charclasslib.py +121 -0
  100. pyxllib/text/jiebalib.py +267 -0
  101. pyxllib/text/jinjalib.py +32 -0
  102. pyxllib/text/jsa_ai_prompt.md +271 -0
  103. pyxllib/text/jscode.py +922 -0
  104. pyxllib/text/latex/__init__.py +158 -0
  105. pyxllib/text/levenshtein.py +303 -0
  106. pyxllib/text/nestenv.py +1215 -0
  107. pyxllib/text/newbie.py +300 -0
  108. pyxllib/text/pupil/__init__.py +8 -0
  109. pyxllib/text/pupil/common.py +1121 -0
  110. pyxllib/text/pupil/xlalign.py +326 -0
  111. pyxllib/text/pycode.py +47 -0
  112. pyxllib/text/specialist/__init__.py +8 -0
  113. pyxllib/text/specialist/common.py +112 -0
  114. pyxllib/text/specialist/ptag.py +186 -0
  115. pyxllib/text/spellchecker.py +172 -0
  116. pyxllib/text/templates/echart_base.html +11 -0
  117. pyxllib/text/templates/highlight_code.html +17 -0
  118. pyxllib/text/templates/latex_editor.html +103 -0
  119. pyxllib/text/vbacode.py +17 -0
  120. pyxllib/text/xmllib.py +747 -0
  121. pyxllib/xl.py +39 -0
  122. pyxllib/xlcv.py +17 -0
  123. pyxllib-0.3.197.dist-info/METADATA +48 -0
  124. pyxllib-0.3.197.dist-info/RECORD +126 -0
  125. {pyxllib-0.0.43.dist-info → pyxllib-0.3.197.dist-info}/WHEEL +4 -5
  126. pyxllib/basic/_1_strlib.py +0 -945
  127. pyxllib/basic/_2_timelib.py +0 -488
  128. pyxllib/basic/_3_pathlib.py +0 -916
  129. pyxllib/basic/_4_loglib.py +0 -419
  130. pyxllib/basic/__init__.py +0 -54
  131. pyxllib/basic/arrow_.py +0 -250
  132. pyxllib/basic/chardet_.py +0 -66
  133. pyxllib/basic/dirlib.py +0 -529
  134. pyxllib/basic/dprint.py +0 -202
  135. pyxllib/basic/extension.py +0 -12
  136. pyxllib/basic/judge.py +0 -31
  137. pyxllib/basic/log.py +0 -204
  138. pyxllib/basic/pathlib_.py +0 -705
  139. pyxllib/basic/pytictoc.py +0 -102
  140. pyxllib/basic/qiniu_.py +0 -61
  141. pyxllib/basic/strlib.py +0 -761
  142. pyxllib/basic/timer.py +0 -132
  143. pyxllib/cv/cv.py +0 -834
  144. pyxllib/cv/cvlib/_1_geo.py +0 -543
  145. pyxllib/cv/cvlib/_2_cvprcs.py +0 -309
  146. pyxllib/cv/cvlib/_2_imgproc.py +0 -594
  147. pyxllib/cv/cvlib/_3_pilprcs.py +0 -80
  148. pyxllib/cv/cvlib/_4_cvimg.py +0 -211
  149. pyxllib/cv/cvlib/__init__.py +0 -10
  150. pyxllib/cv/debugtools.py +0 -82
  151. pyxllib/cv/fitz_.py +0 -300
  152. pyxllib/cv/installer.py +0 -42
  153. pyxllib/debug/_0_installer.py +0 -38
  154. pyxllib/debug/_1_typelib.py +0 -277
  155. pyxllib/debug/_2_chrome.py +0 -198
  156. pyxllib/debug/_3_showdir.py +0 -161
  157. pyxllib/debug/_4_bcompare.py +0 -140
  158. pyxllib/debug/__init__.py +0 -49
  159. pyxllib/debug/bcompare.py +0 -132
  160. pyxllib/debug/chrome.py +0 -198
  161. pyxllib/debug/installer.py +0 -38
  162. pyxllib/debug/showdir.py +0 -158
  163. pyxllib/debug/typelib.py +0 -278
  164. pyxllib/image/__init__.py +0 -12
  165. pyxllib/torch/__init__.py +0 -20
  166. pyxllib/torch/modellib.py +0 -37
  167. pyxllib/torch/trainlib.py +0 -344
  168. pyxllib/util/__init__.py +0 -20
  169. pyxllib/util/aip_.py +0 -141
  170. pyxllib/util/casiadb.py +0 -59
  171. pyxllib/util/excellib.py +0 -495
  172. pyxllib/util/filelib.py +0 -612
  173. pyxllib/util/jsondata.py +0 -27
  174. pyxllib/util/jsondata2.py +0 -92
  175. pyxllib/util/labelmelib.py +0 -139
  176. pyxllib/util/onepy/__init__.py +0 -29
  177. pyxllib/util/onepy/onepy.py +0 -574
  178. pyxllib/util/onepy/onmanager.py +0 -170
  179. pyxllib/util/pyautogui_.py +0 -219
  180. pyxllib/util/textlib.py +0 -1305
  181. pyxllib/util/unorder.py +0 -22
  182. pyxllib/util/xmllib.py +0 -639
  183. pyxllib-0.0.43.dist-info/METADATA +0 -39
  184. pyxllib-0.0.43.dist-info/RECORD +0 -80
  185. pyxllib-0.0.43.dist-info/top_level.txt +0 -1
  186. {pyxllib-0.0.43.dist-info → pyxllib-0.3.197.dist-info/licenses}/LICENSE +0 -0
pyxllib/util/jsondata2.py DELETED
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # @Author : 陈坤泽
4
- # @Email : 877362867@qq.com
5
- # @Data : 2020/09/16 11:08
6
-
7
- """
8
- jsondata是轻量级的功能库
9
-
10
- 而本jsondata2则是依赖pyxllib.cv的一些高级功能
11
- """
12
-
13
- from pyxllib.cv import *
14
- from .jsondata import *
15
-
16
-
17
- class ToLabelmeJson:
18
- """ 标注格式转label形式 """
19
-
20
- def __init__(self, imgpath=None):
21
- """
22
- :param imgpath: 可选参数图片路径,强烈建议要输入,否则建立的label json会少掉图片宽高信息
23
- """
24
- self.imgpath = Path(imgpath)
25
- # 读取图片数据,在一些转换规则比较复杂,有可能要用到原图数据
26
- if self.imgpath.is_file():
27
- self.img = imread(str(self.imgpath))
28
- else:
29
- self.img = None
30
- self.data = None # 存储json的字典数据
31
-
32
- def get_data(self, infile):
33
- """ 格式转换接口函数,继承的类需要自己实现这个方法
34
- :param infile: 待解析的标注数据
35
- """
36
- # s = Path(infile).read()
37
- # self.data = self.get_data_base()
38
- raise NotImplementedError('get_data方法必须在子类中实现')
39
-
40
- def get_data_base(self, name='', height=0, width=0):
41
- """ 获得一个labelme标注文件的框架
42
-
43
- 如果初始化时没有输入图片,也可以这里传入name等的值
44
- """
45
- # 1 默认属性,和图片名、尺寸
46
- if self.imgpath.is_file():
47
- name = self.imgpath.name
48
- height, width = self.img.shape[:2]
49
- # 2 构建结构框架
50
- data = {'version': '4.5.6',
51
- 'flags': {},
52
- 'shapes': [],
53
- 'imagePath': name,
54
- 'imageData': None,
55
- 'imageWidth': width,
56
- 'imageHeight': height,
57
- }
58
- return data
59
-
60
- def get_shape(self, label, points, shape_type=None, dtype=None):
61
- """最基本的添加形状功能
62
-
63
- :param shape_type: 会根据points的点数量,智能判断类型,默认一般是polygon
64
- :param dtype: 可以重置points的存储数值类型,一般是浮点数,可以转成整数更精简
65
- """
66
- # 1 优化点集数据格式
67
- points = ensure_nparr(points, dtype).reshape(-1, 2).tolist()
68
- # 2 判断形状类型
69
- if shape_type is None:
70
- m = len(points)
71
- if m == 2:
72
- shape_type = 'rectangle'
73
- elif m >= 3:
74
- shape_type = 'polygon'
75
- else:
76
- raise ValueError
77
- # 3 创建标注
78
- shape = {'flags': {},
79
- 'group_id': None,
80
- 'label': str(label),
81
- 'points': points,
82
- 'shape_type': shape_type}
83
- return shape
84
-
85
- def write(self, dst=None, if_exists='replace'):
86
- """
87
- :param dst: 往dst目标路径存入json文件,默认名称在self.imgpath同目录的同名json文件
88
- :return: 写入后的文件路径
89
- """
90
- if dst is None and self.imgpath.is_file():
91
- dst = self.imgpath.with_suffix('.json')
92
- return Path(dst).write(self.data, if_exists=if_exists)
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # @Author : 陈坤泽
4
- # @Email : 877362867@qq.com
5
- # @Data : 2020/08/15 00:59
6
-
7
-
8
- from pyxllib.basic import *
9
- from pyxllib.debug import pd
10
- from pyxllib.cv import imread, np_array, np
11
-
12
-
13
- def is_labelme_json_data(data):
14
- """ 是labelme的标注格式
15
- :param data: dict
16
- :return: True or False
17
- """
18
- has_keys = set('version flags shapes imagePath imageData imageHeight imageWidth'.split())
19
- return not (has_keys - data.keys())
20
-
21
-
22
- def reduce_labelme_jsonfile(jsonpath):
23
- """ 删除imageData """
24
- p = Path(jsonpath)
25
- data = p.read(mode='.json')
26
- if is_labelme_json_data(data) and data['imageData']:
27
- data['imageData'] = None
28
- p.write(data, encoding=p.encoding, if_exists='replace')
29
-
30
-
31
- class ToLabelmeJson:
32
- """ 标注格式转label形式
33
-
34
- 初始化最好带有图片路径,能获得一些相关有用的信息
35
- 然后自定义实现一个 get_data 接口,实现self.data的初始化,运行完可以从self.data取到字典数据
36
- 根据需要可以定制自己的shape,修改get_shape函数
37
- 可以调用write写入文件
38
-
39
- 具体用法可以参考 handzuowen https://www.yuque.com/xlpr/datalabel/wzu73p 的数据处理代码
40
- """
41
-
42
- def __init__(self, imgpath=None):
43
- """
44
- :param imgpath: 可选参数图片路径,强烈建议要输入,否则建立的label json会少掉图片宽高信息
45
- """
46
- self.imgpath = Path(imgpath)
47
- # 读取图片数据,在一些转换规则比较复杂,有可能要用到原图数据
48
- if self.imgpath.is_file():
49
- self.img = imread(str(self.imgpath))
50
- else:
51
- self.img = None
52
- self.data = None # 存储json的字典数据
53
-
54
- def get_data(self, infile):
55
- """ 格式转换接口函数,继承的类需要自己实现这个方法
56
-
57
- :param infile: 待解析的标注数据
58
- """
59
- # s = Path(infile).read()
60
- # self.data = self.get_data_base()
61
- raise NotImplementedError('get_data方法必须在子类中实现')
62
-
63
- def get_data_base(self, name='', height=0, width=0):
64
- """ 获得一个labelme标注文件的框架
65
-
66
- 如果初始化时没有输入图片,也可以这里传入name等的值
67
- """
68
- # 1 默认属性,和图片名、尺寸
69
- if self.imgpath.is_file():
70
- name = self.imgpath.name
71
- height, width = self.img.shape[:2]
72
- # 2 构建结构框架
73
- data = {'version': '4.5.6',
74
- 'flags': {},
75
- 'shapes': [],
76
- 'imagePath': name,
77
- 'imageData': None,
78
- 'imageWidth': width,
79
- 'imageHeight': height,
80
- }
81
- return data
82
-
83
- def get_shape(self, label, points, shape_type=None, dtype=None):
84
- """最基本的添加形状功能
85
-
86
- :param shape_type: 会根据points的点数量,智能判断类型,默认一般是polygon
87
- :param dtype: 可以重置points的存储数值类型,一般是浮点数,可以转成整数更精简
88
- """
89
- # 1 优化点集数据格式
90
- points = np_array(points, dtype).reshape(-1, 2).tolist()
91
- # 2 判断形状类型
92
- if shape_type is None:
93
- m = len(points)
94
- if m == 2:
95
- shape_type = 'rectangle'
96
- elif m >= 3:
97
- shape_type = 'polygon'
98
- else:
99
- raise ValueError
100
- # 3 创建标注
101
- shape = {'flags': {},
102
- 'group_id': None,
103
- 'label': str(label),
104
- 'points': points,
105
- 'shape_type': shape_type}
106
- return shape
107
-
108
- def write(self, dst=None, if_exists='replace'):
109
- """
110
- :param dst: 往dst目标路径存入json文件,默认名称在self.imgpath同目录的同名json文件
111
- :return: 写入后的文件路径
112
- """
113
- if dst is None and self.imgpath.is_file():
114
- dst = self.imgpath.with_suffix('.json')
115
- return Path(dst).write(self.data, if_exists=if_exists)
116
-
117
-
118
- def get_labelme_shapes_df(dir, pattern='**/*.json', max_workers=None, pinterval=None, **kwargs):
119
- """ 获得labelme文件的shapes清单列表
120
-
121
- :param max_workers: 这个运算还不是很快,默认需要开多线程
122
- """
123
-
124
- def func(p):
125
- data = p.read()
126
- if not data['shapes']: return
127
- df = pd.DataFrame.from_records(data['shapes'])
128
- df['filename'] = p.relative_path(dir)
129
- # 坐标转成整数,看起来比较精简点
130
- df['points'] = [np.array(v, dtype=int).tolist() for v in df['points']]
131
- li.append(df)
132
-
133
- li = []
134
- Dir(dir).select(pattern).procfiles(func, max_workers=max_workers, pinterval=pinterval, **kwargs)
135
- shapes_df = pd.concat(li)
136
- # TODO flags和group_id字段可以放到最后面
137
- shapes_df.reset_index(inplace=True, drop=True)
138
-
139
- return shapes_df
@@ -1,29 +0,0 @@
1
- """
2
- OneNote Object Model in Python
3
- """
4
-
5
- from __future__ import absolute_import
6
-
7
- from .onepy import (
8
- OneNote,
9
- Hierarchy,
10
- HierarchyNode,
11
- Notebook,
12
- SectionGroup,
13
- Section,
14
- Page,
15
- Meta,
16
- PageContent,
17
- Title,
18
- Outline,
19
- Position,
20
- Size,
21
- OE,
22
- InsertedFile,
23
- Ink,
24
- Image
25
- )
26
-
27
- from .onmanager import ONProcess
28
-
29
- __version__ = "0.2.1"