AQIT 0.1.0
Loading...
Searching...
No Matches
aquin.tui.detect Namespace Reference

Classes

class  TuiCapability

Functions

Platform detect_platform (*, str|None sys_platform=None)
bool _truthy_env (str|None value)
str|None _opt_out_reason (Sequence[str] argv, Mapping[str, str] environ)
tuple[bool, str] _tty_ok (*, Callable[[], bool] stdin_isatty, Callable[[], bool] stdout_isatty)
tuple[bool, str] _posix_term_ok (Mapping[str, str] environ)
bool _windows_vt_from_environ (Mapping[str, str] environ)
bool _windows_vt_capable_default ()
tuple[bool, str] _term_ok (Platform platform, Mapping[str, str] environ, *, Callable[[], bool] windows_vt_capable)
bool _textual_importable_default ()
TuiCapability detect_tui_capability (*, Sequence[str]|None argv=None, Mapping[str, str]|None environ=None, Callable[[], bool]|None stdin_isatty=None, Callable[[], bool]|None stdout_isatty=None, str|None sys_platform=None, Callable[[], bool]|None textual_importable=None, Callable[[], bool]|None windows_vt_capable=None)

Variables

 Platform = Literal["linux", "darwin", "windows", "unknown"]
 _DUMB_TERMS = frozenset({"", "dumb", "unknown"})
 _CI_TRUTHY = frozenset({"1", "true", "yes", "on"})

Function Documentation

◆ _opt_out_reason()

str | None _opt_out_reason ( Sequence[str] argv,
Mapping[str, str] environ )
protected

Definition at line 49 of file detect.py.

References _truthy_env().

Referenced by detect_tui_capability().

◆ _posix_term_ok()

tuple[bool, str] _posix_term_ok ( Mapping[str, str] environ)
protected

Definition at line 71 of file detect.py.

Referenced by _term_ok().

◆ _term_ok()

tuple[bool, str] _term_ok ( Platform platform,
Mapping[str, str] environ,
* ,
Callable[[], bool] windows_vt_capable )
protected

Definition at line 127 of file detect.py.

References _posix_term_ok(), and _windows_vt_from_environ().

Referenced by detect_tui_capability().

◆ _textual_importable_default()

bool _textual_importable_default ( )
protected

Definition at line 142 of file detect.py.

◆ _truthy_env()

bool _truthy_env ( str | None value)
protected

Definition at line 45 of file detect.py.

Referenced by _opt_out_reason().

◆ _tty_ok()

tuple[bool, str] _tty_ok ( * ,
Callable[[], bool] stdin_isatty,
Callable[[], bool] stdout_isatty )
protected

Definition at line 59 of file detect.py.

Referenced by detect_tui_capability().

◆ _windows_vt_capable_default()

bool _windows_vt_capable_default ( )
protected
Return whether stdout is a VT-capable Windows console.

Definition at line 94 of file detect.py.

References _windows_vt_from_environ().

◆ _windows_vt_from_environ()

bool _windows_vt_from_environ ( Mapping[str, str] environ)
protected

Definition at line 80 of file detect.py.

Referenced by _term_ok(), and _windows_vt_capable_default().

◆ detect_platform()

Platform detect_platform ( * ,
str | None sys_platform = None )
Map ``sys.platform`` to a coarse OS bucket used for TUI routing.

Definition at line 33 of file detect.py.

Referenced by detect_tui_capability().

◆ detect_tui_capability()

TuiCapability detect_tui_capability ( * ,
Sequence[str] | None argv = None,
Mapping[str, str] | None environ = None,
Callable[[], bool] | None stdin_isatty = None,
Callable[[], bool] | None stdout_isatty = None,
str | None sys_platform = None,
Callable[[], bool] | None textual_importable = None,
Callable[[], bool] | None windows_vt_capable = None )
Return whether the Aquin Textual TUI should launch for this process.

Definition at line 146 of file detect.py.

References _opt_out_reason(), _term_ok(), _tty_ok(), and detect_platform().

Variable Documentation

◆ _CI_TRUTHY

aquin.tui.detect._CI_TRUTHY = frozenset({"1", "true", "yes", "on"})
protected

Definition at line 20 of file detect.py.

◆ _DUMB_TERMS

aquin.tui.detect._DUMB_TERMS = frozenset({"", "dumb", "unknown"})
protected

Definition at line 19 of file detect.py.

◆ Platform

aquin.tui.detect.Platform = Literal["linux", "darwin", "windows", "unknown"]

Definition at line 17 of file detect.py.