upplib 3.2.8__py3-none-any.whl → 3.3.0__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.
- upplib/__init__.py +2 -0
- upplib/config_data.py +71 -0
- upplib/file_text.py +0 -3
- upplib/index.py +0 -68
- upplib/util.py +1 -2
- {upplib-3.2.8.dist-info → upplib-3.3.0.dist-info}/METADATA +1 -1
- {upplib-3.2.8.dist-info → upplib-3.3.0.dist-info}/RECORD +10 -9
- {upplib-3.2.8.dist-info → upplib-3.3.0.dist-info}/WHEEL +0 -0
- {upplib-3.2.8.dist-info → upplib-3.3.0.dist-info}/licenses/LICENSE +0 -0
- {upplib-3.2.8.dist-info → upplib-3.3.0.dist-info}/top_level.txt +0 -0
upplib/__init__.py
CHANGED
upplib/config_data.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from upplib import *
|
|
2
|
+
from upplib.common_package import *
|
|
3
|
+
from upplib.file import *
|
|
4
|
+
|
|
5
|
+
__CONFIG_PATH = '.upp.config'
|
|
6
|
+
|
|
7
|
+
__CONFIG_PATH_BAK = '_upp.config'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# 将数据写入到 config 中
|
|
11
|
+
def set_config_data(file_name: str = 'config',
|
|
12
|
+
param: dict[str, Any] = None) -> None:
|
|
13
|
+
set_data_in_user_home(file_name, {} if param is None else param)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# 从 config 中获得 配置数据
|
|
17
|
+
def get_config_data(file_name: str = 'config') -> dict[str, Any]:
|
|
18
|
+
# print('get_config_data', file_name)
|
|
19
|
+
config_data = get_data_from_user_home(file_name)
|
|
20
|
+
# print('get_data_from_user_home', config_data)
|
|
21
|
+
if not config_data:
|
|
22
|
+
config_data = get_data_from_path(file_name)
|
|
23
|
+
# print('get_data_from_path', config_data)
|
|
24
|
+
return config_data
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# 在当前用户的主目录中, 获得指定文件的数据
|
|
28
|
+
def get_data_from_user_home(file_name: str = 'config') -> dict[str, Any]:
|
|
29
|
+
return get_data_from_path(file_name, os.path.expanduser("~"))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# 将 data 数据,在当前用户的主目录中, 获得指定文件的数据
|
|
33
|
+
def set_data_in_user_home(file_name: str = 'config',
|
|
34
|
+
param: dict[str, Any] = None) -> None:
|
|
35
|
+
set_data_in_path(file_name, {} if param is None else param, os.path.expanduser("~"))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# 在当前的目录中, 获得指定文件的数据
|
|
39
|
+
def get_data_from_path(file_name: str = 'config',
|
|
40
|
+
file_path: str = None) -> dict[str, Any]:
|
|
41
|
+
param = get_data_from_path_detail(file_name, file_path, __CONFIG_PATH)
|
|
42
|
+
return param if param else get_data_from_path_detail(file_name, file_path, __CONFIG_PATH_BAK)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_data_from_path_detail(file_name: str = 'config',
|
|
46
|
+
file_path: str = None,
|
|
47
|
+
path_name: str = __CONFIG_PATH) -> dict[str, Any]:
|
|
48
|
+
config_path = file_path + '/' + path_name if file_path else path_name
|
|
49
|
+
# print('config_path_1', config_path)
|
|
50
|
+
if not os.path.exists(config_path):
|
|
51
|
+
# print('config_path_2', config_path)
|
|
52
|
+
return {}
|
|
53
|
+
file_path = config_path + '/' + file_name + '.json'
|
|
54
|
+
# print('config_path_3', file_path)
|
|
55
|
+
if not os.path.exists(file_path):
|
|
56
|
+
return {}
|
|
57
|
+
# print('to_json_from_file', file_path)
|
|
58
|
+
return to_json_from_file(file_path)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# 在当前的目录中, 设置数据到指定路径下
|
|
62
|
+
def set_data_in_path(file_name: str = 'config',
|
|
63
|
+
param: str = None,
|
|
64
|
+
file_path: str = '') -> None:
|
|
65
|
+
config_path = file_path + '/' + __CONFIG_PATH
|
|
66
|
+
if not os.path.exists(config_path):
|
|
67
|
+
os.mkdir(config_path)
|
|
68
|
+
file_path = config_path + '/' + file_name + '.json'
|
|
69
|
+
text_file = open(file_path, 'w', encoding='utf-8')
|
|
70
|
+
text_file.write(to_str({} if param is None else param))
|
|
71
|
+
text_file.close()
|
upplib/file_text.py
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
from upplib import *
|
|
2
|
-
from datetime import datetime, timezone, timedelta
|
|
3
|
-
from typing import Any, Optional, Union
|
|
4
2
|
from upplib.common_package import *
|
|
5
3
|
from upplib.file import get_file
|
|
6
|
-
from collections import defaultdict
|
|
7
4
|
|
|
8
5
|
|
|
9
6
|
def get_latest_file(file_path: str = None,
|
upplib/index.py
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
from upplib import *
|
|
2
|
-
from upplib.file_text import *
|
|
3
2
|
from datetime import datetime, timezone, timedelta
|
|
4
3
|
from typing import Any, Optional, Union
|
|
5
4
|
from upplib.common_package import *
|
|
6
5
|
from collections import defaultdict
|
|
7
6
|
|
|
8
|
-
__CONFIG_PATH = '.upp.config'
|
|
9
|
-
|
|
10
|
-
__CONFIG_PATH_BAK = '_upp.config'
|
|
11
7
|
|
|
12
8
|
# 创建一个线程本地存储对象
|
|
13
9
|
__THREAD_LOCAL_INDEX_DATA = threading.local()
|
|
@@ -566,70 +562,6 @@ def format_sorted_kv_string(data_obj: Any,
|
|
|
566
562
|
return sep.join(result)
|
|
567
563
|
|
|
568
564
|
|
|
569
|
-
# 将数据写入到 config 中
|
|
570
|
-
def set_config_data(file_name: str = 'config',
|
|
571
|
-
param: dict[str, Any] = None) -> None:
|
|
572
|
-
set_data_in_user_home(file_name, {} if param is None else param)
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
# 从 config 中获得 配置数据
|
|
576
|
-
def get_config_data(file_name: str = 'config') -> dict[str, Any]:
|
|
577
|
-
# print('get_config_data', file_name)
|
|
578
|
-
config_data = get_data_from_user_home(file_name)
|
|
579
|
-
# print('get_data_from_user_home', config_data)
|
|
580
|
-
if not config_data:
|
|
581
|
-
config_data = get_data_from_path(file_name)
|
|
582
|
-
# print('get_data_from_path', config_data)
|
|
583
|
-
return config_data
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
# 在当前用户的主目录中, 获得指定文件的数据
|
|
587
|
-
def get_data_from_user_home(file_name: str = 'config') -> dict[str, Any]:
|
|
588
|
-
return get_data_from_path(file_name, os.path.expanduser("~"))
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
# 将 data 数据,在当前用户的主目录中, 获得指定文件的数据
|
|
592
|
-
def set_data_in_user_home(file_name: str = 'config',
|
|
593
|
-
param: dict[str, Any] = None) -> None:
|
|
594
|
-
set_data_in_path(file_name, {} if param is None else param, os.path.expanduser("~"))
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
# 在当前的目录中, 获得指定文件的数据
|
|
598
|
-
def get_data_from_path(file_name: str = 'config',
|
|
599
|
-
file_path: str = None) -> dict[str, Any]:
|
|
600
|
-
param = get_data_from_path_detail(file_name, file_path, __CONFIG_PATH)
|
|
601
|
-
return param if param else get_data_from_path_detail(file_name, file_path, __CONFIG_PATH_BAK)
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
def get_data_from_path_detail(file_name: str = 'config',
|
|
605
|
-
file_path: str = None,
|
|
606
|
-
path_name: str = __CONFIG_PATH) -> dict[str, Any]:
|
|
607
|
-
config_path = file_path + '/' + path_name if file_path else path_name
|
|
608
|
-
# print('config_path_1', config_path)
|
|
609
|
-
if not os.path.exists(config_path):
|
|
610
|
-
# print('config_path_2', config_path)
|
|
611
|
-
return {}
|
|
612
|
-
file_path = config_path + '/' + file_name + '.json'
|
|
613
|
-
# print('config_path_3', file_path)
|
|
614
|
-
if not os.path.exists(file_path):
|
|
615
|
-
return {}
|
|
616
|
-
# print('to_json_from_file', file_path)
|
|
617
|
-
return to_json_from_file(file_path)
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
# 在当前的目录中, 设置数据到指定路径下
|
|
621
|
-
def set_data_in_path(file_name: str = 'config',
|
|
622
|
-
param: str = None,
|
|
623
|
-
file_path: str = '') -> None:
|
|
624
|
-
config_path = file_path + '/' + __CONFIG_PATH
|
|
625
|
-
if not os.path.exists(config_path):
|
|
626
|
-
os.mkdir(config_path)
|
|
627
|
-
file_path = config_path + '/' + file_name + '.json'
|
|
628
|
-
text_file = open(file_path, 'w', encoding='utf-8')
|
|
629
|
-
text_file.write(to_str({} if param is None else param))
|
|
630
|
-
text_file.close()
|
|
631
|
-
|
|
632
|
-
|
|
633
565
|
# 执行命令
|
|
634
566
|
def exec_command(command: str = None) -> None:
|
|
635
567
|
if command is None:
|
upplib/util.py
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
upplib/__init__.py,sha256=
|
|
1
|
+
upplib/__init__.py,sha256=nWtsWCkm9fxAT0JiJ22xd1kq1WD8tp8gbZanIyy5Wbo,862
|
|
2
2
|
upplib/chart.py,sha256=DEcfhr1HlWdITaPWTVlL0CVSr3GiJTV_bWyOPb1UoyA,27667
|
|
3
3
|
upplib/chart_html.py,sha256=39CTD2LbN7LNN3wtb3n-ojN2r_X7RJMWappPgiLSJG4,23144
|
|
4
4
|
upplib/clean_up_msg.py,sha256=yR4D2fIXOT8z9VpClfhBjVnjhexObgNZDhvPu5v_5Y4,19237
|
|
5
5
|
upplib/common_package.py,sha256=2-u66k4WbZnX6-PUaYy8wsblnz41nvtX4Hwo3J5hjO0,832
|
|
6
|
+
upplib/config_data.py,sha256=y-2S70V0jwXJXxXz2vsqCK--Heay27VnA7MGpO3a40o,2748
|
|
6
7
|
upplib/db.py,sha256=-3ZALQSzP92-zIhye6ckrXIctbHsVmwoLiCVOlTyDyo,7058
|
|
7
8
|
upplib/file.py,sha256=-IZ8NJq7iaOG0TZbTjpgZcDFNNR-wC0-78Nyt02PReM,8675
|
|
8
|
-
upplib/file_text.py,sha256=
|
|
9
|
+
upplib/file_text.py,sha256=5ELNmTUi1nT6SvzMKQsAQiIqV7G9tHtoJQFTknE5TcQ,43009
|
|
9
10
|
upplib/format_data.py,sha256=Qxq-OZ8v6HBRJ-tUcNFem1Imbauk3Y5qJTrAGT0CC4I,10153
|
|
10
11
|
upplib/http_util.py,sha256=8Xya5qpeCKGaglxKnirOlOnbnBU3K52FGV5Y9c8HH9k,16119
|
|
11
|
-
upplib/index.py,sha256=
|
|
12
|
+
upplib/index.py,sha256=8m1aDWEFa7_-hvsIToxFKz2VtxMNVrm1GyrQEbFF6aQ,23190
|
|
12
13
|
upplib/mail.py,sha256=pe1ZZlKsah_TiB_Ag3scgiIQegyOznul2awdHur2m4Y,7550
|
|
13
14
|
upplib/mail_html.py,sha256=W2_WT9WhFykmAFageboJ-6E0dnBHBGMG1vQlBb9__M8,4001
|
|
14
15
|
upplib/markdown.py,sha256=YXh2Rtb5gvZ755Ecr3r5FcMoDtd2YcqtOFHFv92jWOQ,5803
|
|
15
16
|
upplib/multi_thread.py,sha256=zOeWG5HGYIzwqiPvef-4ak5bzorf0S3q6Ht8wPit_M0,2705
|
|
16
17
|
upplib/query_log.py,sha256=m93f8wyZeatVs_PF8O5eyC6U5yJfohg7x6muXPUMOJA,9204
|
|
17
18
|
upplib/redis_tool.py,sha256=I1kOqBwfQWVIOAY-hQaaOn1Zrx8BNlK83u-pk4uHPCA,707
|
|
18
|
-
upplib/util.py,sha256=
|
|
19
|
-
upplib-3.
|
|
20
|
-
upplib-3.
|
|
21
|
-
upplib-3.
|
|
22
|
-
upplib-3.
|
|
23
|
-
upplib-3.
|
|
19
|
+
upplib/util.py,sha256=oCQ84njl96A8RGnMqFl3W-2mLZEqcBmpOrK-GDCTmWk,4633
|
|
20
|
+
upplib-3.3.0.dist-info/licenses/LICENSE,sha256=WI5JtXXhjcqnIcPllDA1ZtuxNnZ515xjElcILo7z28o,1073
|
|
21
|
+
upplib-3.3.0.dist-info/METADATA,sha256=K7tz9fFLwpsxpcXqJp4R_ocWH66MjF5Kb2qUtzcofl0,940
|
|
22
|
+
upplib-3.3.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
23
|
+
upplib-3.3.0.dist-info/top_level.txt,sha256=VwdHDDPP79e1LqtRu5_w30hHB4gT0zlj1weuQYOqFoA,7
|
|
24
|
+
upplib-3.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|