mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
rename orchestrator method start_polling to run_repl
This commit is contained in:
@@ -12,6 +12,6 @@ orchestrator = Orchestrator(
|
||||
|
||||
if __name__ == "__main__":
|
||||
if arg_parser.parsed_argspace.get_by_name("dev"):
|
||||
orchestrator.start_polling(App(initial_message="ArgentaDev"))
|
||||
orchestrator.run_repl(App(initial_message="ArgentaDev"))
|
||||
else:
|
||||
orchestrator.start_polling(App())
|
||||
orchestrator.run_repl(App())
|
||||
|
||||
@@ -22,7 +22,7 @@ def main():
|
||||
print(f" Host: {host.value}")
|
||||
print(f" Port: {port.value}")
|
||||
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -24,4 +24,4 @@ orchestrator = Orchestrator(custom_providers=[ConnectionProvider()])
|
||||
|
||||
# 4. Start the application
|
||||
if __name__ == "__main__":
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
@@ -60,7 +60,7 @@ orchestrator = Orchestrator()
|
||||
|
||||
def main():
|
||||
app.include_router(router)
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -9,7 +9,7 @@ orchestrator: Orchestrator = Orchestrator()
|
||||
|
||||
def main() -> None:
|
||||
app.include_router(router)
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -30,4 +30,4 @@ app.include_router(main_router)
|
||||
|
||||
# 5. Start application
|
||||
if __name__ == "__main__":
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
@@ -15,4 +15,4 @@ app.include_router(router)
|
||||
|
||||
# 3. Start polling via orchestrator
|
||||
if __name__ == "__main__":
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
@@ -25,7 +25,7 @@ def test_input_incorrect_command(capsys: CaptureFixture[str]):
|
||||
app.set_unknown_command_handler(lambda command: print(f"Unknown command: {command.trigger}"))
|
||||
|
||||
with patch("builtins.input", side_effect=["help", "q"]):
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
output = capsys.readouterr().out
|
||||
assert "\nUnknown command: help\n" in output
|
||||
|
||||
@@ -159,7 +159,7 @@ PredefinedMessages
|
||||
app.add_message_on_startup(PredefinedMessages.AUTOCOMPLETE)
|
||||
app.add_message_on_startup(PredefinedMessages.HELP)
|
||||
|
||||
orchestrator.start_polling(app)
|
||||
orchestrator.run_repl(app)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -36,7 +36,7 @@ Orchestrator
|
||||
Основные методы
|
||||
----------------
|
||||
|
||||
.. py:method:: start_polling(self, app: App) -> None
|
||||
.. py:method:: run_repl(self, app: App) -> None
|
||||
|
||||
Это главный метод, который запускает приложение. Он запускает бесконечный цикл ввода -> вывода.
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
E2E-тестирование цикла
|
||||
----------------------
|
||||
|
||||
Полный запуск цикла ``start_polling`` можно покрывать через подпроцесс с передачей строк в ``stdin``. Это тяжелее и обычно не требуется. Если всё же необходимо — пример ниже.
|
||||
Полный запуск цикла ``run_repl`` можно покрывать через подпроцесс с передачей строк в ``stdin``. Это тяжелее и обычно не требуется. Если всё же необходимо — пример ниже.
|
||||
|
||||
.. danger::
|
||||
**Важно:** Обязательно передавайте строковый триггер команды выхода последним элементом в списке ``side_effects`` при патче ``input``.
|
||||
|
||||
Reference in New Issue
Block a user