bazarr/libs/rich/diagnose.py

38 lines
924 B
Python
Raw Normal View History

2022-11-07 18:06:49 +00:00
import os
import platform
from rich import inspect
from rich.console import Console, get_windows_console_features
from rich.panel import Panel
from rich.pretty import Pretty
2022-11-07 18:06:49 +00:00
def report() -> None: # pragma: no cover
"""Print a report to the terminal with debugging information"""
console = Console()
inspect(console)
2022-11-07 18:06:49 +00:00
features = get_windows_console_features()
inspect(features)
env_names = (
"TERM",
"COLORTERM",
"CLICOLOR",
"NO_COLOR",
"TERM_PROGRAM",
"COLUMNS",
"LINES",
"JUPYTER_COLUMNS",
"JUPYTER_LINES",
"JPY_PARENT_PID",
"VSCODE_VERBOSE_LOGGING",
)
env = {name: os.getenv(name) for name in env_names}
console.print(Panel.fit((Pretty(env)), title="[b]Environment Variables"))
console.print(f'platform="{platform.system()}"')
if __name__ == "__main__": # pragma: no cover
report()