bencode-rs 0.0.5__cp39-abi3-win32.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.
bencode_rs/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ from ._bencode import bencode, BencodeEncodeError, bdecode, BencodeDecodeError
2
+
3
+ __all__ = [
4
+ "bencode",
5
+ "BencodeEncodeError",
6
+ "bdecode",
7
+ "BencodeDecodeError",
8
+ ]
@@ -0,0 +1,7 @@
1
+ from typing import Any
2
+
3
+ def bencode(v: Any, /) -> bytes: ...
4
+ def bdecode(b: bytes, /) -> Any: ...
5
+
6
+ class BencodeEncodeError(Exception): ...
7
+ class BencodeDecodeError(Exception): ...
Binary file
bencode_rs/py.typed ADDED
File without changes
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.3
2
+ Name: bencode-rs
3
+ Version: 0.0.5
4
+ Classifier: Development Status :: 2 - Pre-Alpha
5
+ Classifier: License :: OSI Approved :: MIT License
6
+ Classifier: Programming Language :: Rust
7
+ Classifier: Programming Language :: Python :: Implementation :: CPython
8
+ License-File: LICENSE
9
+ Summary: a bencode parser build with pyo3
10
+ Keywords: bittorrent,bencode,p2p
11
+ Requires-Python: ~=3.9
12
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
13
+ Project-URL: Homepage, https://github.com/trim21/bencode-rs
14
+
15
+ # A bencode serialize/deserialize library written in Rust with pyo3
16
+
17
+ ## install
18
+
19
+ ```shell
20
+ pip install bencode-rs
21
+ ```
22
+
23
+ ## basic usage
24
+
25
+ ```python
26
+ import bencode_rs
27
+
28
+ assert bencode_rs.bdecode(b"d4:spaml1:a1:bee") == {b"spam": [b"a", b"b"]}
29
+
30
+ assert bencode_rs.bencode({'hello': 'world'}) == b'd5:hello5:worlde'
31
+ ```
32
+
33
+ ## Notice
34
+
35
+ ### decoding
36
+ there is no str/string in bencode, only bytes.
37
+ so we decode bencode bytes to python bytes, since it may not be a utf8 string.
38
+
39
+ ### encoding
40
+ we encode python `True` as int `1` and `False` as int 0.
41
+
@@ -0,0 +1,8 @@
1
+ bencode_rs-0.0.5.dist-info/METADATA,sha256=IARGrtxeGiQlq8x6QP8duuHQpz17Wp28v7ab1eD4sak,1075
2
+ bencode_rs-0.0.5.dist-info/WHEEL,sha256=zeGPdpImCS-wl8085UjomKNslaRinMgLT3_dEWE-qgY,90
3
+ bencode_rs-0.0.5.dist-info/licenses/LICENSE,sha256=EEoYi1hvWZLRB6rUABEsjEdCJ56eZs_20XL8mJO-SfA,1106
4
+ bencode_rs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ bencode_rs/__init__.py,sha256=Sge6chRy15JpbMOydCgaJabCo2mccBAcHUZikrKN9zg,184
6
+ bencode_rs/__init__.pyi,sha256=MR70Kr_exFQ8aV7njCzXNdOW6tlv9znvd8tvNuzpp50,188
7
+ bencode_rs/_bencode.pyd,sha256=1IOTxwMLoOzxcs9C5pi_WbMQj0g0YH560CZj-nUReLM,232960
8
+ bencode_rs-0.0.5.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.7.4)
3
+ Root-Is-Purelib: false
4
+ Tag: cp39-abi3-win32
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 trim21 <trim21.me@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.