hjxdl 0.3.33__py3-none-any.whl → 0.3.39__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.
hdl/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.3.33'
21
- __version_tuple__ = version_tuple = (0, 3, 33)
20
+ __version__ = version = '0.3.39'
21
+ __version_tuple__ = version_tuple = (0, 3, 39)
@@ -45,7 +45,7 @@ def measure_stream_performance(func):
45
45
 
46
46
  # 总时间计算
47
47
  end_time = time.time()
48
- total_time = end_time - start_time
48
+ total_time = end_time - first_char_time
49
49
  time_to_first_char = first_char_time - start_time if first_char_time else total_time
50
50
 
51
51
  # 每秒输出的字符数
@@ -18,6 +18,7 @@ def execute_code(code):
18
18
  # Execute the code in a subprocess for safety
19
19
  print(code)
20
20
  python_path = sys.executable # 获取当前 Python 解释器路径
21
+ python_path = sys.executable
21
22
  result = subprocess.run(
22
23
  [
23
24
  python_path, # 使用当前 conda 环境中的 Python
@@ -26,6 +27,13 @@ def execute_code(code):
26
27
  ],
27
28
  capture_output=True,
28
29
  text=True,
30
+ timeout=5,
31
+ python_path,
32
+ '-c',
33
+ code
34
+ ],
35
+ capture_output=True,
36
+ text=True,
29
37
  timeout=5,
30
38
  env={"PYTHONPATH": os.getcwd()}
31
39
  )
@@ -81,3 +89,63 @@ def count_character_occurrences(text, char):
81
89
  char = char.lower()
82
90
 
83
91
  return f"{text} 中 {char} 共出现了 {text.count(char)} 次。"
92
+
93
+ # import os
94
+ # import pty
95
+ # import subprocess
96
+ # # import sys
97
+
98
+ # def run_ollama_cmd(cmd: str):
99
+ # command = cmd.split(" ")
100
+ # # 定义要执行的命令
101
+ # # command = ["ollama", "create", ollama_model_name, "-f", ollama_model_file]
102
+ # # 创建伪终端
103
+ # master, slave = pty.openpty()
104
+
105
+ # # 运行命令
106
+ # process = subprocess.Popen(command, stdin=slave, stdout=slave, stderr=slave, text=True, close_fds=True)
107
+
108
+ # # 关闭 slave 端,让 master 端可以读取
109
+ # os.close(slave)
110
+
111
+ # # 处理动态进度条,避免重复输出
112
+ # seen_lines = set()
113
+ # while True:
114
+ # try:
115
+ # output = os.read(master, 1024).decode()
116
+ # if not output:
117
+ # break
118
+
119
+ # # 过滤重复的进度信息
120
+ # for line in output.split("\n"):
121
+ # if line.strip() and line not in seen_lines:
122
+ # seen_lines.add(line)
123
+ # print(line, flush=True) # 逐行打印
124
+ # except OSError:
125
+ # break
126
+
127
+ # # 等待进程结束
128
+ # process.wait()
129
+
130
+ def run_cmd(cmd: str):
131
+ """
132
+ Executes a command in a subprocess.
133
+
134
+ This function receives a command string, splits it into separate arguments,
135
+ and then executes it in a subprocess. The output of the subprocess is
136
+ neither redirected to stdout nor stderr.
137
+
138
+ Args:
139
+ cmd (str): The command to execute.
140
+
141
+ Returns:
142
+ None
143
+ """
144
+ command = cmd.split(" ")
145
+
146
+ # 直接执行命令,让 stdout 和 stderr 直接流式输出到终端
147
+ process = subprocess.Popen(command, stdout=None, stderr=None)
148
+
149
+ # 等待进程执行完
150
+ process.wait()
151
+
@@ -0,0 +1,49 @@
1
+ # import os
2
+ # import pty
3
+ # import subprocess
4
+ # # import sys
5
+
6
+ # def run_ollama_cmd(cmd: str):
7
+ # command = cmd.split(" ")
8
+ # # 定义要执行的命令
9
+ # # command = ["ollama", "create", ollama_model_name, "-f", ollama_model_file]
10
+ # # 创建伪终端
11
+ # master, slave = pty.openpty()
12
+
13
+ # # 运行命令
14
+ # process = subprocess.Popen(command, stdin=slave, stdout=slave, stderr=slave, text=True, close_fds=True)
15
+
16
+ # # 关闭 slave 端,让 master 端可以读取
17
+ # os.close(slave)
18
+
19
+ # # 处理动态进度条,避免重复输出
20
+ # seen_lines = set()
21
+ # while True:
22
+ # try:
23
+ # output = os.read(master, 1024).decode()
24
+ # if not output:
25
+ # break
26
+
27
+ # # 过滤重复的进度信息
28
+ # for line in output.split("\n"):
29
+ # if line.strip() and line not in seen_lines:
30
+ # seen_lines.add(line)
31
+ # print(line, flush=True) # 逐行打印
32
+ # except OSError:
33
+ # break
34
+
35
+ # # 等待进程结束
36
+ # process.wait()
37
+
38
+ import subprocess
39
+
40
+ def run_cmd(cmd: str):
41
+ command = cmd.split(" ")
42
+
43
+ # 直接执行命令,让 stdout 和 stderr 直接流式输出到终端
44
+ process = subprocess.Popen(command, stdout=None, stderr=None)
45
+
46
+ # 等待进程执行完
47
+ process.wait()
48
+
49
+ run_cmd("ollama push ictrek/qwen2.5:14b32ft")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: hjxdl
3
- Version: 0.3.33
3
+ Version: 0.3.39
4
4
  Summary: A collection of functions for Jupyter notebooks
5
5
  Home-page: https://github.com/huluxiaohuowa/hdl
6
6
  Author: Jianxing Hu
@@ -31,6 +31,7 @@ Dynamic: classifier
31
31
  Dynamic: description
32
32
  Dynamic: description-content-type
33
33
  Dynamic: home-page
34
+ Dynamic: license-file
34
35
  Dynamic: requires-dist
35
36
  Dynamic: requires-python
36
37
  Dynamic: summary
@@ -1,5 +1,5 @@
1
1
  hdl/__init__.py,sha256=GffnD0jLJdhkd-vo989v40N90sQbofkayRBwxc6TVhQ,72
2
- hdl/_version.py,sha256=ZxUpRkxGjsUn4L6yqM2Eq_du_OiStfoVUrd-eixyn44,513
2
+ hdl/_version.py,sha256=X3NJYp9_3dCmctRYb1tZdvHuuPikZELQ99611KxJNh4,513
3
3
  hdl/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  hdl/args/loss_args.py,sha256=s7YzSdd7IjD24rZvvOrxLLFqMZQb9YylxKeyelSdrTk,70
5
5
  hdl/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -122,14 +122,14 @@ hdl/utils/database_tools/connect.py,sha256=xCacGucKxlQUXs6AsNddpeECvdqT1180V1ZWq
122
122
  hdl/utils/database_tools/datetime.py,sha256=xqE2xNiOpADzX-R8_bM0bioJRF3Ay9Jp1CAG6dy6uVI,1202
123
123
  hdl/utils/database_tools/web.py,sha256=awJ8lafL-2KRjf3V1uuij8JIvX9U5fI8fLZKOkOvqtk,5771
124
124
  hdl/utils/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
- hdl/utils/decorators/llm.py,sha256=zjAKaGTE4UuMdNbmCMKDrEgWDQ8o6oPYYQgHVeAF78M,3110
125
+ hdl/utils/decorators/llm.py,sha256=PeoSrPLwTE8DRfjUdEXADjxK5FQH4Gd651_FgXEEdFE,3115
126
126
  hdl/utils/desc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
127
127
  hdl/utils/desc/func_desc.py,sha256=sHmVZZmV7Zgii--gnHqMs6fTb7HVkqTOf8Pl_0F6qlI,3808
128
128
  hdl/utils/desc/template.py,sha256=Kf_tbL-XkDCKNQ3UncbCuYEeUgXEa7kRVCf9TD2b8og,2526
129
129
  hdl/utils/desc/tools.py,sha256=tovV4sqjMBCHI6PG5YGJYBKpoXRhgYilzt77ZYTL7Jk,673
130
130
  hdl/utils/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
131
  hdl/utils/general/glob.py,sha256=Zuf7WHU0UdUPOs9UrhxmrCiMC8GrHxQU6n3mTThv6yc,1120
132
- hdl/utils/general/runners.py,sha256=x7QBolp3MrqNV6L4rB6Ueybr26bqkRFZTuXhY0SwyLk,3061
132
+ hdl/utils/general/runners.py,sha256=R0lhqABIuT43jEyjFkeio84e_PFfvAkszOP1FBlAnQ8,4927
133
133
  hdl/utils/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
134
  hdl/utils/llm/chat.py,sha256=q0zQmf-6DeSYOrC2qDn_QFOlILjRHU69eVRUn0eIIbA,26526
135
135
  hdl/utils/llm/chatgr.py,sha256=5F5PJHe8vz3iCfi4TT54DCLRi1UeJshECdVtgvvvao0,3696
@@ -137,14 +137,15 @@ hdl/utils/llm/embs.py,sha256=Tf0FOYrOFZp7qQpEPiSCXzlgyHH0X9HVTUtsup74a9E,7174
137
137
  hdl/utils/llm/extract.py,sha256=2sK_WJzmYIc8iuWaM9DA6Nw3_6q1O4lJ5pKpcZo-bBA,6512
138
138
  hdl/utils/llm/llama_chat.py,sha256=watcHGOaz-bv3x-yDucYlGk5f8FiqfFhwWogrl334fk,4387
139
139
  hdl/utils/llm/llm_wrapper.py,sha256=ZjmogEM0TrvlM83LG6l5t8CFnMThBWUmUOvA5WY9ODo,15309
140
+ hdl/utils/llm/ollama.py,sha256=uEdLsNAc6b56r37hNiE3nrd6oZ2lmQ0gYbVvOc9YVIM,1389
140
141
  hdl/utils/llm/vis.py,sha256=SSP6tOwKLq0hWcpM3twI9TitqzBmKjlcGrnXEWYlCzM,26055
141
142
  hdl/utils/llm/visrag.py,sha256=0i-VrxqgiV-J7R3VPshu9oc7-rKjFJOldYik3HDXj6M,10176
142
143
  hdl/utils/schedulers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
144
  hdl/utils/schedulers/norm_lr.py,sha256=bDwCmdEK-WkgxQMFBiMuchv8Mm7C0-GZJ6usm-PQk14,4461
144
145
  hdl/utils/weather/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
146
  hdl/utils/weather/weather.py,sha256=k11o6wM15kF8b9NMlEfrg68ak-SfSYLN3nOOflFUv-I,4381
146
- hjxdl-0.3.33.dist-info/LICENSE,sha256=lkMiSbeZHBQLB9LJEkS9-L3Z-LBC4yGnKrzHSG8RkPM,2599
147
- hjxdl-0.3.33.dist-info/METADATA,sha256=u_aCYfjadGcSfCmnDY8eQuic1GblWIA78DzSRrF6Nbc,1336
148
- hjxdl-0.3.33.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
149
- hjxdl-0.3.33.dist-info/top_level.txt,sha256=-kxwTM5JPhylp06z3zAVO3w6_h7wtBfBo2zgM6YZoTk,4
150
- hjxdl-0.3.33.dist-info/RECORD,,
147
+ hjxdl-0.3.39.dist-info/licenses/LICENSE,sha256=lkMiSbeZHBQLB9LJEkS9-L3Z-LBC4yGnKrzHSG8RkPM,2599
148
+ hjxdl-0.3.39.dist-info/METADATA,sha256=lGbo0pGz-o-TMwXK0Fa3NPke0werbwIaNasB3TuDqcY,1358
149
+ hjxdl-0.3.39.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
150
+ hjxdl-0.3.39.dist-info/top_level.txt,sha256=-kxwTM5JPhylp06z3zAVO3w6_h7wtBfBo2zgM6YZoTk,4
151
+ hjxdl-0.3.39.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (78.0.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5