pybase16384 0.3.8__cp313-cp313-macosx_11_0_arm64.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.

@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.2
2
+ Name: pybase16384
3
+ Version: 0.3.8
4
+ Summary: fast base16384 encode and decode
5
+ Home-page: https://github.com/synodriver/pybase16384
6
+ Author: synodriver
7
+ Author-email: diguohuangjiajinweijun@gmail.com
8
+ License: GPLv3
9
+ Keywords: encode,decode,base16384
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Classifier: Programming Language :: C
15
+ Classifier: Programming Language :: Cython
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: Implementation :: CPython
23
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
24
+ Requires-Python: >=3.6
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: cffi>=1.0.0
28
+ Dynamic: author
29
+ Dynamic: author-email
30
+ Dynamic: classifier
31
+ Dynamic: description
32
+ Dynamic: description-content-type
33
+ Dynamic: home-page
34
+ Dynamic: keywords
35
+ Dynamic: license
36
+ Dynamic: requires-dist
37
+ Dynamic: requires-python
38
+ Dynamic: summary
39
+
40
+ <h1 align="center"><i>✨ pybase16384 ✨ </i></h1>
41
+
42
+ <h3 align="center">The python binding for <a href="https://github.com/fumiama/base16384">base16384</a> </h3>
43
+
44
+ <h3 align="center"><i>一种神奇的编码 </i></h3>
45
+
46
+ [![pypi](https://img.shields.io/pypi/v/pybase16384.svg)](https://pypi.org/project/pybase16384/)
47
+ ![python](https://img.shields.io/pypi/pyversions/pybase16384)
48
+ ![implementation](https://img.shields.io/pypi/implementation/pybase16384)
49
+ ![wheel](https://img.shields.io/pypi/wheel/pybase16384)
50
+ ![license](https://img.shields.io/github/license/synodriver/pybase16384.svg)
51
+ ![action](https://img.shields.io/github/workflow/status/synodriver/pybase16384/build%20wheel)
52
+
53
+
54
+ ### 使用
55
+
56
+ - 编码/解码文本
57
+ ```python
58
+ >>> import pybase16384 as pybs
59
+ >>> pybs.encode_string('hello!!')
60
+ '栙擆羼漡'
61
+ >>> pybs.decode_string('栙擆羼漡')
62
+ 'hello!!'
63
+ ```
64
+
65
+ - 编码文件
66
+
67
+ ```python
68
+ from io import BytesIO
69
+
70
+ import pybase16384 as pybs
71
+
72
+ with open("input.pcm", "rb") as f:
73
+ data = f.read()
74
+ for i in range(1):
75
+ pybs.encode_file(BytesIO(data), open("output2.pcm", 'wb'), True)
76
+ ```
77
+ - 解码文件
78
+
79
+ ```python
80
+ from io import BytesIO
81
+
82
+ import pybase16384 as pybs
83
+
84
+ with open("output2.pcm", "rb") as f:
85
+ data = f.read()
86
+ for i in range(1):
87
+ pybs.decode_file(BytesIO(data), open("input2.pcm", 'wb'))
88
+ ```
89
+
90
+ ### 公开函数
91
+ ```python
92
+ from typing import IO
93
+
94
+ def encode_len(dlen: int) -> int: ...
95
+
96
+ def decode_len(dlen: int, offset: int) -> int: ...
97
+
98
+ ENCBUFSZ: int
99
+ DECBUFSZ: int
100
+ FLAG_NOHEADER: int
101
+ FLAG_SUM_CHECK_ON_REMAIN: int
102
+ FLAG_DO_SUM_CHECK_FORCELY: int
103
+
104
+ def is_64bits() -> bool: ...
105
+
106
+ def encode_file(input: IO, output: IO, write_head: bool = ..., buf_rate: int = ...): ...
107
+
108
+ def encode_file_safe(input: IO, output: IO, write_head: bool = ..., buf_rate: int = ...): ...
109
+
110
+ def decode_file(input: IO, output: IO, buf_rate: int = ...): ...
111
+
112
+ def decode_file_safe(input: IO, output: IO, buf_rate: int = ...): ...
113
+
114
+ def ensure_bytes(inp) -> bytes: ...
115
+
116
+ def encode_local_file(inp, out) -> None: ...
117
+
118
+ def decode_local_file(inp, out) -> None: ...
119
+
120
+ def encode_fd(inp: int, out: int) -> None: ...
121
+
122
+ def decode_fd(inp: int, out: int) -> None: ...
123
+
124
+ def encode_local_file_detailed(inp, out, flag: int) -> None: ...
125
+
126
+ def decode_local_file_detailed(inp, out, flag: int) -> None: ...
127
+
128
+ def encode_fd_detailed(inp: int, out: int, flag: int) -> None: ...
129
+
130
+ def decode_fd_detailed(inp: int, out: int, flag: int) -> None: ...
131
+
132
+ def encode(data: bytes) -> bytes: ...
133
+
134
+ def encode_safe(data: bytes) -> bytes: ...
135
+
136
+ def decode(data: bytes) -> bytes: ...
137
+
138
+ def decode_safe(data: bytes) -> bytes: ...
139
+
140
+ def encode_from_string(data: str, write_head: bool = ...) -> bytes: ...
141
+
142
+ def encode_from_string_safe(data: str, write_head: bool = ...) -> bytes: ...
143
+
144
+ def encode_to_string(data: bytes) -> str: ...
145
+
146
+ def encode_to_string_safe(data: bytes) -> str: ...
147
+
148
+ def encode_string(data: str) -> str: ...
149
+
150
+ def encode_string_safe(data: str) -> str: ...
151
+
152
+ def decode_from_bytes(data: bytes) -> str: ...
153
+
154
+ def decode_from_bytes_safe(data: bytes) -> str: ...
155
+
156
+ def decode_from_string(data: str) -> bytes: ...
157
+
158
+ def decode_from_string_safe(data: str) -> bytes: ...
159
+
160
+ def decode_string(data: str) -> str: ...
161
+
162
+ def decode_string_safe(data: str) -> str: ...
163
+
164
+ def encode_stream_detailed(inp, out, flag: int): ...
165
+
166
+ def decode_stream_detailed(inp, out, flag: int): ...
167
+ ```
168
+ - write_head将显式指明编码出的文本格式(utf16be),以便文本编辑器(如记事本)能够正确渲染,一般在写入文件时使用。
169
+
170
+ - buf_rate指定读取文件的策略。当它为n时,则表示一次读取7n或者8n个字节。如果读到的字节长度小于预期,则说明长度不够,
171
+ 此时,n将减半,恢复文件指针,重新读取。如果当n=1时长度仍然不够,就地encode/decode处理之。
172
+
173
+ - ```encode_len```和```decode_len```用于计算输出的长度
174
+
175
+ ### 内部函数
176
+
177
+ - 他们直接来自底层的C库,高性能,但是一般不需要在外部使用(除非是增加性能)
178
+
179
+ ```python
180
+ def _encode(data: BufferProtocol) -> bytes: ...
181
+
182
+ def _encode_safe(data: BufferProtocol) -> bytes: ...
183
+
184
+ def _decode(data: BufferProtocol) -> bytes: ...
185
+
186
+ def _decode_safe(data: BufferProtocol) -> bytes: ...
187
+
188
+ def _encode_into(data: BufferProtocol, dest: BufferProtocol) -> int: ...
189
+
190
+ def _encode_into_safe(data: BufferProtocol, dest: BufferProtocol) -> int: ...
191
+
192
+ def _decode_into(data: BufferProtocol, dest: BufferProtocol) -> int: ...
193
+
194
+ def _decode_into_safe(data: BufferProtocol, dest: BufferProtocol) -> int: ...
195
+
196
+ def is_64bits() -> bool: ...
197
+ ```
198
+ - ```_decode```在解码```b'='```开头的数据时***不安全***:***解释器异常***
199
+ - ```_encode_into```和```_decode_into```直接操作缓冲区对象的底层指针,0拷贝,当然也和上面一样的问题,他们是没有检查的
200
+
201
+ ### ✨ v0.3更新 ✨
202
+ 融合了 [CFFI](https://github.com/synodriver/pybase16384-cffi) 版本的成果,现在一个包可以同时在cpython和pypy上运行
203
+
204
+ ### 本机编译
205
+ ```
206
+ python -m pip install setuptools wheel cython cffi
207
+ git clone https://github.com/synodriver/pybase16384
208
+ cd pybase16384
209
+ git submodule update --init --recursive
210
+ python setup.py bdist_wheel --use-cython --use-cffi
211
+ ```
212
+ - 为了在windows上编译,需要加点料,把 [这个](https://gist.github.com/synodriver/8f1afae7b1a221754cb04ce417dc7e4d) 放进msvc的目录
213
+
214
+ ### 后端选择
215
+ 默认由py实现决定,在cpython上自动选择cython后端,在pypy上自动选择cffi后端,使用```B14_USE_CFFI```环境变量可以强制选择cffi
@@ -0,0 +1,16 @@
1
+ pybase16384/__init__.py,sha256=xDOQ59rGsfkEhlODtzpqltiJmvTOMYT0puEhW6w8DBo,4897
2
+ pybase16384/backends/__init__.py,sha256=vdW_t1O2WNfdRmxDlEXRvTpyJj5ufKWAUsD2fbtku5g,55
3
+ pybase16384/backends/cffi/build.py,sha256=NyTK_W4JKJbqtdAS0yZ0sxkQvLDE8npjOskWN1-YOqk,5824
4
+ pybase16384/backends/cffi/__init__.py,sha256=oGen7JI3AMlvsCjM8xF4k6zBK2v_QqQ5UsrdMVtD_Zo,15970
5
+ pybase16384/backends/cffi/_core.abi3.so,sha256=ZbZUBk4gkwQN60FswD9K8derkmHX4D-8jujknvxDbNo,90464
6
+ pybase16384/backends/cython/_core.c,sha256=Co0qxbDmNKtX39tTxGMB2Sh5zYdExvPFvUeGVq3X5C8,1558557
7
+ pybase16384/backends/cython/__init__.py,sha256=iqaf2DeavB1x_LnQi949Qqkrn00KAwG9xJMPVUdnIB8,738
8
+ pybase16384/backends/cython/base16384.pxd,sha256=HFGuEe2rXBWYw1vx74uaI7YATtkRGpcUAjANMRxPRFA,5942
9
+ pybase16384/backends/cython/_core.abi3.so,sha256=8FgWQDtKHbBf7D7q1fYWnd7R0GGLrVjcHNUe1nkFeaI,266784
10
+ pybase16384/backends/cython/_core.pyx,sha256=OcY07Gk5n-9snqRCFrVTU-WhI8k1yiD6zcutRD5G1Dk,25159
11
+ pybase16384/backends/cython/_core.pxi,sha256=2fXuRiumLqxO0bnmZVEz0lr_GX-grJGBfhGIVedfyt8,530
12
+ pybase16384-0.3.8.dist-info/RECORD,,
13
+ pybase16384-0.3.8.dist-info/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
14
+ pybase16384-0.3.8.dist-info/WHEEL,sha256=zEwrEM3mH_qOUQ9uk3aZI5DMOaUao9_e1G94mKtHrTY,109
15
+ pybase16384-0.3.8.dist-info/top_level.txt,sha256=kXpl7pWjnjpm74qJP0SJg3JhbiWuwKQApJgkJH0B5Mk,12
16
+ pybase16384-0.3.8.dist-info/METADATA,sha256=HKwiEO0_m8J4u1QmjLLz1c2j2ymgAgh4eNZJ58t_frA,6836
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-macosx_11_0_arm64
5
+
@@ -0,0 +1 @@
1
+ pybase16384