tessl install tessl/pypi-pillow-heif@1.1.0Python interface for libheif library providing HEIF/AVIF image processing with both standalone and Pillow plugin capabilities
Agent Success
Agent success rate when using this tile
94%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.45x
Baseline
Agent success rate without this tile
65%
Build a simple cache system that stores HEIF image data for quick retrieval.
Create a Python module that implements a cache for HEIF images using file-based serialization. The cache should allow storing and retrieving HEIF images efficiently.
Implement a CacheManager class with the following functionality:
The cache should preserve:
@generates
class CacheManager:
"""Manages cached HEIF images using serialization."""
def __init__(self, cache_dir: str):
"""Initialize cache manager with a directory path.
Args:
cache_dir: Path to directory for storing cache files
"""
pass
def store(self, key: str, heif_file) -> None:
"""Store a HEIF file in the cache.
Args:
key: Unique identifier for the cached item
heif_file: HeifFile object to cache
"""
pass
def retrieve(self, key: str):
"""Retrieve a HEIF file from the cache.
Args:
key: Unique identifier for the cached item
Returns:
HeifFile object if found, None otherwise
"""
pass
def exists(self, key: str) -> bool:
"""Check if a key exists in the cache.
Args:
key: Unique identifier to check
Returns:
True if key exists, False otherwise
"""
pass
def clear(self) -> None:
"""Remove all cached items."""
passProvides HEIF image format support with serialization capabilities.