Platform-Specific Utilities

Platform-specific utilities and input handling.

This module provides platform-independent abstractions for terminal operations and user input handling.

class simulchip.platform.InputHandler[source]

Bases: Protocol

Protocol for input handling implementations.

get_char()[source]

Get a single character from input.

Return type:

str

__init__(*args, **kwargs)
class simulchip.platform.UnixInputHandler[source]

Bases: object

Input handler for Unix-like systems (Linux, macOS).

get_char()[source]

Get a single character from stdin without pressing enter.

Return type:

str

class simulchip.platform.WindowsInputHandler[source]

Bases: object

Input handler for Windows systems.

get_char()[source]

Get a single character from stdin without pressing enter.

Return type:

str

simulchip.platform.get_input_handler()[source]

Get appropriate input handler for current platform.

Return type:

InputHandler

Returns:

InputHandler instance for the current platform

simulchip.platform.is_interactive_terminal()[source]

Check if running in an interactive terminal.

Return type:

bool

Returns:

True if stdin is a TTY (interactive terminal)

simulchip.platform.get_platform_name()[source]

Get platform name for logging/debugging.

Return type:

str

Returns:

Platform name string

simulchip.platform.getch()[source]

Get a single character from stdin without pressing enter.

This is a convenience function that uses the platform-appropriate handler.

Return type:

str

Returns:

Single character string