Skip to main content

Phi-Save-Codec-Bind-Python

Phi-Save-Codec 的 Python 绑定,用于解析和构建 Phigros 的云端存档格式。

安装

pip install phi_save_codec

使用

from phi_save_codec import PhiSaveCodec, PhiSaveCodecError

# 初始化编解码器
codec = PhiSaveCodec()

# 解析二进制数据
try:
    user_data = codec.parse_user(binary_data)
    print(user_data)
except PhiSaveCodecError as e:
    print(f"解析失败: {e}")

# 构建二进制数据
try:
    binary_data = codec.build_user(user_dict)
except PhiSaveCodecError as e:
    print(f"构建失败: {e}")

支持的操作

  • parse_user() / build_user() - 用户数据
  • parse_summary() / build_summary() - 摘要数据
  • parse_game_record() / build_game_record() - 游戏记录
  • parse_game_progress() / build_game_progress() - 游戏进度
  • parse_game_key() / build_game_key() - 游戏密钥
  • parse_settings() / build_settings() - 设置数据

异常处理

所有 API 方法在错误时抛出 PhiSaveCodecError 异常:

try:
    data = codec.parse_user(binary_data)
except PhiSaveCodecError as e:
    # 获取详细的错误信息
    print(f"错误: {e}")

内存管理

该库自动处理与 WASM 模块之间的内存管理,包括:

  • 分配和释放内存
  • 获取和清空错误信息
  • 确保在函数调用前后正确管理临时内存

依赖

  • msgpack - 数据序列化
  • wasmtime - WASM 运行时支持

Metadata

Release files for phi_save_codec 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phi_save_codec 0.4.0
File Size Uploaded
phi_save_codec-0.4.0.tar.gz 123.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phi_save_codec 0.4.0
File Interpreter ABI Platform
phi_save_codec-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 248.8 kB

Release files / phi_save_codec-0.4.0.tar.gz

Download URL phi_save_codec-0.4.0.tar.gz
Size 123.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5d27dd4ef9e32d9e9c6393e22cade885266eafe81d307b54dece9e57d7c96f58
BLAKE2b-256 checksum
How to use checksums
a9f1299716f2b52b0e5ba435ff3a1a7b392c0e145ecbe2bff4b1467cc2861ee4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.26.9 CPython/3.14.0 Windows/11

Release files / phi_save_codec-0.4.0-py3-none-any.whl

Download URL phi_save_codec-0.4.0-py3-none-any.whl
Size 125.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac4556f047e3a32e72ee1a94d065eb6b2ff466155c71521007885af640ddd587
BLAKE2b-256 checksum
How to use checksums
6a0ae1963c689b63ea1373ec311db9fe219d0e6a6f84de970ca3ebf9de435497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.26.9 CPython/3.14.0 Windows/11

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.2.3

2 release files

0.2.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page