INNER CODE UNIT · Python

prompt_user

panther-labs/panther-analysis · .scripts/claude_review.py:265

def prompt_user(message, valid_choices):
    """Prompt the user for input via /dev/tty."""
    try:
        with open("/dev/tty", "r") as tty:
            eprint(message, flush=True)
            answer = tty.readline().strip().lower()
            return answer if answer in valid_choices else None
    except (OSError, EOFError):
        return None


def is_interactive():
    """Check if we can prompt the user (terminal or /dev/tty available)."""
    try:
        with open("/dev/tty", "r"):
            return True
    except OSError:
        return False

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…