upplib 3.2.1__tar.gz → 3.2.2__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 (29) hide show
  1. {upplib-3.2.1 → upplib-3.2.2}/PKG-INFO +1 -1
  2. {upplib-3.2.1 → upplib-3.2.2}/upplib/file.py +55 -56
  3. {upplib-3.2.1 → upplib-3.2.2}/upplib.egg-info/PKG-INFO +1 -1
  4. {upplib-3.2.1 → upplib-3.2.2}/LICENSE +0 -0
  5. {upplib-3.2.1 → upplib-3.2.2}/README.md +0 -0
  6. {upplib-3.2.1 → upplib-3.2.2}/pyproject.toml +0 -0
  7. {upplib-3.2.1 → upplib-3.2.2}/setup.cfg +0 -0
  8. {upplib-3.2.1 → upplib-3.2.2}/setup.py +0 -0
  9. {upplib-3.2.1 → upplib-3.2.2}/upplib/__init__.py +0 -0
  10. {upplib-3.2.1 → upplib-3.2.2}/upplib/chart.py +0 -0
  11. {upplib-3.2.1 → upplib-3.2.2}/upplib/chart_html.py +0 -0
  12. {upplib-3.2.1 → upplib-3.2.2}/upplib/clean_up_msg.py +0 -0
  13. {upplib-3.2.1 → upplib-3.2.2}/upplib/common_package.py +0 -0
  14. {upplib-3.2.1 → upplib-3.2.2}/upplib/db.py +0 -0
  15. {upplib-3.2.1 → upplib-3.2.2}/upplib/file_text.py +0 -0
  16. {upplib-3.2.1 → upplib-3.2.2}/upplib/format_data.py +0 -0
  17. {upplib-3.2.1 → upplib-3.2.2}/upplib/http_util.py +0 -0
  18. {upplib-3.2.1 → upplib-3.2.2}/upplib/index.py +0 -0
  19. {upplib-3.2.1 → upplib-3.2.2}/upplib/mail.py +0 -0
  20. {upplib-3.2.1 → upplib-3.2.2}/upplib/mail_html.py +0 -0
  21. {upplib-3.2.1 → upplib-3.2.2}/upplib/markdown.py +0 -0
  22. {upplib-3.2.1 → upplib-3.2.2}/upplib/multi_thread.py +0 -0
  23. {upplib-3.2.1 → upplib-3.2.2}/upplib/query_log.py +0 -0
  24. {upplib-3.2.1 → upplib-3.2.2}/upplib/redis_tool.py +0 -0
  25. {upplib-3.2.1 → upplib-3.2.2}/upplib/util.py +0 -0
  26. {upplib-3.2.1 → upplib-3.2.2}/upplib.egg-info/SOURCES.txt +0 -0
  27. {upplib-3.2.1 → upplib-3.2.2}/upplib.egg-info/dependency_links.txt +0 -0
  28. {upplib-3.2.1 → upplib-3.2.2}/upplib.egg-info/requires.txt +0 -0
  29. {upplib-3.2.1 → upplib-3.2.2}/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.1
3
+ Version: 3.2.2
4
4
  Summary: util
5
5
  Author: Luck
6
6
  Author-email: wantwaterfish@gmail.com
@@ -3,30 +3,30 @@ from upplib.index import *
3
3
 
4
4
 
5
5
  def get_file(file_path: str = None,
6
- path_prefix: str = None,
7
- prefix: str = None,
6
+ path_startswith: str = None,
7
+ startswith: str = None,
8
8
  path_contain: str = None,
9
9
  contain: str = None,
10
10
  sort_asc: bool | None = True,
11
- path_suffix: str = None,
12
- suffix: str = None) -> list[str]:
11
+ path_endswith: str = None,
12
+ endswith: str = None) -> list[str]:
13
13
  """
14
14
  有关文件的操作
15
15
  查询指定文件夹下面的所有的文件信息, 也可以是指定的文件
16
- file_path : 文件路径
17
- path_prefix : 文件路径,以 prefix 开头
18
- prefix : 文件名称,以 prefix 开头
19
- path_contain : 文件路径,含有
20
- contain : 文件名称,含有
21
- sort_asc : 是否按升序排序,也就是从小到大排序
22
- path_suffix : 文件路径,以 suffix 结尾
23
- suffix : 文件名称,以 suffix 结尾
16
+ file_path : 文件路径
17
+ path_startswith : 文件路径,以 path_startswith 开头
18
+ startswith : 文件名称,以 startswith 开头
19
+ path_contain : 文件路径,含有
20
+ contain : 文件名称,含有
21
+ sort_asc : 是否按升序排序,也就是从小到大排序
22
+ path_endswith : 文件路径,以 path_endswith 结尾
23
+ endswith : 文件名称,以 endswith 结尾
24
24
  return list
25
25
  """
26
26
  if file_path is None:
27
27
  file_path = os.path.dirname(os.path.abspath('.'))
28
28
  list_data = []
29
- get_file_all(file_path, list_data, path_prefix, prefix, path_contain, contain, path_suffix, suffix)
29
+ get_file_all(file_path, list_data, path_startswith, startswith, path_contain, contain, path_endswith, endswith)
30
30
  # 去一下重复的数据
31
31
  r_list = list(set(list_data))
32
32
  if sort_asc is not None:
@@ -50,30 +50,30 @@ def get_file_folder(file_name_one: str = None) -> str:
50
50
 
51
51
 
52
52
  def remove_folder_file(file_path: str = None,
53
- path_prefix: str = None,
54
- prefix: str = None,
53
+ path_startswith: str = None,
54
+ startswith: str = None,
55
55
  path_contain: str = None,
56
56
  contain: str = None,
57
- path_suffix: str = None,
58
- suffix: str = None):
57
+ path_endswith: str = None,
58
+ endswith: str = None):
59
59
  """
60
60
  删除指定文件夹下面的指定的文件
61
61
  """
62
62
  file_part_all_list = get_file(file_path=file_path,
63
- path_prefix=path_prefix,
64
- prefix=prefix,
63
+ path_startswith=path_startswith,
64
+ startswith=startswith,
65
65
  path_contain=path_contain,
66
66
  contain=contain,
67
- path_suffix=path_suffix,
68
- suffix=suffix)
67
+ path_endswith=path_endswith,
68
+ endswith=endswith)
69
69
  for file_part_all_one in file_part_all_list:
70
70
  os.remove(file_part_all_one)
71
71
 
72
72
 
73
73
  def get_folder(file_path: str = None,
74
- prefix: str = None,
74
+ startswith: str = None,
75
75
  contain: str = None,
76
- suffix: str = None) -> list[str]:
76
+ endswith: str = None) -> list[str]:
77
77
  """
78
78
  有关文件的操作, 只查询文件夹
79
79
  查询指定文件夹下面的所有的文件信息, 也可以是指定的文件
@@ -83,17 +83,17 @@ def get_folder(file_path: str = None,
83
83
  if file_path is None:
84
84
  file_path = os.path.dirname(os.path.abspath('.'))
85
85
  list_data = []
86
- get_folder_all(file_path, list_data, prefix, contain, suffix)
86
+ get_folder_all(file_path, list_data, startswith, contain, endswith)
87
87
  # 去一下重复的数据
88
88
  return list(set(list_data))
89
89
 
90
90
 
91
91
  # 是否包含指定的文件
92
92
  def contain_file(file_path: str = None,
93
- prefix: str = None,
93
+ startswith: str = None,
94
94
  contain: str = None,
95
- suffix: str = None) -> bool:
96
- return len(get_file(file_path, prefix, contain, suffix)) > 0
95
+ endswith: str = None) -> bool:
96
+ return len(get_file(file_path, startswith, contain, endswith)) > 0
97
97
 
98
98
 
99
99
  def get_file_data_line(file_path: str = None,
@@ -125,78 +125,77 @@ def get_file_data_line(file_path: str = None,
125
125
  # 查询指定文件夹下面的所有的文件信息, 也可以是指定的文件
126
126
  def get_file_all(file_path: str = None,
127
127
  list_data: list = None,
128
- path_prefix: str = None,
129
- prefix: str = None,
128
+ path_startswith: str = None,
129
+ startswith: str = None,
130
130
  path_contain: str = None,
131
131
  contain: str = None,
132
- path_suffix: str = None,
133
- suffix: str = None) -> None:
132
+ path_endswith: str = None,
133
+ endswith: str = None) -> None:
134
134
  if os.path.isdir(file_path):
135
135
  for root, dir_names, file_names in os.walk(file_path):
136
136
  for file_name in file_names:
137
- if (get_file_check(os.path.join(root, file_name), path_prefix, path_contain, path_suffix)
138
- and get_file_check(file_name, prefix, contain, suffix)):
137
+ if (get_file_check(os.path.join(root, file_name), path_startswith, path_contain, path_endswith)
138
+ and get_file_check(file_name, startswith, contain, endswith)):
139
139
  list_data.append(os.path.join(root, file_name))
140
140
  for dir_name in dir_names:
141
- get_file_all(os.path.join(root, dir_name), list_data, path_prefix, prefix, path_contain, contain, path_suffix, suffix)
142
- elif (get_file_check(file_path, prefix, contain, suffix)
143
- and get_file_check(file_path, path_prefix, path_contain, path_suffix)):
141
+ get_file_all(os.path.join(root, dir_name), list_data, path_startswith, startswith, path_contain, contain, path_endswith, endswith)
142
+ elif (get_file_check(file_path, startswith, contain, endswith)
143
+ and get_file_check(file_path, path_startswith, path_contain, path_endswith)):
144
144
  list_data.append(file_path)
145
145
 
146
146
 
147
147
  # 查询指定文件夹下面的所有的文件信息, 也可以是指定的文件
148
148
  def get_folder_all(file_path: str = None,
149
149
  list_data: list = None,
150
- prefix: str = None,
150
+ startswith: str = None,
151
151
  contain: str = None,
152
- suffix: str = None) -> None:
152
+ endswith: str = None) -> None:
153
153
  if os.path.isdir(file_path):
154
154
  for root, dir_names, file_names in os.walk(file_path):
155
155
  for dir_name in dir_names:
156
156
  dir_name_path = os.path.join(root, dir_name)
157
- if get_file_check(dir_name_path, prefix, contain, suffix):
157
+ if get_file_check(dir_name_path, startswith, contain, endswith):
158
158
  list_data.append(dir_name_path)
159
159
  else:
160
- get_folder_all(dir_name_path, list_data, prefix, contain, suffix)
160
+ get_folder_all(dir_name_path, list_data, startswith, contain, endswith)
161
161
 
162
162
 
163
- def get_file_check(
164
- name: str = None,
165
- prefix: str = None,
166
- contain: str = None,
167
- suffix: str = None) -> bool:
163
+ def get_file_check(name: str = None,
164
+ startswith: str = None,
165
+ contain: str = None,
166
+ endswith: str = None) -> bool:
168
167
  """
169
168
  检查文件是否符合要求
170
- prefix : 前缀
171
- contain : 包含这个字符
172
- suffix : 后缀
169
+ startswith : 以这个开头
170
+ contain : 包含这个字符
171
+ endswith : 以这个结尾
173
172
  """
174
173
  if name is None or name == '':
175
174
  return False
176
175
  p = True
177
176
  c = True
178
177
  s = True
179
- if prefix is not None:
180
- p = name.startswith(prefix)
178
+ if startswith is not None:
179
+ p = name.startswith(startswith)
181
180
  if contain is not None:
182
181
  c = name.find(contain) > -1
183
- if suffix is not None:
184
- s = name.endswith(suffix)
182
+ if endswith is not None:
183
+ s = name.endswith(endswith)
185
184
  return p and c and s
186
185
 
187
186
 
188
187
  def find_file_by_content(file_path: str = '',
189
188
  contain_txt: str = None,
190
- prefix: str = None,
189
+ startswith: str = None,
191
190
  contain: str = None,
192
- suffix: str = None) -> bool | None:
191
+ endswith: str = None) -> bool | None:
193
192
  """
194
193
  检查文件内容是否包含指定的字符串
195
194
  慎用,否则, 执行时间可能比较长
196
195
  """
197
- list_file = get_file(file_path, prefix, contain, suffix)
196
+ list_file = get_file(file_path, startswith, contain, endswith)
198
197
  if len(list_file) == 0:
199
- to_log(f'no_matched_file : {file_path} , {contain_txt} , {prefix} , {contain} , {suffix}')
198
+ to_log(f'no_matched_file : {file_path} , {contain_txt} , {startswith} , {contain} , {endswith}')
200
199
  return False
201
200
  if contain_txt is None:
202
201
  to_log(list_file)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: upplib
3
- Version: 3.2.1
3
+ Version: 3.2.2
4
4
  Summary: util
5
5
  Author: Luck
6
6
  Author-email: wantwaterfish@gmail.com
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
File without changes