tessl install tessl/pypi-invoke@2.2.0Pythonic task execution library for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks
Agent Success
Agent success rate when using this tile
96%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.25x
Baseline
Agent success rate without this tile
77%
Build a Python utility that handles raw character input from the terminal and adapts output based on terminal dimensions.
Your implementation should provide two main capabilities:
Create a function that reads individual characters from the terminal in real-time without waiting for Enter to be pressed. The function should:
Create a function that detects and reports the current terminal size. The function should:
@generates
def read_character():
"""
Read a single character from terminal input without waiting for Enter.
Returns:
str: A single character that was pressed
"""
pass
def get_terminal_size():
"""
Get the current terminal dimensions.
Returns:
dict: Dictionary with 'width' and 'height' keys representing columns and rows
"""
passread_character() is called and the user presses 'a', it returns 'a' immediately without requiring Enter @testget_terminal_size() is called in a terminal with 80 columns and 24 rows, it returns a dictionary with width=80 and height=24 @testget_terminal_size() is called in an environment without a terminal, it handles the situation gracefully without crashing @testProvides terminal control and PTY utilities for low-level terminal operations.