pycoze 0.1.28__py3-none-any.whl → 0.1.30__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.
pycoze/utils/__init__.py CHANGED
@@ -1 +1,2 @@
1
1
  from .arg import read_arg, read_params
2
+ from .text_or_file import to_text
@@ -0,0 +1,18 @@
1
+ import os
2
+ import chardet
3
+
4
+
5
+ def to_text(text_or_file: str):
6
+ if os.path.exists(text_or_file) and os.path.isfile(text_or_file):
7
+ # 自动检测文件编码
8
+ with open(text_or_file, "rb") as f:
9
+ raw_data = f.read()
10
+ result = chardet.detect(raw_data)
11
+ encoding = result["encoding"]
12
+
13
+ # 读取文件内容
14
+ with open(text_or_file, "r", encoding=encoding) as f:
15
+ input_text = f.read()
16
+ else:
17
+ input_text = text_or_file # 直接使用传入的文本
18
+ return input_text
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.28
3
+ Version: 0.1.30
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -18,10 +18,11 @@ pycoze/ui/base.py,sha256=nXNXRTZ5Tl1AQp5nfjzLvOVzt_1nLSCn2IOyfxAN_fc,1471
18
18
  pycoze/ui/color.py,sha256=cT9Ib8uNzkOKxyW0IwVj46o4LwdB1xgNCj1_Rou9d_4,854
19
19
  pycoze/ui/typ.py,sha256=NpT0FrbHvByOszBZMFtroRp7I7pN-38tYz_zPOPejF4,1723
20
20
  pycoze/ui/ui_def.py,sha256=CNFYH8NC-WYmbceIPpxsRr9H6O006pMKukx7U-BOE1Q,3744
21
- pycoze/utils/__init__.py,sha256=GMP9EhOsbRM0EfIzS2ll1fXKKSpY3zqpqkm66fPGBaM,39
21
+ pycoze/utils/__init__.py,sha256=KExBkotf23dr2NfTEouWke5nJB1q2IuDXgHrmuyd95k,73
22
22
  pycoze/utils/arg.py,sha256=VKinJRPiNw0TPvuRFwLg0Vz8u8HXx_ejGfOojfE9b_Y,706
23
- pycoze-0.1.28.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
24
- pycoze-0.1.28.dist-info/METADATA,sha256=Kp-ljnL1Qg-4fo9hHbn_KS7_coqSc-9sYZj7QS6Q4A4,719
25
- pycoze-0.1.28.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
26
- pycoze-0.1.28.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
27
- pycoze-0.1.28.dist-info/RECORD,,
23
+ pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
24
+ pycoze-0.1.30.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
25
+ pycoze-0.1.30.dist-info/METADATA,sha256=Rxxe7ZPK3boftwwAv_MNbySgDz9PNXdSj4sYsHRa7LQ,719
26
+ pycoze-0.1.30.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
27
+ pycoze-0.1.30.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
28
+ pycoze-0.1.30.dist-info/RECORD,,