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

Alias-Aware Shipment Catalog

Implement shipping status and region code enums that deliberately exercise permissive and strict alias policies.

Capabilities

Multi-code shipping statuses

  • Shipping statuses include: pending ("PEN", "P"), in-transit ("MOVE"), delivered ("DEL", 3), and cancelled ("CXL").
  • Codes "PEN" and "P" both represent the pending status; either code resolves to the same member and the codes list preserves declaration order. @test
  • Codes "DEL" and 3 both represent the delivered status; either code resolves to the same member. @test
  • Each shipping status exposes all accepted codes as an ordered tuple via a codes property (and via list_codes(status)), including single-code statuses ("MOVE" for in-transit, "CXL" for cancelled). @test

Strict region codes

  • Region codes "N", "S", "E", and "W" must each map to a single member with no aliasing; using the same value for two regions should raise during class creation instead of permitting an alias. @test
  • Looking up a region by value succeeds only for these declared codes and raises ValueError for any other string or numeric alias. @test

Lookup helpers

  • status_from_code returns the matching shipping status for any declared code and raises ValueError for unknown codes. @test
  • region_from_code returns the matching region for declared codes and raises ValueError for unknown codes. @test

Implementation

@generates

API

from typing import Tuple

class ShippingStatus:
    PENDING: "ShippingStatus"
    IN_TRANSIT: "ShippingStatus"
    DELIVERED: "ShippingStatus"
    CANCELLED: "ShippingStatus"

    @property
    def codes(self) -> Tuple[object, ...]:
        ...

class RegionCode:
    NORTH: "RegionCode"
    SOUTH: "RegionCode"
    EAST: "RegionCode"
    WEST: "RegionCode"

def status_from_code(code: object) -> ShippingStatus: ...
def region_from_code(code: object) -> RegionCode: ...
def list_codes(status: ShippingStatus) -> Tuple[object, ...]: ...

Dependencies { .dependencies }

aenum { .dependency }

Provides advanced enumeration utilities for alias handling and value management.

Version

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