pyxllib 0.3.197__py3-none-any.whl → 0.3.200__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.
- pyxllib/__init__.py +21 -21
- pyxllib/algo/__init__.py +8 -8
- pyxllib/algo/disjoint.py +54 -54
- pyxllib/algo/geo.py +541 -541
- pyxllib/algo/intervals.py +964 -964
- pyxllib/algo/matcher.py +389 -389
- pyxllib/algo/newbie.py +166 -166
- pyxllib/algo/pupil.py +629 -629
- pyxllib/algo/shapelylib.py +67 -67
- pyxllib/algo/specialist.py +241 -241
- pyxllib/algo/stat.py +494 -494
- pyxllib/algo/treelib.py +149 -149
- pyxllib/algo/unitlib.py +66 -66
- pyxllib/autogui/__init__.py +5 -5
- pyxllib/autogui/activewin.py +246 -246
- pyxllib/autogui/all.py +9 -9
- pyxllib/autogui/autogui.py +852 -852
- pyxllib/autogui/uiautolib.py +362 -362
- pyxllib/autogui/virtualkey.py +102 -102
- pyxllib/autogui/wechat.py +827 -827
- pyxllib/autogui/wechat_msg.py +421 -421
- pyxllib/autogui/wxautolib.py +84 -84
- pyxllib/cv/__init__.py +5 -5
- pyxllib/cv/expert.py +267 -267
- pyxllib/cv/imfile.py +159 -159
- pyxllib/cv/imhash.py +39 -39
- pyxllib/cv/pupil.py +9 -9
- pyxllib/cv/rgbfmt.py +1525 -1525
- pyxllib/cv/slidercaptcha.py +137 -137
- pyxllib/cv/trackbartools.py +251 -251
- pyxllib/cv/xlcvlib.py +1040 -1040
- pyxllib/cv/xlpillib.py +423 -423
- pyxllib/data/echarts.py +240 -240
- pyxllib/data/jsonlib.py +89 -89
- pyxllib/data/oss.py +72 -72
- pyxllib/data/pglib.py +1127 -1127
- pyxllib/data/sqlite.py +568 -568
- pyxllib/data/sqllib.py +297 -297
- pyxllib/ext/JLineViewer.py +505 -505
- pyxllib/ext/__init__.py +6 -6
- pyxllib/ext/demolib.py +246 -246
- pyxllib/ext/drissionlib.py +277 -277
- pyxllib/ext/kq5034lib.py +12 -12
- pyxllib/ext/old.py +663 -663
- pyxllib/ext/qt.py +449 -449
- pyxllib/ext/robustprocfile.py +497 -497
- pyxllib/ext/seleniumlib.py +76 -76
- pyxllib/ext/tk.py +173 -173
- pyxllib/ext/unixlib.py +827 -827
- pyxllib/ext/utools.py +351 -351
- pyxllib/ext/webhook.py +124 -119
- pyxllib/ext/win32lib.py +40 -40
- pyxllib/ext/wjxlib.py +88 -88
- pyxllib/ext/wpsapi.py +124 -124
- pyxllib/ext/xlwork.py +9 -9
- pyxllib/ext/yuquelib.py +1105 -1105
- pyxllib/file/__init__.py +17 -17
- pyxllib/file/docxlib.py +761 -761
- pyxllib/file/gitlib.py +309 -309
- pyxllib/file/libreoffice.py +165 -165
- pyxllib/file/movielib.py +148 -148
- pyxllib/file/newbie.py +10 -10
- pyxllib/file/onenotelib.py +1469 -1469
- pyxllib/file/packlib/__init__.py +330 -330
- pyxllib/file/packlib/zipfile.py +2441 -2441
- pyxllib/file/pdflib.py +426 -426
- pyxllib/file/pupil.py +185 -185
- pyxllib/file/specialist/__init__.py +685 -685
- pyxllib/file/specialist/dirlib.py +799 -799
- pyxllib/file/specialist/download.py +193 -193
- pyxllib/file/specialist/filelib.py +2829 -2829
- pyxllib/file/xlsxlib.py +3131 -3131
- pyxllib/file/xlsyncfile.py +341 -341
- pyxllib/prog/__init__.py +5 -5
- pyxllib/prog/cachetools.py +64 -64
- pyxllib/prog/deprecatedlib.py +233 -233
- pyxllib/prog/filelock.py +42 -42
- pyxllib/prog/ipyexec.py +253 -253
- pyxllib/prog/multiprogs.py +940 -940
- pyxllib/prog/newbie.py +451 -451
- pyxllib/prog/pupil.py +1197 -1197
- pyxllib/prog/sitepackages.py +33 -33
- pyxllib/prog/specialist/__init__.py +391 -391
- pyxllib/prog/specialist/bc.py +203 -203
- pyxllib/prog/specialist/browser.py +497 -497
- pyxllib/prog/specialist/common.py +347 -347
- pyxllib/prog/specialist/datetime.py +198 -198
- pyxllib/prog/specialist/tictoc.py +240 -240
- pyxllib/prog/specialist/xllog.py +180 -180
- pyxllib/prog/xlosenv.py +108 -108
- pyxllib/stdlib/__init__.py +17 -17
- pyxllib/stdlib/tablepyxl/__init__.py +10 -10
- pyxllib/stdlib/tablepyxl/style.py +303 -303
- pyxllib/stdlib/tablepyxl/tablepyxl.py +130 -130
- pyxllib/text/__init__.py +8 -8
- pyxllib/text/ahocorasick.py +39 -39
- pyxllib/text/airscript.js +744 -744
- pyxllib/text/charclasslib.py +121 -121
- pyxllib/text/jiebalib.py +267 -267
- pyxllib/text/jinjalib.py +32 -32
- pyxllib/text/jsa_ai_prompt.md +271 -271
- pyxllib/text/jscode.py +922 -922
- pyxllib/text/latex/__init__.py +158 -158
- pyxllib/text/levenshtein.py +303 -303
- pyxllib/text/nestenv.py +1215 -1215
- pyxllib/text/newbie.py +300 -300
- pyxllib/text/pupil/__init__.py +8 -8
- pyxllib/text/pupil/common.py +1121 -1121
- pyxllib/text/pupil/xlalign.py +326 -326
- pyxllib/text/pycode.py +47 -47
- pyxllib/text/specialist/__init__.py +8 -8
- pyxllib/text/specialist/common.py +112 -112
- pyxllib/text/specialist/ptag.py +186 -186
- pyxllib/text/spellchecker.py +172 -172
- pyxllib/text/templates/echart_base.html +10 -10
- pyxllib/text/templates/highlight_code.html +16 -16
- pyxllib/text/templates/latex_editor.html +102 -102
- pyxllib/text/vbacode.py +17 -17
- pyxllib/text/xmllib.py +747 -747
- pyxllib/xl.py +42 -39
- pyxllib/xlcv.py +17 -17
- {pyxllib-0.3.197.dist-info → pyxllib-0.3.200.dist-info}/METADATA +1 -1
- pyxllib-0.3.200.dist-info/RECORD +126 -0
- {pyxllib-0.3.197.dist-info → pyxllib-0.3.200.dist-info}/licenses/LICENSE +190 -190
- pyxllib-0.3.197.dist-info/RECORD +0 -126
- {pyxllib-0.3.197.dist-info → pyxllib-0.3.200.dist-info}/WHEEL +0 -0
pyxllib/data/oss.py
CHANGED
@@ -1,72 +1,72 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# @Author : 陈坤泽
|
4
|
-
# @Email : 877362867@qq.com
|
5
|
-
# @Date : 2020/06/15
|
6
|
-
|
7
|
-
"""
|
8
|
-
oss2 · PyPI: https://pypi.org/project/oss2/
|
9
|
-
"""
|
10
|
-
|
11
|
-
from pyxllib.prog.pupil import check_install_package
|
12
|
-
|
13
|
-
check_install_package('oss2')
|
14
|
-
|
15
|
-
import oss2
|
16
|
-
|
17
|
-
from pyxllib.file.specialist import File
|
18
|
-
|
19
|
-
|
20
|
-
class OssBucket:
|
21
|
-
def __init__(self, bucket_name, endpoint, access_key_id, access_key_secret):
|
22
|
-
self.bucket = oss2.Bucket(oss2.Auth(access_key_id, access_key_secret), endpoint, bucket_name)
|
23
|
-
|
24
|
-
def upload(self, key, localfile, if_exists='replace', force=False):
|
25
|
-
""" 如果云端已存在,默认会进行覆盖
|
26
|
-
|
27
|
-
:param key: 上传后存储的文件名
|
28
|
-
:param localfile: 本地文件
|
29
|
-
:param if_exists:
|
30
|
-
replace, 如果oss上已存在也替换掉
|
31
|
-
ignore, 如果oss上已经存在则忽略
|
32
|
-
:param force: 是否在导入因意外失败后,重复上传,直到成功为止
|
33
|
-
False 时会报错终止程序
|
34
|
-
:return: 返回云端是否存在该文件(已存在或者上传后存在,都是True)
|
35
|
-
"""
|
36
|
-
done = False
|
37
|
-
while not done:
|
38
|
-
try:
|
39
|
-
e = self.check_exists(key)
|
40
|
-
if e and if_exists == 'ignore': return True
|
41
|
-
oss2.resumable_upload(self.bucket, key, localfile)
|
42
|
-
done = True
|
43
|
-
except Exception as e:
|
44
|
-
print('如果一直弹出这一条,则要检查oss账号是否设置正确')
|
45
|
-
if not force:
|
46
|
-
raise e
|
47
|
-
return True
|
48
|
-
|
49
|
-
def check_exists(self, key):
|
50
|
-
""" 检查一个文件在oss是否存在
|
51
|
-
|
52
|
-
:param key:
|
53
|
-
:return: 存在返回 GetObjectResult 对象,不存在返回False
|
54
|
-
"""
|
55
|
-
try:
|
56
|
-
return self.bucket.get_object(key)
|
57
|
-
except oss2.exceptions.NoSuchKey:
|
58
|
-
return False
|
59
|
-
|
60
|
-
def download(self, key, localfile):
|
61
|
-
File(localfile).ensure_parent()
|
62
|
-
if self.check_exists(key):
|
63
|
-
return self.bucket.get_object_to_file(key, localfile)
|
64
|
-
else:
|
65
|
-
return None
|
66
|
-
|
67
|
-
def ObjectIterator(self, **kwargs):
|
68
|
-
""" 遍历某个目录下的所有文件(含子目录里的文件)
|
69
|
-
|
70
|
-
>> print(len(list(oss.ObjectIterator(prefix='histudy/tr/teacher/lateximage/'))))
|
71
|
-
"""
|
72
|
-
return oss2.ObjectIterator(self.bucket, **kwargs)
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Author : 陈坤泽
|
4
|
+
# @Email : 877362867@qq.com
|
5
|
+
# @Date : 2020/06/15
|
6
|
+
|
7
|
+
"""
|
8
|
+
oss2 · PyPI: https://pypi.org/project/oss2/
|
9
|
+
"""
|
10
|
+
|
11
|
+
from pyxllib.prog.pupil import check_install_package
|
12
|
+
|
13
|
+
check_install_package('oss2')
|
14
|
+
|
15
|
+
import oss2
|
16
|
+
|
17
|
+
from pyxllib.file.specialist import File
|
18
|
+
|
19
|
+
|
20
|
+
class OssBucket:
|
21
|
+
def __init__(self, bucket_name, endpoint, access_key_id, access_key_secret):
|
22
|
+
self.bucket = oss2.Bucket(oss2.Auth(access_key_id, access_key_secret), endpoint, bucket_name)
|
23
|
+
|
24
|
+
def upload(self, key, localfile, if_exists='replace', force=False):
|
25
|
+
""" 如果云端已存在,默认会进行覆盖
|
26
|
+
|
27
|
+
:param key: 上传后存储的文件名
|
28
|
+
:param localfile: 本地文件
|
29
|
+
:param if_exists:
|
30
|
+
replace, 如果oss上已存在也替换掉
|
31
|
+
ignore, 如果oss上已经存在则忽略
|
32
|
+
:param force: 是否在导入因意外失败后,重复上传,直到成功为止
|
33
|
+
False 时会报错终止程序
|
34
|
+
:return: 返回云端是否存在该文件(已存在或者上传后存在,都是True)
|
35
|
+
"""
|
36
|
+
done = False
|
37
|
+
while not done:
|
38
|
+
try:
|
39
|
+
e = self.check_exists(key)
|
40
|
+
if e and if_exists == 'ignore': return True
|
41
|
+
oss2.resumable_upload(self.bucket, key, localfile)
|
42
|
+
done = True
|
43
|
+
except Exception as e:
|
44
|
+
print('如果一直弹出这一条,则要检查oss账号是否设置正确')
|
45
|
+
if not force:
|
46
|
+
raise e
|
47
|
+
return True
|
48
|
+
|
49
|
+
def check_exists(self, key):
|
50
|
+
""" 检查一个文件在oss是否存在
|
51
|
+
|
52
|
+
:param key:
|
53
|
+
:return: 存在返回 GetObjectResult 对象,不存在返回False
|
54
|
+
"""
|
55
|
+
try:
|
56
|
+
return self.bucket.get_object(key)
|
57
|
+
except oss2.exceptions.NoSuchKey:
|
58
|
+
return False
|
59
|
+
|
60
|
+
def download(self, key, localfile):
|
61
|
+
File(localfile).ensure_parent()
|
62
|
+
if self.check_exists(key):
|
63
|
+
return self.bucket.get_object_to_file(key, localfile)
|
64
|
+
else:
|
65
|
+
return None
|
66
|
+
|
67
|
+
def ObjectIterator(self, **kwargs):
|
68
|
+
""" 遍历某个目录下的所有文件(含子目录里的文件)
|
69
|
+
|
70
|
+
>> print(len(list(oss.ObjectIterator(prefix='histudy/tr/teacher/lateximage/'))))
|
71
|
+
"""
|
72
|
+
return oss2.ObjectIterator(self.bucket, **kwargs)
|