l0n0lc 0.10.3__tar.gz → 0.10.4__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.
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/PKG-INFO +18 -18
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/README.md +17 -17
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc/c/345/237/272/347/241/200/345/244/204/347/220/206.py +15 -3
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc/jit.py +23 -5
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc.egg-info/PKG-INFO +18 -18
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/pyproject.toml +1 -1
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/LICENSE +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc/StdList.py +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc/StdMap.py +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc/__init__.py +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc//347/274/226/350/257/221.py" +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc//351/200/232/347/224/250.py" +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc.egg-info/SOURCES.txt +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc.egg-info/dependency_links.txt +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/l0n0lc.egg-info/top_level.txt +0 -0
- {l0n0lc-0.10.3 → l0n0lc-0.10.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.4
|
4
4
|
Summary: 一个将python函数翻译为c++函数并运行的jit编译器
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -292,23 +292,23 @@ vv: 1
|
|
292
292
|
```bash
|
293
293
|
ls -al ./l0n0lcoutput
|
294
294
|
total 176
|
295
|
-
drwxr-xr-x 2 root root 4096 Oct 22 02:
|
296
|
-
drwxrwxrwx 11 1000 1000 4096 Oct 22 02:
|
297
|
-
-rw-r--r-- 1 root root 298 Oct 22 02:
|
298
|
-
-rw-r--r-- 1 root root 128 Oct 22 02:
|
299
|
-
-rw-r--r-- 1 root root 1944 Oct 22 02:
|
300
|
-
-rw-r--r-- 1 root root 167 Oct 22 02:
|
301
|
-
-rwxr-xr-x 1 root root 29000 Oct 22 02:
|
302
|
-
-rw-r--r-- 1 root root 1531 Oct 22 02:
|
303
|
-
-rw-r--r-- 1 root root 398 Oct 22 02:
|
304
|
-
-rwxr-xr-x 1 root root 41728 Oct 22 02:
|
305
|
-
-rw-r--r-- 1 root root 155 Oct 22 02:
|
306
|
-
-rw-r--r-- 1 root root 106 Oct 22 02:
|
307
|
-
-rwxr-xr-x 1 root root 15648 Oct 22 02:
|
308
|
-
-rw-r--r-- 1 root root 219 Oct 22 02:
|
309
|
-
-rw-r--r-- 1 root root 164 Oct 22 02:
|
310
|
-
-rwxr-xr-x 1 root root 15688 Oct 22 02:
|
311
|
-
-rwxr-xr-x 1 root root 17248 Oct 22 02:
|
295
|
+
drwxr-xr-x 2 root root 4096 Oct 22 02:51 .
|
296
|
+
drwxrwxrwx 11 1000 1000 4096 Oct 22 02:51 ..
|
297
|
+
-rw-r--r-- 1 root root 298 Oct 22 02:51 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.cpp
|
298
|
+
-rw-r--r-- 1 root root 128 Oct 22 02:51 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.h
|
299
|
+
-rw-r--r-- 1 root root 1944 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.cpp
|
300
|
+
-rw-r--r-- 1 root root 167 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.h
|
301
|
+
-rwxr-xr-x 1 root root 29000 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.so
|
302
|
+
-rw-r--r-- 1 root root 1531 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.cpp
|
303
|
+
-rw-r--r-- 1 root root 398 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.h
|
304
|
+
-rwxr-xr-x 1 root root 41728 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.so
|
305
|
+
-rw-r--r-- 1 root root 155 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.cpp
|
306
|
+
-rw-r--r-- 1 root root 106 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.h
|
307
|
+
-rwxr-xr-x 1 root root 15648 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.so
|
308
|
+
-rw-r--r-- 1 root root 219 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.cpp
|
309
|
+
-rw-r--r-- 1 root root 164 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.h
|
310
|
+
-rwxr-xr-x 1 root root 15688 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.so
|
311
|
+
-rwxr-xr-x 1 root root 17248 Oct 22 02:51 测试可执行文件
|
312
312
|
|
313
313
|
```
|
314
314
|
## 6. 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.cpp
|
@@ -282,23 +282,23 @@ vv: 1
|
|
282
282
|
```bash
|
283
283
|
ls -al ./l0n0lcoutput
|
284
284
|
total 176
|
285
|
-
drwxr-xr-x 2 root root 4096 Oct 22 02:
|
286
|
-
drwxrwxrwx 11 1000 1000 4096 Oct 22 02:
|
287
|
-
-rw-r--r-- 1 root root 298 Oct 22 02:
|
288
|
-
-rw-r--r-- 1 root root 128 Oct 22 02:
|
289
|
-
-rw-r--r-- 1 root root 1944 Oct 22 02:
|
290
|
-
-rw-r--r-- 1 root root 167 Oct 22 02:
|
291
|
-
-rwxr-xr-x 1 root root 29000 Oct 22 02:
|
292
|
-
-rw-r--r-- 1 root root 1531 Oct 22 02:
|
293
|
-
-rw-r--r-- 1 root root 398 Oct 22 02:
|
294
|
-
-rwxr-xr-x 1 root root 41728 Oct 22 02:
|
295
|
-
-rw-r--r-- 1 root root 155 Oct 22 02:
|
296
|
-
-rw-r--r-- 1 root root 106 Oct 22 02:
|
297
|
-
-rwxr-xr-x 1 root root 15648 Oct 22 02:
|
298
|
-
-rw-r--r-- 1 root root 219 Oct 22 02:
|
299
|
-
-rw-r--r-- 1 root root 164 Oct 22 02:
|
300
|
-
-rwxr-xr-x 1 root root 15688 Oct 22 02:
|
301
|
-
-rwxr-xr-x 1 root root 17248 Oct 22 02:
|
285
|
+
drwxr-xr-x 2 root root 4096 Oct 22 02:51 .
|
286
|
+
drwxrwxrwx 11 1000 1000 4096 Oct 22 02:51 ..
|
287
|
+
-rw-r--r-- 1 root root 298 Oct 22 02:51 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.cpp
|
288
|
+
-rw-r--r-- 1 root root 128 Oct 22 02:51 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.h
|
289
|
+
-rw-r--r-- 1 root root 1944 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.cpp
|
290
|
+
-rw-r--r-- 1 root root 167 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.h
|
291
|
+
-rwxr-xr-x 1 root root 29000 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.so
|
292
|
+
-rw-r--r-- 1 root root 1531 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.cpp
|
293
|
+
-rw-r--r-- 1 root root 398 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.h
|
294
|
+
-rwxr-xr-x 1 root root 41728 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.so
|
295
|
+
-rw-r--r-- 1 root root 155 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.cpp
|
296
|
+
-rw-r--r-- 1 root root 106 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.h
|
297
|
+
-rwxr-xr-x 1 root root 15648 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.so
|
298
|
+
-rw-r--r-- 1 root root 219 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.cpp
|
299
|
+
-rw-r--r-- 1 root root 164 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.h
|
300
|
+
-rwxr-xr-x 1 root root 15688 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.so
|
301
|
+
-rwxr-xr-x 1 root root 17248 Oct 22 02:51 测试可执行文件
|
302
302
|
|
303
303
|
```
|
304
304
|
## 6. 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.cpp
|
@@ -177,6 +177,10 @@ def py类型转c类型(类型, 类型实例=None):
|
|
177
177
|
raise Exception("不支持的类型", 类型, 类型实例)
|
178
178
|
|
179
179
|
|
180
|
+
class 列表内类型不一异常(Exception):
|
181
|
+
pass
|
182
|
+
|
183
|
+
|
180
184
|
class list初始化列表:
|
181
185
|
def __init__(
|
182
186
|
self,
|
@@ -206,7 +210,7 @@ def 从list构建初始化列表(value: List):
|
|
206
210
|
if all(类型[0] == 数据类型列表[0][0] for 类型 in 数据类型列表):
|
207
211
|
数据类型列表 = 数据类型列表[0]
|
208
212
|
else:
|
209
|
-
raise
|
213
|
+
raise key类型不一异常
|
210
214
|
|
211
215
|
return list初始化列表(初始化列表, 数据类型列表, len(value))
|
212
216
|
|
@@ -227,6 +231,14 @@ class dict初始化列表:
|
|
227
231
|
return self.代码
|
228
232
|
|
229
233
|
|
234
|
+
class key类型不一异常(Exception):
|
235
|
+
pass
|
236
|
+
|
237
|
+
|
238
|
+
class value类型不一异常(Exception):
|
239
|
+
pass
|
240
|
+
|
241
|
+
|
230
242
|
def 从dict构建初始化列表(value: dict):
|
231
243
|
code = []
|
232
244
|
key类型列表 = []
|
@@ -242,12 +254,12 @@ def 从dict构建初始化列表(value: dict):
|
|
242
254
|
if all(类型 == key类型列表[0] for 类型 in key类型列表):
|
243
255
|
key类型列表 = (key类型列表[0], k)
|
244
256
|
else:
|
245
|
-
raise
|
257
|
+
raise key类型不一异常
|
246
258
|
|
247
259
|
if all(类型 == value类型列表[0] for 类型 in value类型列表):
|
248
260
|
value类型列表 = (value类型列表[0], v)
|
249
261
|
else:
|
250
|
-
raise
|
262
|
+
raise value类型不一异常
|
251
263
|
|
252
264
|
# 构建初始化列表
|
253
265
|
初始化列表 = '{' + ','.join(code) + '}'
|
@@ -15,8 +15,14 @@ class 代码异常抛出器:
|
|
15
15
|
self.代码行 = 代码.split('\n')
|
16
16
|
|
17
17
|
def __call__(self, 错误信息: str, node: ast.stmt | ast.expr | ast.arg) -> Any:
|
18
|
-
|
19
|
-
|
18
|
+
print(f'\033[31m[错误]:{错误信息}\033[0m')
|
19
|
+
print(f'错误代码:')
|
20
|
+
print('```python')
|
21
|
+
print(self.代码行[node.lineno - 1][:node.col_offset], end='')
|
22
|
+
print(
|
23
|
+
f'\033[31m{self.代码行[node.lineno - 1][node.col_offset: node.end_col_offset]}\033[0m', end='')
|
24
|
+
print(self.代码行[node.lineno - 1][node.end_col_offset:])
|
25
|
+
print('```')
|
20
26
|
|
21
27
|
|
22
28
|
class py2cpp编译器(ast.NodeVisitor):
|
@@ -174,16 +180,28 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
174
180
|
|
175
181
|
if isinstance(value, ast.List):
|
176
182
|
l = [self.获取值(e) for e in value.elts]
|
177
|
-
|
183
|
+
try:
|
184
|
+
return 从list构建初始化列表(l)
|
185
|
+
except:
|
186
|
+
self.抛出代码异常(str(l) + ' 类型不相同!', value)
|
178
187
|
if isinstance(value, ast.Tuple):
|
179
188
|
l = [self.获取值(e) for e in value.elts]
|
180
189
|
if not self.正在构建参数:
|
181
|
-
|
190
|
+
try:
|
191
|
+
return 从list构建初始化列表(l)
|
192
|
+
except:
|
193
|
+
self.抛出代码异常(str(l) + ' 类型不相同!', value)
|
182
194
|
return tuple(l)
|
183
195
|
if isinstance(value, ast.Dict):
|
184
196
|
d = {self.获取值(k): self.获取值(v)
|
185
197
|
for k, v in zip(value.keys, value.values)}
|
186
|
-
|
198
|
+
try:
|
199
|
+
return 从dict构建初始化列表(d)
|
200
|
+
except key类型不一异常:
|
201
|
+
self.抛出代码异常(str(d.keys()) + ' 类型不相同!', value)
|
202
|
+
except value类型不一异常:
|
203
|
+
self.抛出代码异常(str(d.values()) + ' 类型不相同!', value)
|
204
|
+
return
|
187
205
|
|
188
206
|
if isinstance(value, ast.Call):
|
189
207
|
return self.调用Call(value)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.4
|
4
4
|
Summary: 一个将python函数翻译为c++函数并运行的jit编译器
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -292,23 +292,23 @@ vv: 1
|
|
292
292
|
```bash
|
293
293
|
ls -al ./l0n0lcoutput
|
294
294
|
total 176
|
295
|
-
drwxr-xr-x 2 root root 4096 Oct 22 02:
|
296
|
-
drwxrwxrwx 11 1000 1000 4096 Oct 22 02:
|
297
|
-
-rw-r--r-- 1 root root 298 Oct 22 02:
|
298
|
-
-rw-r--r-- 1 root root 128 Oct 22 02:
|
299
|
-
-rw-r--r-- 1 root root 1944 Oct 22 02:
|
300
|
-
-rw-r--r-- 1 root root 167 Oct 22 02:
|
301
|
-
-rwxr-xr-x 1 root root 29000 Oct 22 02:
|
302
|
-
-rw-r--r-- 1 root root 1531 Oct 22 02:
|
303
|
-
-rw-r--r-- 1 root root 398 Oct 22 02:
|
304
|
-
-rwxr-xr-x 1 root root 41728 Oct 22 02:
|
305
|
-
-rw-r--r-- 1 root root 155 Oct 22 02:
|
306
|
-
-rw-r--r-- 1 root root 106 Oct 22 02:
|
307
|
-
-rwxr-xr-x 1 root root 15648 Oct 22 02:
|
308
|
-
-rw-r--r-- 1 root root 219 Oct 22 02:
|
309
|
-
-rw-r--r-- 1 root root 164 Oct 22 02:
|
310
|
-
-rwxr-xr-x 1 root root 15688 Oct 22 02:
|
311
|
-
-rwxr-xr-x 1 root root 17248 Oct 22 02:
|
295
|
+
drwxr-xr-x 2 root root 4096 Oct 22 02:51 .
|
296
|
+
drwxrwxrwx 11 1000 1000 4096 Oct 22 02:51 ..
|
297
|
+
-rw-r--r-- 1 root root 298 Oct 22 02:51 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.cpp
|
298
|
+
-rw-r--r-- 1 root root 128 Oct 22 02:51 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.h
|
299
|
+
-rw-r--r-- 1 root root 1944 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.cpp
|
300
|
+
-rw-r--r-- 1 root root 167 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.h
|
301
|
+
-rwxr-xr-x 1 root root 29000 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_jit_all_ops_@c636865fefd2fd71.so
|
302
|
+
-rw-r--r-- 1 root root 1531 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.cpp
|
303
|
+
-rw-r--r-- 1 root root 398 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.h
|
304
|
+
-rwxr-xr-x 1 root root 41728 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_add_@469de6acaaabc570.so
|
305
|
+
-rw-r--r-- 1 root root 155 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.cpp
|
306
|
+
-rw-r--r-- 1 root root 106 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.h
|
307
|
+
-rwxr-xr-x 1 root root 15648 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test_other_fn_@75fdd928ab58a8e3.so
|
308
|
+
-rw-r--r-- 1 root root 219 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.cpp
|
309
|
+
-rw-r--r-- 1 root root 164 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.h
|
310
|
+
-rwxr-xr-x 1 root root 15688 Oct 22 02:51 c31f68e99ed4ce3c_hello_world.py_test编译的函数_@3bf4501e0408a243.so
|
311
|
+
-rwxr-xr-x 1 root root 17248 Oct 22 02:51 测试可执行文件
|
312
312
|
|
313
313
|
```
|
314
314
|
## 6. 6cbfb68e317eace4_测试可执行.py_可执行_@d82ed7910ac3268c.cpp
|
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
|