mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
ref: typehints, enum instead of raw string, abc and other (#1)
Full code coverage with annotations, fixing errors in various linters: ruff, wps, etc. Fixing errors in type checkers: ty, mypy, pyright. Formatting and bringing code to a consistent style, applying best practices in various aspects.
This commit is contained in:
@@ -1,25 +1,22 @@
|
||||
from mock.mock_app.routers import work_router
|
||||
|
||||
from argenta.app import App
|
||||
from argenta.app.defaults import PredefinedMessages
|
||||
from argenta.app.dividing_line import DynamicDividingLine
|
||||
from argenta.app.autocompleter import AutoCompleter
|
||||
from argenta.orchestrator import Orchestrator
|
||||
from argenta.orchestrator.argparser import ArgParser
|
||||
from argenta.orchestrator.argparser.arguments import BooleanArgument
|
||||
from argenta import App, Orchestrator
|
||||
from argenta.app import PredefinedMessages, DynamicDividingLine, AutoCompleter
|
||||
from argenta.orchestrator import ArgParser
|
||||
from argenta.orchestrator.argparser import BooleanArgument
|
||||
|
||||
|
||||
arg_parser = ArgParser(processed_args=[BooleanArgument("repeat")])
|
||||
app: App = App(
|
||||
dividing_line=DynamicDividingLine(),
|
||||
autocompleter=AutoCompleter(),
|
||||
repeat_command_groups=False,
|
||||
)
|
||||
orchestrator: Orchestrator = Orchestrator(arg_parser)
|
||||
|
||||
|
||||
def main():
|
||||
app.include_router(work_router)
|
||||
print(f"\n\n{orchestrator.get_input_args()}")
|
||||
|
||||
app.add_message_on_startup(PredefinedMessages.USAGE)
|
||||
app.add_message_on_startup(PredefinedMessages.AUTOCOMPLETE)
|
||||
|
||||
+10
-24
@@ -1,39 +1,25 @@
|
||||
from rich.console import Console
|
||||
|
||||
from argenta.command import Command
|
||||
from argenta.command.flag.defaults import PredefinedFlags
|
||||
from argenta.command.flag import Flags, Flag, PossibleValues
|
||||
from argenta.command import Command, PredefinedFlags, Flags, Flag, PossibleValues
|
||||
from argenta.response import Response
|
||||
from argenta.router import Router
|
||||
from argenta import Router
|
||||
|
||||
|
||||
work_router: Router = Router(title="Work points:", disable_redirect_stdout=True)
|
||||
work_router: Router = Router(title="Work points:")
|
||||
|
||||
console = Console()
|
||||
|
||||
flag = Flag('csdv', possible_values=PossibleValues.DISABLE)
|
||||
flag = Flag('csdv', possible_values=PossibleValues.NEITHER)
|
||||
|
||||
|
||||
@work_router.command(
|
||||
Command(
|
||||
"get",
|
||||
"Get Help",
|
||||
Command("get",
|
||||
description="Get Help",
|
||||
aliases=["help", "Get_help"],
|
||||
flags=Flags(PredefinedFlags.PORT, PredefinedFlags.HOST),
|
||||
)
|
||||
)
|
||||
flags=Flags([PredefinedFlags.PORT,
|
||||
PredefinedFlags.HOST])))
|
||||
def command_help(response: Response):
|
||||
case = input("test > ")
|
||||
print(case)
|
||||
print(response.status)
|
||||
print(response.undefined_flags.get_flags())
|
||||
print(response.valid_flags.get_flags())
|
||||
print(response.invalid_value_flags.get_flags())
|
||||
print(response.input_flags.flags)
|
||||
|
||||
|
||||
@work_router.command("run")
|
||||
def command_start_solving(response: Response):
|
||||
print(response.status)
|
||||
print(response.undefined_flags.get_flags())
|
||||
print(response.valid_flags.get_flags())
|
||||
print(response.invalid_value_flags.get_flags())
|
||||
print(response.input_flags.flags)
|
||||
|
||||
Reference in New Issue
Block a user