Skip to content

Simplify type aliases in shared_types.py #57

@TravisBumgarner

Description

@TravisBumgarner

Description

Refactor the type aliases in shared_types.py to use simpler syntax that displays better in IDEs.

Current Code

THandleOutOfBounds = Union[Literal["Warning"], Literal["Error"]]
TInstructionPhase = Union[Literal["setup"], Literal["plotting"], Literal["teardown"]]

Proposed Changes

HandleOutOfBounds = Literal["Warning", "Error"]
InstructionPhase = Literal["setup", "plotting", "teardown"]

Also add a Bounds TypedDict for the min/max point dictionaries:

class Bounds(TypedDict):
    x_min: float
    x_max: float  
    y_min: float
    y_max: float

Acceptance Criteria

  • Type aliases use Literal["a", "b"] syntax instead of Union[Literal["a"], Literal["b"]]
  • Remove the T prefix from type names (use HandleOutOfBounds not THandleOutOfBounds)
  • Add Bounds TypedDict for structured return types
  • Update all imports throughout the codebase to use new names
  • All existing tests pass
  • mypy passes with no new errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions