Python bindings to the Katsuba libraries in Rust
Project description
Katsuba
Python bindings to the Katsuba libraries.
Error handling
Most errors are represented either as native Python exceptions where it makes
sense, or as a katsuba.KatsubaError
for custom errors from the Rust side.
Bindings
katsuba.op
Bindings to core functionality from the katsuba-object-property
crate.
from katsuba.op import *
from katsuba.utils import string_id
# Open a type list from file system
type_list = TypeList.open("types.json")
# Configure serializer options
opts = SerializerOptions()
opts.flags |= STATEFUL_FLAGS
opts.shallow = False
# Construct the serializer
ser = Serializer(opts, type_list)
# Deserialize a file
with open("TemplateManifest.xml", "rb") as f:
manifest = f.read()
assert manifest[:4] == b"BINd"
manifest = ser.deserialize(manifest[4:])
# Make sure we deserialized the right object:
assert manifest.type_hash == string_id("class TemplateManifest")
# Iterate the templates in the resulting object:
for location in manifest["m_serializedTemplates"]:
print(f"Template {location['m_id']} at {location['m_filename']}")
katsuba.wad
Bindings to core functionality from the katsuba-wad
crate.
from katsuba.op import Serializer
from katsuba.wad import Archive
# See `katsuba.op` above.
s = Serializer(...)
# Open an archive memory-mapped:
a = Archive.mmap("/path/to/Root.wad")
print(f"{len(a)} files in archive!")
# Deserialize a file out of the given archive:
if "TemplateManifest.xml" in a:
a.deserialize("TemplateManifest.xml", s)
# Iterate over files in the archive and get their contents:
for path in a:
data = a[path]
# With a glob pattern for filtering files:
for path in a.iter_glob("ObjectData/**/*.xml"):
data = a[path]
katsuba.utils
Bindings to useful components from the katsuba-utils
crate.
For the time being, this features the hash functions djb2
and string_id
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file katsuba-0.1.1.tar.gz
.
File metadata
- Download URL: katsuba-0.1.1.tar.gz
- Upload date:
- Size: 48.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0df0b6f7b0a166ef30b9220b6801db157216a573ba4d9107b6bf150729d23375 |
|
MD5 | 444f13bb13f7b24e32b0a764aa669911 |
|
BLAKE2b-256 | fb4333f87bfe4b6820e2625b174eaa1f91814929a9bafbc4f6567b7372f24684 |
File details
Details for the file katsuba-0.1.1-cp310-abi3-win_amd64.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 694.7 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e14ec6a9aae67c519fc01a3aaac9571d1b5f42d5d6bef8cb7d79b5da311be37 |
|
MD5 | ab8329ba0d8c78266e8afea0806410df |
|
BLAKE2b-256 | a8b212a748a64727a0bc573a7c3d428ec5f1d8a5306c51082ea502de7c2b1cc7 |
File details
Details for the file katsuba-0.1.1-cp310-abi3-win32.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-win32.whl
- Upload date:
- Size: 628.6 kB
- Tags: CPython 3.10+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da509288923872794ce8b83257c76913e746983b0d1371243833f2c78a452ed4 |
|
MD5 | 966c5a02683e47e60b5978badcca42c8 |
|
BLAKE2b-256 | 656fab2390b2091396c5f94e71a6d36dd0046272d870ca6e6de1f4c077099f41 |
File details
Details for the file katsuba-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 728.1 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffe9fd39603f4fa0ebc23e99246bd911b0f32351f75c903d1313abbf2053e6ee |
|
MD5 | 141d932e751ded1df76e0c57dffe5410 |
|
BLAKE2b-256 | 11ec01944dfd6a9e5ef241211595f2d6e8d49317b17bf78c2102a350c472fbd4 |
File details
Details for the file katsuba-0.1.1-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 810.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07061684811f7f4793fa424d33f9a22db77e576c553da6431d87e8bb03d6d48a |
|
MD5 | dc5518f9b599d97613515afac6edd423 |
|
BLAKE2b-256 | b3cd410147513d9cc405d96d8c8219b359ea614e670b3c3e8dd049f5dcd4017d |
File details
Details for the file katsuba-0.1.1-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl
- Upload date:
- Size: 801.1 kB
- Tags: CPython 3.10+, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7b2b1c668a5bd6865801d10fba8fb9eac7b25b231586ea5d4bffe1f0ebd142 |
|
MD5 | 465677fecbddc7c7e8e776cbc7f9c0e0 |
|
BLAKE2b-256 | d29cb873d00238dc69a74364667f8ee7e2cbc4bf0c4d2a2653e8312d7f4ed970 |
File details
Details for the file katsuba-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 663.7 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 264b1d623b38ffe67db9d243f16e96afa4da1f7fde4247aa7eca951bc316c53f |
|
MD5 | cc4c897585c84f7a0cd401a0dc7a8479 |
|
BLAKE2b-256 | e9411937f10f1306cb341d8321696de1f436748eb677c5b802005c04186fe6a9 |
File details
Details for the file katsuba-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 750.6 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abcf84eb9c0f105a6978d432f5117f515abdca323d3fbe988995e9036c432fd6 |
|
MD5 | 1c707ac0f076e692d610470cc54121b8 |
|
BLAKE2b-256 | c87cff349549d9e670ffdc8246e60f69259d83cc6c9cbe8f29e1cab9dbaed466 |
File details
Details for the file katsuba-0.1.1-cp310-abi3-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: katsuba-0.1.1-cp310-abi3-macosx_10_7_x86_64.whl
- Upload date:
- Size: 774.4 kB
- Tags: CPython 3.10+, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b38df85b7099e8a79db7af24233e03c9a5b53949daceaec8598690446ae2fbc4 |
|
MD5 | df5795907aab5b533a0e56139fcff86e |
|
BLAKE2b-256 | 2bcb473c33073d92a48e31cc636fcca87899aca23152ffa08acf0244968af7ce |