diff --git a/mock/local_test.py b/mock/local_test.py index c47d85c..fd8d524 100644 --- a/mock/local_test.py +++ b/mock/local_test.py @@ -11,7 +11,12 @@ from argenta.router import Router from argenta.orchestrator import Orchestrator from argenta.command.models import InputCommand -from argenta.app.utils import most_similar_command +import inspect + +def some(): + ellipsis + global inspect + pass -print(most_similar_command('case', ['case', 'tester', 'poster', 'caser'])) +print(inspect.getsourcelines(some)) diff --git a/mock/mock_app/handlers/routers.py b/mock/mock_app/handlers/routers.py index 225a6b6..6c7cadf 100644 --- a/mock/mock_app/handlers/routers.py +++ b/mock/mock_app/handlers/routers.py @@ -13,7 +13,7 @@ console = Console() @work_router.command(Command('get', 'Get Help', aliases=['help', 'Get_help'], flags=Flags(PredefinedFlags.PORT, PredefinedFlags.HOST))) -def command_help(response: Response): +def command_help(response: int): print(response.status) print(response.undefined_flags.get_flags()) print(response.valid_flags.get_flags()) @@ -21,7 +21,7 @@ def command_help(response: Response): @work_router.command(Command('run', 'Run All')) -def command_start_solving(response: Response): +def command_start_solving(response: str): print(response.status) print(response.undefined_flags.get_flags()) print(response.valid_flags.get_flags()) diff --git a/src/argenta/router/entity.py b/src/argenta/router/entity.py index 9905712..9c7eb1c 100644 --- a/src/argenta/router/entity.py +++ b/src/argenta/router/entity.py @@ -1,5 +1,5 @@ from typing import Callable, Literal, Type -from inspect import getfullargspec, get_annotations +from inspect import getfullargspec, get_annotations, getsourcefile, getsourcelines from rich.console import Console from argenta.command import Command @@ -160,7 +160,8 @@ class Router: arg_annotation: Type = get_annotations(func)[transferred_args[0]] if not arg_annotation is Response: - Console().print(f'\n\n[b red]WARNING:[/b red] [i]The type of argument passed to the handler is [/i][blue]{Response}[/blue],' + Console().print(f'\n\nFile "{getsourcefile(func).replace("\\", "/")}", line {getsourcelines(func)[1]+1}\n' + f'[b red]WARNING:[/b red] [i]The typehint of argument([green]{transferred_args[0]}[/green]) passed to the handler is [/i][blue]{Response}[/blue],' f' [i]but[/i] [bold blue]{arg_annotation}[/bold blue] [i]is specified[/i]', highlight=False)