upplib 3.2.9__tar.gz → 3.3.0__tar.gz

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 (30) hide show
  1. {upplib-3.2.9 → upplib-3.3.0}/PKG-INFO +1 -1
  2. {upplib-3.2.9 → upplib-3.3.0}/upplib/__init__.py +2 -0
  3. upplib-3.3.0/upplib/config_data.py +71 -0
  4. {upplib-3.2.9 → upplib-3.3.0}/upplib/index.py +0 -67
  5. {upplib-3.2.9 → upplib-3.3.0}/upplib.egg-info/PKG-INFO +1 -1
  6. {upplib-3.2.9 → upplib-3.3.0}/upplib.egg-info/SOURCES.txt +1 -0
  7. {upplib-3.2.9 → upplib-3.3.0}/LICENSE +0 -0
  8. {upplib-3.2.9 → upplib-3.3.0}/README.md +0 -0
  9. {upplib-3.2.9 → upplib-3.3.0}/pyproject.toml +0 -0
  10. {upplib-3.2.9 → upplib-3.3.0}/setup.cfg +0 -0
  11. {upplib-3.2.9 → upplib-3.3.0}/setup.py +0 -0
  12. {upplib-3.2.9 → upplib-3.3.0}/upplib/chart.py +0 -0
  13. {upplib-3.2.9 → upplib-3.3.0}/upplib/chart_html.py +0 -0
  14. {upplib-3.2.9 → upplib-3.3.0}/upplib/clean_up_msg.py +0 -0
  15. {upplib-3.2.9 → upplib-3.3.0}/upplib/common_package.py +0 -0
  16. {upplib-3.2.9 → upplib-3.3.0}/upplib/db.py +0 -0
  17. {upplib-3.2.9 → upplib-3.3.0}/upplib/file.py +0 -0
  18. {upplib-3.2.9 → upplib-3.3.0}/upplib/file_text.py +0 -0
  19. {upplib-3.2.9 → upplib-3.3.0}/upplib/format_data.py +0 -0
  20. {upplib-3.2.9 → upplib-3.3.0}/upplib/http_util.py +0 -0
  21. {upplib-3.2.9 → upplib-3.3.0}/upplib/mail.py +0 -0
  22. {upplib-3.2.9 → upplib-3.3.0}/upplib/mail_html.py +0 -0
  23. {upplib-3.2.9 → upplib-3.3.0}/upplib/markdown.py +0 -0
  24. {upplib-3.2.9 → upplib-3.3.0}/upplib/multi_thread.py +0 -0
  25. {upplib-3.2.9 → upplib-3.3.0}/upplib/query_log.py +0 -0
  26. {upplib-3.2.9 → upplib-3.3.0}/upplib/redis_tool.py +0 -0
  27. {upplib-3.2.9 → upplib-3.3.0}/upplib/util.py +0 -0
  28. {upplib-3.2.9 → upplib-3.3.0}/upplib.egg-info/dependency_links.txt +0 -0
  29. {upplib-3.2.9 → upplib-3.3.0}/upplib.egg-info/requires.txt +0 -0
  30. {upplib-3.2.9 → upplib-3.3.0}/upplib.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: upplib
3
- Version: 3.2.9
3
+ Version: 3.3.0
4
4
  Summary: util
5
5
  Author: Luck
6
6
  Author-email: wantwaterfish@gmail.com
@@ -10,6 +10,8 @@ from upplib.util import *
10
10
  from upplib.file import *
11
11
  from upplib.file_text import *
12
12
 
13
+ from upplib.config_data import *
14
+
13
15
  # 有关 图表的 html 代码的包
14
16
  from upplib.chart_html import *
15
17
  # 有关 图表的 操作类的包
@@ -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()
@@ -4,9 +4,6 @@ from typing import Any, Optional, Union
4
4
  from upplib.common_package import *
5
5
  from collections import defaultdict
6
6
 
7
- __CONFIG_PATH = '.upp.config'
8
-
9
- __CONFIG_PATH_BAK = '_upp.config'
10
7
 
11
8
  # 创建一个线程本地存储对象
12
9
  __THREAD_LOCAL_INDEX_DATA = threading.local()
@@ -565,70 +562,6 @@ def format_sorted_kv_string(data_obj: Any,
565
562
  return sep.join(result)
566
563
 
567
564
 
568
- # 将数据写入到 config 中
569
- def set_config_data(file_name: str = 'config',
570
- param: dict[str, Any] = None) -> None:
571
- set_data_in_user_home(file_name, {} if param is None else param)
572
-
573
-
574
- # 从 config 中获得 配置数据
575
- def get_config_data(file_name: str = 'config') -> dict[str, Any]:
576
- # print('get_config_data', file_name)
577
- config_data = get_data_from_user_home(file_name)
578
- # print('get_data_from_user_home', config_data)
579
- if not config_data:
580
- config_data = get_data_from_path(file_name)
581
- # print('get_data_from_path', config_data)
582
- return config_data
583
-
584
-
585
- # 在当前用户的主目录中, 获得指定文件的数据
586
- def get_data_from_user_home(file_name: str = 'config') -> dict[str, Any]:
587
- return get_data_from_path(file_name, os.path.expanduser("~"))
588
-
589
-
590
- # 将 data 数据,在当前用户的主目录中, 获得指定文件的数据
591
- def set_data_in_user_home(file_name: str = 'config',
592
- param: dict[str, Any] = None) -> None:
593
- set_data_in_path(file_name, {} if param is None else param, os.path.expanduser("~"))
594
-
595
-
596
- # 在当前的目录中, 获得指定文件的数据
597
- def get_data_from_path(file_name: str = 'config',
598
- file_path: str = None) -> dict[str, Any]:
599
- param = get_data_from_path_detail(file_name, file_path, __CONFIG_PATH)
600
- return param if param else get_data_from_path_detail(file_name, file_path, __CONFIG_PATH_BAK)
601
-
602
-
603
- def get_data_from_path_detail(file_name: str = 'config',
604
- file_path: str = None,
605
- path_name: str = __CONFIG_PATH) -> dict[str, Any]:
606
- config_path = file_path + '/' + path_name if file_path else path_name
607
- # print('config_path_1', config_path)
608
- if not os.path.exists(config_path):
609
- # print('config_path_2', config_path)
610
- return {}
611
- file_path = config_path + '/' + file_name + '.json'
612
- # print('config_path_3', file_path)
613
- if not os.path.exists(file_path):
614
- return {}
615
- # print('to_json_from_file', file_path)
616
- return to_json_from_file(file_path)
617
-
618
-
619
- # 在当前的目录中, 设置数据到指定路径下
620
- def set_data_in_path(file_name: str = 'config',
621
- param: str = None,
622
- file_path: str = '') -> None:
623
- config_path = file_path + '/' + __CONFIG_PATH
624
- if not os.path.exists(config_path):
625
- os.mkdir(config_path)
626
- file_path = config_path + '/' + file_name + '.json'
627
- text_file = open(file_path, 'w', encoding='utf-8')
628
- text_file.write(to_str({} if param is None else param))
629
- text_file.close()
630
-
631
-
632
565
  # 执行命令
633
566
  def exec_command(command: str = None) -> None:
634
567
  if command is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: upplib
3
- Version: 3.2.9
3
+ Version: 3.3.0
4
4
  Summary: util
5
5
  Author: Luck
6
6
  Author-email: wantwaterfish@gmail.com
@@ -7,6 +7,7 @@ upplib/chart.py
7
7
  upplib/chart_html.py
8
8
  upplib/clean_up_msg.py
9
9
  upplib/common_package.py
10
+ upplib/config_data.py
10
11
  upplib/db.py
11
12
  upplib/file.py
12
13
  upplib/file_text.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes