ezKit 3.0.6__tar.gz → 3.0.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 3.0.6
3
+ Version: 3.0.7
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -249,12 +249,13 @@ def parent_dir(path: str, **kwargs) -> str | None:
249
249
  # --------------------------------------------------------------------------------------------------
250
250
 
251
251
 
252
- def read_text(path: str) -> str | None:
253
- """Read Text"""
252
+ def read_small_file(file_path) -> list[str] | None:
253
+ """读取小文件"""
254
254
 
255
255
  try:
256
256
 
257
- return Path(path).read_text(encoding="utf-8").strip()
257
+ with open(file_path, "r", encoding="utf-8") as _file:
258
+ return [clean_line for line in _file if (clean_line := line.strip())]
258
259
 
259
260
  except Exception as e:
260
261
 
@@ -264,3 +265,22 @@ def read_text(path: str) -> str | None:
264
265
  logger.error(e)
265
266
 
266
267
  return None
268
+
269
+
270
+ def read_large_file(file_path):
271
+ """读取大文件"""
272
+
273
+ try:
274
+
275
+ with open(file_path, "r", encoding="utf-8") as _file:
276
+ for line in _file:
277
+ clean_line = line.strip()
278
+ if clean_line:
279
+ yield clean_line
280
+
281
+ except Exception as e:
282
+
283
+ if DEBUG:
284
+ logger.exception(e)
285
+ else:
286
+ logger.error(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 3.0.6
3
+ Version: 3.0.7
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
4
4
 
5
5
  setup(
6
6
  name="ezKit",
7
- version="3.0.6",
7
+ version="3.0.7",
8
8
  author="septvean",
9
9
  author_email="septvean@gmail.com",
10
10
  description="Easy Kit",
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