ezKit 3.0.7__tar.gz → 3.0.8__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.
- {ezkit-3.0.7/ezKit.egg-info → ezkit-3.0.8}/PKG-INFO +1 -1
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit/utils.py +9 -12
- {ezkit-3.0.7 → ezkit-3.0.8/ezKit.egg-info}/PKG-INFO +1 -1
- {ezkit-3.0.7 → ezkit-3.0.8}/setup.py +1 -1
- {ezkit-3.0.7 → ezkit-3.0.8}/LICENSE +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/MANIFEST.in +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/README.md +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit/__init__.py +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit/database.py +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit/sendemail.py +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit.egg-info/SOURCES.txt +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit.egg-info/dependency_links.txt +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit.egg-info/requires.txt +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/ezKit.egg-info/top_level.txt +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/pyproject.toml +0 -0
- {ezkit-3.0.7 → ezkit-3.0.8}/setup.cfg +0 -0
|
@@ -252,6 +252,8 @@ def parent_dir(path: str, **kwargs) -> str | None:
|
|
|
252
252
|
def read_small_file(file_path) -> list[str] | None:
|
|
253
253
|
"""读取小文件"""
|
|
254
254
|
|
|
255
|
+
# 建议: 10MB 以内
|
|
256
|
+
|
|
255
257
|
try:
|
|
256
258
|
|
|
257
259
|
with open(file_path, "r", encoding="utf-8") as _file:
|
|
@@ -270,17 +272,12 @@ def read_small_file(file_path) -> list[str] | None:
|
|
|
270
272
|
def read_large_file(file_path):
|
|
271
273
|
"""读取大文件"""
|
|
272
274
|
|
|
273
|
-
|
|
275
|
+
# 建议: 10MB 以上
|
|
274
276
|
|
|
275
|
-
|
|
276
|
-
for line in _file:
|
|
277
|
-
clean_line = line.strip()
|
|
278
|
-
if clean_line:
|
|
279
|
-
yield clean_line
|
|
280
|
-
|
|
281
|
-
except Exception as e:
|
|
277
|
+
# 这里不要使用 try ... except ...
|
|
282
278
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
279
|
+
with open(file_path, "r", encoding="utf-8") as _file:
|
|
280
|
+
for line in _file:
|
|
281
|
+
clean_line = line.strip()
|
|
282
|
+
if clean_line:
|
|
283
|
+
yield clean_line
|
|
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
|