CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-aenum

tessl install tessl/pypi-aenum@3.1.0

Advanced 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%

task.mdevals/scenario-6/

Enum Interop Bridge

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.

Capabilities

Standard library compatibility

  • Calling 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. @test
  • Repeated calls to enable_stdlib_bridge() or disable_stdlib_bridge() do not raise and leave compatibility in the expected state. @test

SQLite round-trips

  • write_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

Implementation

@generates

API

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."""

Dependencies { .dependencies }

aenum { .dependency }

Provides enum helpers for stdlib compatibility toggling and SQLite binding support.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/aenum@3.1.x
tile.json