tessl install tessl/pypi-aenum@3.1.0Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants
Agent Success
Agent success rate when using this tile
76%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.21x
Baseline
Agent success rate without this tile
63%
Build a small module that keeps dependency-based enums compatible with the standard library's enum module and makes them round-trip cleanly through SQLite.
enable_stdlib_bridge() makes DbEvent members pass isinstance checks against enum.Enum while still behaving as the dependency's enums; calling disable_stdlib_bridge() reverses that integration for subsequent checks. @testenable_stdlib_bridge() or disable_stdlib_bridge() do not raise and leave compatibility in the expected state. @testwrite_events() stores a sequence of DbEvent values into SQLite using parameter binding so that the database rows contain the enum names, and read_events() returns the same enum values in insertion order from that table. @test@generates
import sqlite3
from typing import Iterable, List
class DbEvent(...):
NEW = ...
RETRY = ...
COMPLETE = ...
def enable_stdlib_bridge() -> None:
"""Enable stdlib enum compatibility for DbEvent."""
def disable_stdlib_bridge() -> None:
"""Remove stdlib enum compatibility for DbEvent."""
def init_storage(conn: sqlite3.Connection) -> None:
"""Create/drop and prepare the SQLite table used for enum persistence."""
def write_events(conn: sqlite3.Connection, events: Iterable[DbEvent]) -> None:
"""Insert events into the backing table using parameter binding."""
def read_events(conn: sqlite3.Connection) -> List[DbEvent]:
"""Fetch events from the backing table as DbEvent values."""Provides enum helpers for stdlib compatibility toggling and SQLite binding support.