project map script | semantic parcer
This commit is contained in:
@@ -26,7 +26,7 @@ def menu(title: str, prompt: str, choices: List[str], **kwargs) -> Tuple[int, Op
|
||||
return (0, choices[sel - 1]) if 0 < sel <= len(choices) else (1, None)
|
||||
except (ValueError, IndexError):
|
||||
return 1, None
|
||||
# [/DEF:menu]
|
||||
# [/DEF:menu:Function]
|
||||
|
||||
# [DEF:checklist:Function]
|
||||
# @PURPOSE: Отображает список с возможностью множественного выбора.
|
||||
@@ -46,7 +46,7 @@ def checklist(title: str, prompt: str, options: List[Tuple[str, str]], **kwargs)
|
||||
return 0, selected_values
|
||||
except (ValueError, IndexError):
|
||||
return 1, []
|
||||
# [/DEF:checklist]
|
||||
# [/DEF:checklist:Function]
|
||||
|
||||
# [DEF:yesno:Function]
|
||||
# @PURPOSE: Задает вопрос с ответом да/нет.
|
||||
@@ -56,7 +56,7 @@ def checklist(title: str, prompt: str, options: List[Tuple[str, str]], **kwargs)
|
||||
def yesno(title: str, question: str, **kwargs) -> bool:
|
||||
ans = input(f"\n=== {title} ===\n{question} (y/n): ").strip().lower()
|
||||
return ans in ("y", "yes", "да", "д")
|
||||
# [/DEF:yesno]
|
||||
# [/DEF:yesno:Function]
|
||||
|
||||
# [DEF:msgbox:Function]
|
||||
# @PURPOSE: Отображает информационное сообщение.
|
||||
@@ -64,7 +64,7 @@ def yesno(title: str, question: str, **kwargs) -> bool:
|
||||
# @PARAM: msg (str) - Текст сообщения.
|
||||
def msgbox(title: str, msg: str, **kwargs) -> None:
|
||||
print(f"\n=== {title} ===\n{msg}\n")
|
||||
# [/DEF:msgbox]
|
||||
# [/DEF:msgbox:Function]
|
||||
|
||||
# [DEF:inputbox:Function]
|
||||
# @PURPOSE: Запрашивает у пользователя текстовый ввод.
|
||||
@@ -75,7 +75,7 @@ def inputbox(title: str, prompt: str, **kwargs) -> Tuple[int, Optional[str]]:
|
||||
print(f"\n=== {title} ===")
|
||||
val = input(f"{prompt}\n")
|
||||
return (0, val) if val else (1, None)
|
||||
# [/DEF:inputbox]
|
||||
# [/DEF:inputbox:Function]
|
||||
|
||||
# [DEF:_ConsoleGauge:Class]
|
||||
# @PURPOSE: Контекстный менеджер для имитации `whiptail gauge` в консоли.
|
||||
@@ -91,7 +91,7 @@ class _ConsoleGauge:
|
||||
sys.stdout.write(f"\r{txt} "); sys.stdout.flush()
|
||||
def set_percent(self, percent: int) -> None:
|
||||
sys.stdout.write(f"{percent}%"); sys.stdout.flush()
|
||||
# [/DEF:_ConsoleGauge]
|
||||
# [/DEF:_ConsoleGauge:Class]
|
||||
|
||||
# [DEF:gauge:Function]
|
||||
# @PURPOSE: Создает и возвращает экземпляр `_ConsoleGauge`.
|
||||
@@ -99,6 +99,6 @@ class _ConsoleGauge:
|
||||
# @RETURN: _ConsoleGauge - Экземпляр контекстного менеджера.
|
||||
def gauge(title: str, **kwargs) -> _ConsoleGauge:
|
||||
return _ConsoleGauge(title, **kwargs)
|
||||
# [/DEF:gauge]
|
||||
# [/DEF:gauge:Function]
|
||||
|
||||
# [/DEF:superset_tool.utils.whiptail_fallback]
|
||||
# [/DEF:superset_tool.utils.whiptail_fallback:Module]
|
||||
|
||||
Reference in New Issue
Block a user