Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

leanEthereum/leanSnappy

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leanSnappy

Pure Python implementation of Google's Snappy compression algorithm.

Installation

uv sync

Usage

from src import compress, decompress

# Compress data
data = b"Hello, World!" * 100
compressed = compress(data)

# Decompress data
original = decompress(compressed)
assert original == data

API

Core Functions

  • compress(data: bytes) -> bytes: Compress data using Snappy
  • decompress(data: bytes) -> bytes: Decompress Snappy-compressed data

Utilities

  • max_compressed_length(size: int) -> int: Maximum possible compressed size
  • get_uncompressed_length(data: bytes) -> int: Read uncompressed length from header
  • is_valid_compressed_data(data: bytes) -> bool: Quick validation check

Exceptions

  • SnappyDecompressionError: Raised when decompression fails

Development

# Install dependencies
uv sync

# Run tests
uv run pytest

# Run linter
uv run ruff check src/ tests/

# Format code
uv run ruff format src/ tests/

References

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.