fix tests and improve perf

This commit is contained in:
2026-01-09 10:14:25 +03:00
parent 56189be6ab
commit c5dab43c87
8 changed files with 37 additions and 105 deletions
+12 -12
View File
@@ -1,14 +1,14 @@
from argenta import Command, Response, Router, App, Orchestrator
from argenta.command import InputCommand
from abc import ABC, abstractmethod
router = Router()
orchestrator = Orchestrator()
@router.command(Command('test'))
def test(_response: Response) -> None: # pyright: ignore[reportUnusedFunction]
print('test command')
app = App(override_system_messages=True, print_func=print)
app.include_router(router)
app.set_unknown_command_handler(lambda command: print(f'Unknown command: {command.trigger}'))
orchestrator.start_polling(app)
class Figure(ABC):
@abstractmethod
def draw(self) -> None:
raise NotImplementedError
class Rectangle(Figure):
def __init__(self, x: int, y: int) -> None:
self.x = x
self.y = y
rec = Rectangle(5, 2)
+2 -5
View File
@@ -1,16 +1,13 @@
from argenta import App, Orchestrator
from argenta.app import PredefinedMessages
from argenta.orchestrator.argparser import ArgParser, BooleanArgument
from argenta.app.dividing_line.models import DynamicDividingLine
from mock.mock_app.routers import work_router
app: App = App(
dividing_line=DynamicDividingLine('^'),
)
argparser = ArgParser([BooleanArgument('some')])
orchestrator: Orchestrator = Orchestrator(argparser)
orchestrator: Orchestrator = Orchestrator()
print(argparser.parsed_argspace.get_by_type(BooleanArgument))
def main():
app.include_router(work_router)
@@ -22,5 +19,5 @@ def main():
orchestrator.start_polling(app)
if __name__ == "__main__":
orchestrator.start_polling(app)
main()
+8 -1
View File
@@ -4,7 +4,14 @@ from argenta.command import Flag, Flags
work_router: Router = Router(title="Base points:", disable_redirect_stdout=True)
@work_router.command(Command("hello", flags=Flags(Flag("test")), description="Hello, world!"))
@work_router.command(
Command(
"hello",
flags=Flags([
Flag("test")
]),
description="Hello, world!")
)
def command_help(response: Response):
c = input("Enter your name: ")
print(f"Hello, {c}!")