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-5/

Shipment Records

A tuple-like shipment record with optional defaults and helpers for loading and transformation.

Capabilities

Create shipment record type

  • Define a tuple-subclass record with fields id (int), destination (str), weight (float, default 0.0), and priority (str, default "standard"); attribute and index access expose the same ordered data. @test

Load from sequences

  • load_shipments consumes an iterable of sequences, producing record instances; missing trailing optional values use defaults while required id and destination must be present. @test

Convert and update records

  • to_mapping returns an ordered mapping of field names to values, and update_priority returns a new record with only the priority changed, leaving the original untouched. @test

Implementation

@generates

API

from collections.abc import Iterable, Sequence
from typing import Any

class ShipmentRecord:
    id: int
    destination: str
    weight: float
    priority: str

def load_shipments(rows: Iterable[Sequence[Any]]) -> list[ShipmentRecord]:
    """Create records from sequences, applying defaults for missing optional values."""

def to_mapping(record: ShipmentRecord) -> dict[str, Any]:
    """Return an ordered mapping of field names to values."""

def update_priority(record: ShipmentRecord, new_priority: str) -> ShipmentRecord:
    """Return a new record with updated priority without mutating the original."""

Dependencies { .dependencies }

aenum { .dependency }

Provides a tuple-style record factory with defaults and dual attribute/index access. @satisfied-by

Version

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