pybase16384 0.3.5__cp310-cp310-win_amd64.whl → 0.3.6__cp310-cp310-win_amd64.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.
Potentially problematic release.
This version of pybase16384 might be problematic. Click here for more details.
- pybase16384/__init__.py +19 -1
- pybase16384/backends/cffi/__init__.py +69 -20
- pybase16384/backends/cffi/_core.pyd +0 -0
- pybase16384/backends/cffi/build.py +36 -0
- pybase16384/backends/cython/__init__.py +9 -0
- pybase16384/backends/cython/_core.c +3074 -769
- pybase16384/backends/cython/_core.pyd +0 -0
- pybase16384/backends/cython/_core.pyx +103 -6
- pybase16384/backends/cython/base16384.pxd +41 -0
- {pybase16384-0.3.5.dist-info → pybase16384-0.3.6.dist-info}/METADATA +1 -1
- pybase16384-0.3.6.dist-info/RECORD +16 -0
- pybase16384-0.3.5.dist-info/RECORD +0 -16
- {pybase16384-0.3.5.dist-info → pybase16384-0.3.6.dist-info}/LICENSE +0 -0
- {pybase16384-0.3.5.dist-info → pybase16384-0.3.6.dist-info}/WHEEL +0 -0
- {pybase16384-0.3.5.dist-info → pybase16384-0.3.6.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
@@ -6,18 +6,26 @@ from cpython.object cimport PyObject_HasAttrString
|
|
|
6
6
|
from libc.stdint cimport int32_t, uint8_t
|
|
7
7
|
|
|
8
8
|
from pybase16384.backends.cython.base16384 cimport (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
BASE16384_DECBUFSZ, BASE16384_ENCBUFSZ, BASE16384_FLAG_NOHEADER,
|
|
10
|
+
BASE16384_FLAG_SUM_CHECK_ON_REMAIN, BASE16384_SIMPLE_SUM_INIT_VALUE,
|
|
11
|
+
b14_decode, b14_decode_fd, b14_decode_fd_detailed, b14_decode_file,
|
|
12
|
+
b14_decode_file_detailed, b14_decode_len, b14_encode, b14_encode_fd,
|
|
13
|
+
b14_encode_fd_detailed, b14_encode_file, b14_encode_file_detailed,
|
|
14
|
+
b14_encode_len, base16384_err_fopen_input_file,
|
|
15
|
+
base16384_err_fopen_output_file, base16384_err_get_file_size,
|
|
16
|
+
base16384_err_invalid_commandline_parameter,
|
|
17
|
+
base16384_err_invalid_decoding_checksum, base16384_err_invalid_file_name,
|
|
18
|
+
base16384_err_map_input_file, base16384_err_ok,
|
|
19
|
+
base16384_err_open_input_file, base16384_err_read_file, base16384_err_t,
|
|
15
20
|
base16384_err_write_file, pybase16384_64bits)
|
|
16
21
|
|
|
17
22
|
from pathlib import Path
|
|
18
23
|
|
|
19
24
|
ENCBUFSZ = BASE16384_ENCBUFSZ
|
|
20
25
|
DECBUFSZ = BASE16384_DECBUFSZ
|
|
26
|
+
FLAG_NOHEADER = BASE16384_FLAG_NOHEADER
|
|
27
|
+
FLAG_SUM_CHECK_ON_REMAIN = BASE16384_FLAG_SUM_CHECK_ON_REMAIN
|
|
28
|
+
SIMPLE_SUM_INIT_VALUE = BASE16384_SIMPLE_SUM_INIT_VALUE
|
|
21
29
|
|
|
22
30
|
cdef inline bytes ensure_bytes(object inp):
|
|
23
31
|
if isinstance(inp, unicode):
|
|
@@ -211,6 +219,14 @@ cdef inline str err_to_str(base16384_err_t ret):
|
|
|
211
219
|
return "base16384_err_open_input_file"
|
|
212
220
|
elif ret == base16384_err_map_input_file:
|
|
213
221
|
return "base16384_err_map_input_file"
|
|
222
|
+
elif ret == base16384_err_read_file:
|
|
223
|
+
return "base16384_err_read_file"
|
|
224
|
+
elif ret == base16384_err_invalid_file_name:
|
|
225
|
+
return "base16384_err_invalid_file_name"
|
|
226
|
+
elif ret == base16384_err_invalid_commandline_parameter:
|
|
227
|
+
return "base16384_err_invalid_commandline_parameter"
|
|
228
|
+
elif ret == base16384_err_invalid_decoding_checksum:
|
|
229
|
+
return "base16384_err_invalid_decoding_checksum"
|
|
214
230
|
|
|
215
231
|
cpdef inline encode_local_file(object inp, object out):
|
|
216
232
|
cdef bytes inp_name = ensure_bytes(inp)
|
|
@@ -291,3 +307,84 @@ cpdef inline decode_fd(int inp, int out):
|
|
|
291
307
|
finally:
|
|
292
308
|
PyMem_Free(encbuf)
|
|
293
309
|
PyMem_Free(decbuf)
|
|
310
|
+
|
|
311
|
+
# detailed
|
|
312
|
+
cpdef inline encode_local_file_detailed(object inp, object out, int flag):
|
|
313
|
+
cdef bytes inp_name = ensure_bytes(inp)
|
|
314
|
+
cdef bytes out_name = ensure_bytes(out)
|
|
315
|
+
cdef const char * inp_name_ptr = <const char *> inp_name
|
|
316
|
+
cdef const char * out_name_ptr = <const char *> out_name
|
|
317
|
+
cdef char * encbuf = <char*>PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
|
|
318
|
+
if encbuf == NULL:
|
|
319
|
+
raise MemoryError
|
|
320
|
+
cdef char * decbuf = <char*>PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
|
|
321
|
+
if decbuf == NULL:
|
|
322
|
+
PyMem_Free(encbuf)
|
|
323
|
+
raise MemoryError
|
|
324
|
+
cdef base16384_err_t ret
|
|
325
|
+
try:
|
|
326
|
+
with nogil:
|
|
327
|
+
ret = b14_encode_file_detailed(inp_name_ptr, out_name_ptr, encbuf, decbuf, flag)
|
|
328
|
+
if ret != base16384_err_ok:
|
|
329
|
+
raise ValueError(err_to_str(ret))
|
|
330
|
+
finally:
|
|
331
|
+
PyMem_Free(encbuf)
|
|
332
|
+
PyMem_Free(decbuf)
|
|
333
|
+
|
|
334
|
+
cpdef inline decode_local_file_detailed(object inp, object out, int flag):
|
|
335
|
+
cdef bytes inp_name = ensure_bytes(inp)
|
|
336
|
+
cdef bytes out_name = ensure_bytes(out)
|
|
337
|
+
cdef const char * inp_name_ptr = <const char *> inp_name
|
|
338
|
+
cdef const char * out_name_ptr = <const char *> out_name
|
|
339
|
+
cdef char * encbuf = <char*>PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
|
|
340
|
+
if encbuf == NULL:
|
|
341
|
+
raise MemoryError
|
|
342
|
+
cdef char * decbuf = <char*>PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
|
|
343
|
+
if decbuf == NULL:
|
|
344
|
+
PyMem_Free(encbuf)
|
|
345
|
+
raise MemoryError
|
|
346
|
+
cdef base16384_err_t ret
|
|
347
|
+
try:
|
|
348
|
+
with nogil:
|
|
349
|
+
ret = b14_decode_file_detailed(inp_name_ptr, out_name_ptr, encbuf, decbuf, flag)
|
|
350
|
+
if ret != base16384_err_ok:
|
|
351
|
+
raise ValueError(err_to_str(ret))
|
|
352
|
+
finally:
|
|
353
|
+
PyMem_Free(encbuf)
|
|
354
|
+
PyMem_Free(decbuf)
|
|
355
|
+
|
|
356
|
+
cpdef inline encode_fd_detailed(int inp, int out, int flag):
|
|
357
|
+
cdef char * encbuf = <char *> PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
|
|
358
|
+
if encbuf == NULL:
|
|
359
|
+
raise MemoryError
|
|
360
|
+
cdef char * decbuf = <char *> PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
|
|
361
|
+
if decbuf == NULL:
|
|
362
|
+
PyMem_Free(encbuf)
|
|
363
|
+
raise MemoryError
|
|
364
|
+
cdef base16384_err_t ret
|
|
365
|
+
try:
|
|
366
|
+
with nogil:
|
|
367
|
+
ret = b14_encode_fd_detailed(inp, out, encbuf, decbuf, flag)
|
|
368
|
+
if ret != base16384_err_ok:
|
|
369
|
+
raise ValueError(err_to_str(ret))
|
|
370
|
+
finally:
|
|
371
|
+
PyMem_Free(encbuf)
|
|
372
|
+
PyMem_Free(decbuf)
|
|
373
|
+
|
|
374
|
+
cpdef inline decode_fd_detailed(int inp, int out, int flag):
|
|
375
|
+
cdef char * encbuf = <char *> PyMem_Malloc(<size_t>BASE16384_ENCBUFSZ)
|
|
376
|
+
if encbuf == NULL:
|
|
377
|
+
raise MemoryError
|
|
378
|
+
cdef char * decbuf = <char *> PyMem_Malloc(<size_t>BASE16384_DECBUFSZ)
|
|
379
|
+
if decbuf == NULL:
|
|
380
|
+
PyMem_Free(encbuf)
|
|
381
|
+
raise MemoryError
|
|
382
|
+
cdef base16384_err_t ret
|
|
383
|
+
try:
|
|
384
|
+
with nogil:
|
|
385
|
+
ret = b14_decode_fd_detailed(inp, out, encbuf, decbuf, flag)
|
|
386
|
+
if ret != base16384_err_ok:
|
|
387
|
+
raise ValueError(err_to_str(ret))
|
|
388
|
+
finally:
|
|
389
|
+
PyMem_Free(encbuf)
|
|
390
|
+
PyMem_Free(decbuf)
|
|
@@ -7,6 +7,11 @@ from libc.stdio cimport FILE
|
|
|
7
7
|
cdef extern from "base16384.h" nogil:
|
|
8
8
|
int BASE16384_ENCBUFSZ
|
|
9
9
|
int BASE16384_DECBUFSZ
|
|
10
|
+
|
|
11
|
+
int BASE16384_FLAG_NOHEADER
|
|
12
|
+
int BASE16384_FLAG_SUM_CHECK_ON_REMAIN
|
|
13
|
+
int BASE16384_SIMPLE_SUM_INIT_VALUE
|
|
14
|
+
|
|
10
15
|
ctypedef enum base16384_err_t:
|
|
11
16
|
base16384_err_ok
|
|
12
17
|
base16384_err_get_file_size
|
|
@@ -15,6 +20,10 @@ cdef extern from "base16384.h" nogil:
|
|
|
15
20
|
base16384_err_write_file
|
|
16
21
|
base16384_err_open_input_file
|
|
17
22
|
base16384_err_map_input_file
|
|
23
|
+
base16384_err_read_file
|
|
24
|
+
base16384_err_invalid_file_name
|
|
25
|
+
base16384_err_invalid_commandline_parameter
|
|
26
|
+
base16384_err_invalid_decoding_checksum
|
|
18
27
|
# encode_len calc min buf size to fill encode result
|
|
19
28
|
int b14_encode_len "base16384_encode_len" (int dlen)
|
|
20
29
|
# decode_len calc min buf size to fill decode result
|
|
@@ -22,9 +31,13 @@ cdef extern from "base16384.h" nogil:
|
|
|
22
31
|
|
|
23
32
|
# encode data and write result into buf
|
|
24
33
|
int b14_encode "base16384_encode" (const char* data, int dlen, char* buf)
|
|
34
|
+
|
|
35
|
+
int b14_encode_unsafe "base16384_encode_unsafe" (const char * data, int dlen, char * buf)
|
|
25
36
|
# decode data and write result into buf
|
|
26
37
|
int b14_decode "base16384_decode" (const char* data, int dlen, char* buf)
|
|
27
38
|
|
|
39
|
+
int b14_decode_unsafe "base16384_decode_unsafe"(const char * data, int dlen, char * buf)
|
|
40
|
+
|
|
28
41
|
base16384_err_t b14_encode_file "base16384_encode_file" (const char * input, const char * output, char * encbuf, char * decbuf)
|
|
29
42
|
base16384_err_t b14_decode_file "base16384_decode_file" (const char * input, const char * output, char * encbuf, char * decbuf)
|
|
30
43
|
|
|
@@ -43,6 +56,34 @@ cdef extern from "base16384.h" nogil:
|
|
|
43
56
|
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
44
57
|
base16384_err_t b14_decode_fd "base16384_decode_fd"(int input, int output, char* encbuf, char* decbuf)
|
|
45
58
|
|
|
59
|
+
# detailed
|
|
60
|
+
# base16384_encode_file_detailed encodes input file to output file.
|
|
61
|
+
# use `-` to specify stdin/stdout
|
|
62
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
63
|
+
base16384_err_t b14_encode_file_detailed "base16384_encode_file_detailed" (const char* input, const char* output, char* encbuf, char* decbuf, int flag)
|
|
64
|
+
|
|
65
|
+
# base16384_encode_fp_detailed encodes input file to output file.
|
|
66
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
67
|
+
base16384_err_t b14_encode_fp_detailed "base16384_encode_fp_detailed" (FILE* input, FILE* output, char* encbuf, char* decbuf, int flag)
|
|
68
|
+
|
|
69
|
+
# base16384_encode_fd_detailed encodes input fd to output fd.
|
|
70
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
71
|
+
base16384_err_t b14_encode_fd_detailed "base16384_encode_fd_detailed" (int input, int output, char* encbuf, char* decbuf, int flag)
|
|
72
|
+
|
|
73
|
+
# base16384_decode_file_detailed decodes input file to output file.
|
|
74
|
+
# use `-` to specify stdin/stdout
|
|
75
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
76
|
+
base16384_err_t b14_decode_file_detailed "base16384_decode_file_detailed" (const char* input, const char* output, char* encbuf, char* decbuf, int flag)
|
|
77
|
+
|
|
78
|
+
# base16384_decode_fp_detailed decodes input file to output file.
|
|
79
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
80
|
+
base16384_err_t b14_decode_fp_detailed "base16384_decode_fp_detailed" (FILE* input, FILE* output, char* encbuf, char* decbuf, int flag)
|
|
81
|
+
|
|
82
|
+
# base16384_decode_fd_detailed decodes input fd to output fd.
|
|
83
|
+
# encbuf & decbuf must be no less than BASE16384_ENCBUFSZ & BASE16384_DECBUFSZ
|
|
84
|
+
base16384_err_t b14_decode_fd_detailed "base16384_decode_fd_detailed" (int input, int output, char* encbuf, char* decbuf, int flag)
|
|
85
|
+
|
|
86
|
+
|
|
46
87
|
cdef extern from * nogil:
|
|
47
88
|
"""
|
|
48
89
|
#ifdef CPUBIT32
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pybase16384/__init__.py,sha256=ORhQHbG_JSqXq78YxjIaWxJpSzv84TVS7rgd2wQKpS0,3062
|
|
2
|
+
pybase16384/backends/__init__.py,sha256=9aG9WOI42Hcgaj9QGw99OIvKZTG-sYNlLBUctorc4Kg,56
|
|
3
|
+
pybase16384/backends/cffi/__init__.py,sha256=5Uk7Il3xmAkj9HxhbB1OdXE2Cslc0rDuIYcfDrLQcug,9774
|
|
4
|
+
pybase16384/backends/cffi/_core.pyd,sha256=ujQz_cbPeV-XuWfXytpSI5LYwoLoIhBWfJ1ytF7qN1o,37888
|
|
5
|
+
pybase16384/backends/cffi/build.py,sha256=DXOVlPcnnjNFt11n3TSeiMd5OUbdcm3bbylDQppy-mo,4539
|
|
6
|
+
pybase16384/backends/cython/__init__.py,sha256=b3qH9k-e72aqwxdZHfR-PipQNzvBFGWq9uiX6v_PfuI,578
|
|
7
|
+
pybase16384/backends/cython/_core.c,sha256=7WXWJg1wJV3E7rMLUsfmSFPdNW7zvMJ6uic7H_zEiTM,1393181
|
|
8
|
+
pybase16384/backends/cython/_core.pxi,sha256=SPgwG7QKofRYdJDRrhx2TWRvOuBuwTjRGg2WvGUrQw4,542
|
|
9
|
+
pybase16384/backends/cython/_core.pyd,sha256=BHSQmY7YllltbcCYFYGKqjHy4NqytsMeyfM2nmSrxXU,190976
|
|
10
|
+
pybase16384/backends/cython/_core.pyx,sha256=mWb4dr-hEjp1QPI37mU_lyJyUohHYxacCPyPbmAjP5U,15765
|
|
11
|
+
pybase16384/backends/cython/base16384.pxd,sha256=ZIOMla80PKuWAIUZIFsJh4b7rzjfHxxaa-VEQ9CQe5E,4749
|
|
12
|
+
pybase16384-0.3.6.dist-info/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
|
|
13
|
+
pybase16384-0.3.6.dist-info/METADATA,sha256=ASRzCwkCUBoHKlPqlv1GT5P1dNjhILV4Yetdp4oM_w8,5539
|
|
14
|
+
pybase16384-0.3.6.dist-info/WHEEL,sha256=jrOhEbqKwvzRFSJcbYXlJCyVkgVdHg4_7__YHrdTUfw,102
|
|
15
|
+
pybase16384-0.3.6.dist-info/top_level.txt,sha256=kXpl7pWjnjpm74qJP0SJg3JhbiWuwKQApJgkJH0B5Mk,12
|
|
16
|
+
pybase16384-0.3.6.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
pybase16384/__init__.py,sha256=l9vuFXikNNKgrtNT-Ix6EPQwc-G_QipKoHaYzSlVtIQ,2540
|
|
2
|
-
pybase16384/backends/__init__.py,sha256=9aG9WOI42Hcgaj9QGw99OIvKZTG-sYNlLBUctorc4Kg,56
|
|
3
|
-
pybase16384/backends/cffi/__init__.py,sha256=FZdJJtnYanH8-3Lls_UPjm0xOicDOofwrOziIPHBUk8,7604
|
|
4
|
-
pybase16384/backends/cffi/_core.pyd,sha256=Zd5kc4GWvTMR-cwbKUvbSpWfMpkb9TetyWZyx8lrDsY,27136
|
|
5
|
-
pybase16384/backends/cffi/build.py,sha256=YNZh1_n6d5WMvqEEgvx3MyY8GeeR0mavjiJ9i6-xpP4,3095
|
|
6
|
-
pybase16384/backends/cython/__init__.py,sha256=zoKnXRa8Zz5ZsMFj_8cjveOZ0XJfpx5Ic7jmub2d8ec,353
|
|
7
|
-
pybase16384/backends/cython/_core.c,sha256=3CpP9r0tvL2IQzf2vHe8f76s3mUJo_Bt9hu_z9zpEsA,1296347
|
|
8
|
-
pybase16384/backends/cython/_core.pxi,sha256=SPgwG7QKofRYdJDRrhx2TWRvOuBuwTjRGg2WvGUrQw4,542
|
|
9
|
-
pybase16384/backends/cython/_core.pyd,sha256=yDn2FHUXmtxGnRucX6TiJbUC8tJijk_5SbQoWGU8FNM,177664
|
|
10
|
-
pybase16384/backends/cython/_core.pyx,sha256=VYqH9aNFqavFZRC7-VoW7S8WwvaJITXTjo9tjI7LFy8,11775
|
|
11
|
-
pybase16384/backends/cython/base16384.pxd,sha256=IiicckRLe7L9Pi6-OuPC6PIpQgqzzHRsJUcHyKQ5uRI,2326
|
|
12
|
-
pybase16384-0.3.5.dist-info/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
|
|
13
|
-
pybase16384-0.3.5.dist-info/METADATA,sha256=pssEzcLOnmL8WmuNZ0v_4JEV16k8xHAJsHTrRwhnxhI,5539
|
|
14
|
-
pybase16384-0.3.5.dist-info/WHEEL,sha256=jrOhEbqKwvzRFSJcbYXlJCyVkgVdHg4_7__YHrdTUfw,102
|
|
15
|
-
pybase16384-0.3.5.dist-info/top_level.txt,sha256=kXpl7pWjnjpm74qJP0SJg3JhbiWuwKQApJgkJH0B5Mk,12
|
|
16
|
-
pybase16384-0.3.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|