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

Access Scope Exposure Controls

Design an enumeration that models application access scopes while carefully controlling which attributes become members and which stay as helpers.

Capabilities

Controlled membership and helpers

  • Iterating over the enumeration lists ADMIN, EDITOR, VIEWER, and a computed TOTAL_COUNT entry; helper attributes registry (code-to-label map built from real scopes) and _cache stay accessible but never appear in __members__ or iteration. @test

Computed count member

  • The TOTAL_COUNT member appears alongside the real scopes and its .value equals the number of real scopes (3), derived from the current members rather than hard-coded. @test

Immutable audit prefix

  • Accessing AUDIT_PREFIX returns the string "access:"; attempts to reassign or delete it raise AttributeError; it is not counted as an enum member. @test

Human-friendly labels

  • Each member exposes a read-only label giving "Admin", "Editor", "Viewer"; it coexists with the stored raw code without shadowing iteration or member lookup. @test

Implementation

@generates

API

from typing import Dict

class AccessScope(Enum):
    AUDIT_PREFIX: str
    registry: Dict[str, str]

    ADMIN: "AccessScope"
    EDITOR: "AccessScope"
    VIEWER: "AccessScope"
    TOTAL_COUNT: "AccessScope"

    def __init__(self, code: str, label: str): ...
    @property
    def code(self) -> str: ...
    @property
    def label(self) -> str: ...
    def is_elevated(self) -> bool: ...
    def describe(self) -> str: ...

Dependencies { .dependencies }

aenum { .dependency }

Provides descriptor-based helpers for controlling enum membership, constants, and properties.

Version

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