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%
Implement helpers for interpreting permission bitmasks under four boundary policies: one that rejects unknown bits, one that silently trims them, one that ejects to a plain integer, and one that keeps unknown combinations as pseudo-members while preserving known feature checks. The same three permissions are used everywhere: READ (1), WRITE (2), and EXECUTE (4).
strict_mask(0b1000) raises a ValueError because the bit is not defined by the permission set; valid masks keep working with membership checks (e.g., WRITE in strict_mask(0b0011) is true). @testconforming_mask(0b1111) returns a mask whose value equals 0b0111 while maintaining membership for the defined bits. @testejecting_mask(0b1000) returns the integer 8 instead of a mask instance when the incoming mask includes undefined bits; valid masks still produce the typed mask. @testlenient_mask(0b1001) returns a pseudo-member retaining the original value (0b1001); membership checks still succeed for defined bits, and describe returns a |-joined string where unknown portions show as UNKNOWN(0x...) (e.g., READ|UNKNOWN(0x8)). @test@generates
from typing import Union
class AccessFlag:
READ: "AccessFlag" # bit value 1
WRITE: "AccessFlag" # bit value 2
EXECUTE: "AccessFlag" # bit value 4
def strict_mask(mask: int) -> AccessFlag: ...
def conforming_mask(mask: int) -> AccessFlag: ...
def ejecting_mask(mask: int) -> Union[AccessFlag, int]: ...
def lenient_mask(mask: int) -> AccessFlag: ...
def describe(mask: AccessFlag) -> str: ...Provides advanced flag enums with configurable boundary handling and pseudo-member support.