bencode-rs 0.0.2a2__tar.gz → 0.0.2a3__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.
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/PKG-INFO +5 -6
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/leak.py +11 -4
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/pyproject.toml +1 -1
- bencode_rs-0.0.2a3/readme.md +17 -0
- bencode_rs-0.0.2a2/readme.md +0 -18
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.coveragerc +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.gitattributes +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.github/renovate.json +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.github/workflows/_build_wheels.yaml +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.github/workflows/build.yaml +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.github/workflows/release.yaml +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.github/workflows/tests.yaml +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/.gitignore +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/Cargo.lock +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/Cargo.toml +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/LICENSE +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/bench.py +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/bencode_rs/__init__.py +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/bencode_rs/__init__.pyi +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/rustfmt.toml +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/src/decode.rs +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/src/encode.rs +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/src/lib.rs +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/tests/fixtures/56507.torrent.bin +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/tests/fixtures/ubuntu-22.04.2-desktop-amd64.iso.torrent.bin +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/tests/test_1_encode.py +0 -0
- {bencode_rs-0.0.2a2 → bencode_rs-0.0.2a3}/tests/test_2_decode.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: bencode-rs
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2a3
|
|
4
4
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
5
5
|
Classifier: License :: OSI Approved :: MIT License
|
|
6
6
|
Classifier: Programming Language :: Rust
|
|
@@ -15,7 +15,7 @@ Keywords: bittorrent,bencode,p2p
|
|
|
15
15
|
Requires-Python: >=3.8, <4.0
|
|
16
16
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
17
|
|
|
18
|
-
# A bencode serialize/deserialize library
|
|
18
|
+
# A bencode serialize/deserialize library writte in Rust
|
|
19
19
|
|
|
20
20
|
## install
|
|
21
21
|
|
|
@@ -26,11 +26,10 @@ pip install bencode_rs
|
|
|
26
26
|
## basic usage
|
|
27
27
|
|
|
28
28
|
```python
|
|
29
|
-
import
|
|
29
|
+
import bencode_rs
|
|
30
30
|
|
|
31
|
-
assert
|
|
32
|
-
assert bencode2.bdecode(b"d4:spaml1:a1:bee", str_key=True) == {"spam": [b"a", b"b"]}
|
|
31
|
+
assert bencode_rs.bdecode(b"d4:spaml1:a1:bee") == {b"spam": [b"a", b"b"]}
|
|
33
32
|
|
|
34
|
-
assert
|
|
33
|
+
assert bencode_rs.bencode({'hello': 'world'}) == b'd5:hello5:worlde'
|
|
35
34
|
```
|
|
36
35
|
|
|
@@ -5,8 +5,7 @@ import tracemalloc
|
|
|
5
5
|
import gc
|
|
6
6
|
import secrets
|
|
7
7
|
|
|
8
|
-
from bencode_rs import BencodeEncodeError, bencode, bdecode,BencodeDecodeError
|
|
9
|
-
from bencode_rs import _bencode
|
|
8
|
+
from bencode_rs import BencodeEncodeError, bencode, bdecode, BencodeDecodeError
|
|
10
9
|
|
|
11
10
|
help(bencode)
|
|
12
11
|
help(bdecode)
|
|
@@ -16,16 +15,24 @@ sys.set_int_max_str_digits(20000)
|
|
|
16
15
|
tracemalloc.start()
|
|
17
16
|
|
|
18
17
|
while True:
|
|
18
|
+
|
|
19
|
+
class C:
|
|
20
|
+
pass
|
|
21
|
+
|
|
19
22
|
s = b"100:" + secrets.token_bytes(10)
|
|
20
23
|
# t = bencode([s, s, s])
|
|
21
24
|
# i = 0
|
|
22
25
|
for c in [i for i in range(5000)]:
|
|
23
26
|
# i += 1
|
|
24
|
-
bdecode(s)
|
|
25
27
|
try:
|
|
26
|
-
|
|
28
|
+
bdecode(s)
|
|
27
29
|
except BencodeDecodeError:
|
|
28
30
|
pass
|
|
31
|
+
try:
|
|
32
|
+
bencode([1, 2, "a", b"b", C(), None])
|
|
33
|
+
except TypeError:
|
|
34
|
+
pass
|
|
35
|
+
|
|
29
36
|
# bencode(True)
|
|
30
37
|
|
|
31
38
|
gc.collect()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# A bencode serialize/deserialize library writte in Rust
|
|
2
|
+
|
|
3
|
+
## install
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
pip install bencode_rs
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## basic usage
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
import bencode_rs
|
|
13
|
+
|
|
14
|
+
assert bencode_rs.bdecode(b"d4:spaml1:a1:bee") == {b"spam": [b"a", b"b"]}
|
|
15
|
+
|
|
16
|
+
assert bencode_rs.bencode({'hello': 'world'}) == b'd5:hello5:worlde'
|
|
17
|
+
```
|
bencode_rs-0.0.2a2/readme.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# A bencode serialize/deserialize library based on cython
|
|
2
|
-
|
|
3
|
-
## install
|
|
4
|
-
|
|
5
|
-
```shell
|
|
6
|
-
pip install bencode_rs
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## basic usage
|
|
10
|
-
|
|
11
|
-
```python
|
|
12
|
-
import bencode2
|
|
13
|
-
|
|
14
|
-
assert bencode2.bdecode(b"d4:spaml1:a1:bee") == {b"spam": [b"a", b"b"]}
|
|
15
|
-
assert bencode2.bdecode(b"d4:spaml1:a1:bee", str_key=True) == {"spam": [b"a", b"b"]}
|
|
16
|
-
|
|
17
|
-
assert bencode2.bencode({'hello': 'world'}) == b'd5:hello5:worlde'
|
|
18
|
-
```
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|