mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
fix public api
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
__all__ = ["App", "Orchestrator", "Router"]
|
||||
|
||||
|
||||
from argenta.orchestrator.entity import Orchestrator
|
||||
from argenta.app.models import App
|
||||
from argenta.router.entity import Router
|
||||
from argenta.orchestrator.entity import Orchestrator as Orchestrator
|
||||
from argenta.app.models import App as App
|
||||
from argenta.router.entity import Router as Router
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
__all__ = [
|
||||
"App",
|
||||
"PredefinedMessages",
|
||||
"DynamicDividingLine",
|
||||
"StaticDividingLine",
|
||||
"AutoCompleter"
|
||||
]
|
||||
|
||||
from argenta.app.models import App
|
||||
from argenta.app.defaults import PredefinedMessages
|
||||
from argenta.app.dividing_line.models import DynamicDividingLine, StaticDividingLine
|
||||
from argenta.app.autocompleter.entity import AutoCompleter
|
||||
from argenta.app.models import App as App
|
||||
from argenta.app.defaults import PredefinedMessages as PredefinedMessages
|
||||
from argenta.app.dividing_line.models import DynamicDividingLine as DynamicDividingLine, StaticDividingLine as StaticDividingLine
|
||||
from argenta.app.autocompleter.entity import AutoCompleter as AutoCompleter
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
__all__ = ["AutoCompleter"]
|
||||
|
||||
|
||||
from argenta.app.autocompleter.entity import AutoCompleter
|
||||
from argenta.app.autocompleter.entity import AutoCompleter as AutoCompleter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["AutoCompleter"]
|
||||
|
||||
import os
|
||||
import readline
|
||||
from typing import Never
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["PredefinedMessages"]
|
||||
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
__all__ = ["StaticDividingLine", "DynamicDividingLine"]
|
||||
|
||||
|
||||
from argenta.app.dividing_line.models import StaticDividingLine, DynamicDividingLine
|
||||
from argenta.app.dividing_line.models import StaticDividingLine as StaticDividingLine, DynamicDividingLine as DynamicDividingLine
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["StaticDividingLine", "DynamicDividingLine"]
|
||||
|
||||
from abc import ABC
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["App"]
|
||||
|
||||
import io
|
||||
import re
|
||||
from contextlib import redirect_stdout
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["NonStandardBehaviorHandler", "EmptyCommandHandler", "Printer", "DescriptionMessageGenerator"]
|
||||
|
||||
from typing import Protocol, TypeVar
|
||||
|
||||
T = TypeVar('T', contravariant=True) # noqa: WPS111
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["RegisteredRouters"]
|
||||
|
||||
from typing import Iterator, Optional
|
||||
|
||||
from argenta.router import Router
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
__all__ = [
|
||||
"Command",
|
||||
"PossibleValues",
|
||||
"PredefinedFlags",
|
||||
"InputCommand",
|
||||
"Flags",
|
||||
"Flag"
|
||||
]
|
||||
|
||||
from argenta.command.models import Command, InputCommand
|
||||
from argenta.command.flag import defaults as PredefinedFlags
|
||||
from argenta.command.flag import (Flag, Flags, PossibleValues)
|
||||
from argenta.command.models import Command as Command, InputCommand as InputCommand
|
||||
from argenta.command.flag.defaults import PredefinedFlags as PredefinedFlags
|
||||
from argenta.command.flag import (Flag as Flag,
|
||||
Flags as Flags,
|
||||
PossibleValues as PossibleValues)
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
__all__ = [
|
||||
"InputCommandException",
|
||||
"UnprocessedInputFlagException",
|
||||
"RepeatedInputFlagsException",
|
||||
"EmptyInputCommandException",
|
||||
]
|
||||
|
||||
from argenta.command.flag.models import Flag, InputFlag
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import override
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
__all__ = [
|
||||
"Flag",
|
||||
"InputFlag",
|
||||
"Flags",
|
||||
"PossibleValues",
|
||||
"ValidationStatus"
|
||||
]
|
||||
|
||||
|
||||
from argenta.command.flag.models import Flag, InputFlag, PossibleValues, ValidationStatus
|
||||
from argenta.command.flag.flags.models import Flags
|
||||
from argenta.command.flag.models import (
|
||||
Flag as Flag,
|
||||
InputFlag as InputFlag,
|
||||
PossibleValues as PossibleValues,
|
||||
ValidationStatus as ValidationStatus
|
||||
)
|
||||
from argenta.command.flag.flags.models import Flags as Flags
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["PredefinedFlags"]
|
||||
|
||||
from typing import Literal
|
||||
from argenta.command.flag.models import Flag, PossibleValues
|
||||
import re
|
||||
@@ -5,23 +7,25 @@ import re
|
||||
|
||||
DEFAULT_PREFIX: Literal["-", "--", "---"] = "-"
|
||||
|
||||
HELP = Flag(name="help", possible_values=PossibleValues.NEITHER)
|
||||
SHORT_HELP = Flag(name="H", prefix=DEFAULT_PREFIX, possible_values=PossibleValues.NEITHER)
|
||||
|
||||
INFO = Flag(name="info", possible_values=PossibleValues.NEITHER) # noqa: WPS110
|
||||
SHORT_INFO = Flag(name="I", prefix=DEFAULT_PREFIX, possible_values=PossibleValues.NEITHER)
|
||||
class PredefinedFlags:
|
||||
HELP = Flag(name="help", possible_values=PossibleValues.NEITHER)
|
||||
SHORT_HELP = Flag(name="H", prefix=DEFAULT_PREFIX, possible_values=PossibleValues.NEITHER)
|
||||
|
||||
ALL = Flag(name="all", possible_values=PossibleValues.NEITHER)
|
||||
SHORT_ALL = Flag(name="A", prefix=DEFAULT_PREFIX, possible_values=PossibleValues.NEITHER)
|
||||
INFO = Flag(name="info", possible_values=PossibleValues.NEITHER) # noqa: WPS110
|
||||
SHORT_INFO = Flag(name="I", prefix=DEFAULT_PREFIX, possible_values=PossibleValues.NEITHER)
|
||||
|
||||
HOST = Flag(
|
||||
ALL = Flag(name="all", possible_values=PossibleValues.NEITHER)
|
||||
SHORT_ALL = Flag(name="A", prefix=DEFAULT_PREFIX, possible_values=PossibleValues.NEITHER)
|
||||
|
||||
HOST = Flag(
|
||||
name="host", possible_values=re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$")
|
||||
)
|
||||
SHORT_HOST = Flag(
|
||||
)
|
||||
SHORT_HOST = Flag(
|
||||
name="H",
|
||||
prefix=DEFAULT_PREFIX,
|
||||
possible_values=re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"),
|
||||
)
|
||||
)
|
||||
|
||||
PORT = Flag(name="port", possible_values=re.compile(r"^\d{1,5}$"))
|
||||
SHORT_PORT = Flag(name="P", prefix=DEFAULT_PREFIX, possible_values=re.compile(r"^\d{1,5}$"))
|
||||
PORT = Flag(name="port", possible_values=re.compile(r"^\d{1,5}$"))
|
||||
SHORT_PORT = Flag(name="P", prefix=DEFAULT_PREFIX, possible_values=re.compile(r"^\d{1,5}$"))
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
__all__ = [
|
||||
"Flags",
|
||||
"InputFlags"
|
||||
]
|
||||
|
||||
|
||||
from argenta.command.flag.flags.models import (
|
||||
Flags,
|
||||
InputFlags
|
||||
Flags as Flags,
|
||||
InputFlags as InputFlags
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["Flags", "InputFlags"]
|
||||
|
||||
from argenta.command.flag.models import InputFlag, Flag
|
||||
from typing import Generic, TypeVar, override
|
||||
from collections.abc import Iterator
|
||||
@@ -103,4 +105,3 @@ class InputFlags(BaseFlags[InputFlag]):
|
||||
return False
|
||||
else:
|
||||
raise TypeError
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["PossibleValues", "ValidationStatus", "Flag", "InputFlag"]
|
||||
|
||||
from enum import Enum
|
||||
from re import Pattern
|
||||
from typing import Literal, override
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
__all__ = [
|
||||
"Command",
|
||||
"InputCommand"
|
||||
]
|
||||
|
||||
from argenta.command.flag.models import Flag, InputFlag, ValidationStatus
|
||||
from argenta.command.flag.flags.models import InputFlags, Flags
|
||||
from argenta.command.exceptions import (
|
||||
|
||||
@@ -20,9 +20,10 @@ def inject(func: Callable[..., T]) -> Callable[..., T]:
|
||||
)
|
||||
|
||||
|
||||
def setup_dishka(app: App, *, auto_inject: bool = False) -> None:
|
||||
def setup_dishka(app: App, container: Container, *, auto_inject: bool = False) -> None:
|
||||
if auto_inject:
|
||||
_auto_inject_handlers(app)
|
||||
Response.patch_by_container(container)
|
||||
|
||||
|
||||
def _get_container_from_response(
|
||||
@@ -33,7 +34,6 @@ def _get_container_from_response(
|
||||
if hasattr(arg, "_dishka_container"):
|
||||
return arg._dishka_container # pyright: ignore[reportPrivateUsage]
|
||||
break
|
||||
|
||||
raise RuntimeError("dishka container not found in Response")
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
__all__ = [
|
||||
'SystemProvider',
|
||||
]
|
||||
|
||||
from argenta.orchestrator.argparser import ArgParser
|
||||
from dishka import Provider, provide, Scope
|
||||
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
__all__ = ["get_time_of_pre_cycle_setup"]
|
||||
|
||||
|
||||
from argenta.metrics.main import get_time_of_pre_cycle_setup
|
||||
from argenta.metrics.main import get_time_of_pre_cycle_setup as get_time_of_pre_cycle_setup
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
__all__ = [
|
||||
'get_time_of_pre_cycle_setup',
|
||||
]
|
||||
|
||||
import io
|
||||
from contextlib import redirect_stdout
|
||||
from time import time
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
__all__ = ["ArgParser", "Orchestrator"]
|
||||
|
||||
from argenta.orchestrator.argparser.entity import ArgParser
|
||||
from argenta.orchestrator.entity import Orchestrator
|
||||
from argenta.orchestrator.argparser.entity import ArgParser as ArgParser
|
||||
from argenta.orchestrator.entity import Orchestrator as Orchestrator
|
||||
|
||||
@@ -1,9 +1,2 @@
|
||||
__all__ = [
|
||||
"ArgParser",
|
||||
"BooleanArgument",
|
||||
"ValueArgument"
|
||||
]
|
||||
|
||||
|
||||
from argenta.orchestrator.argparser.entity import ArgParser
|
||||
from argenta.orchestrator.argparser.arguments import BooleanArgument, ValueArgument
|
||||
from argenta.orchestrator.argparser.entity import ArgParser as ArgParser
|
||||
from argenta.orchestrator.argparser.arguments import BooleanArgument as BooleanArgument, ValueArgument as ValueArgument
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
__all__ = ["BooleanArgument", "ValueArgument", "InputArgument"]
|
||||
|
||||
|
||||
from argenta.orchestrator.argparser.arguments.models import (
|
||||
BooleanArgument,
|
||||
ValueArgument,
|
||||
InputArgument
|
||||
BooleanArgument as BooleanArgument,
|
||||
ValueArgument as ValueArgument,
|
||||
InputArgument as InputArgument
|
||||
)
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
__all__ = [
|
||||
'BooleanArgument',
|
||||
'ValueArgument',
|
||||
'InputArgument'
|
||||
]
|
||||
|
||||
from typing import Literal
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
__all__ = [
|
||||
"ArgSpace",
|
||||
"ArgParser",
|
||||
]
|
||||
|
||||
from argparse import ArgumentParser, Namespace
|
||||
from typing import Never, Self
|
||||
|
||||
@@ -75,4 +80,3 @@ class ArgParser:
|
||||
def parse_args(self) -> ArgSpace:
|
||||
return ArgSpace.from_namespace(namespace=self._core.parse_args(),
|
||||
processed_args=self.processed_args)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
__all__ = ["Orchestrator"]
|
||||
|
||||
from argenta.app import App
|
||||
from argenta.response import Response
|
||||
|
||||
from argenta.orchestrator.argparser import ArgParser
|
||||
from argenta.di.integration import setup_dishka
|
||||
@@ -31,7 +32,6 @@ class Orchestrator:
|
||||
:return: None
|
||||
"""
|
||||
container = make_container(SystemProvider(self._arg_parser), *self._custom_providers)
|
||||
Response.patch_by_container(container)
|
||||
setup_dishka(app, auto_inject=self._auto_inject_handlers)
|
||||
setup_dishka(app, container, auto_inject=self._auto_inject_handlers)
|
||||
|
||||
app.run_polling()
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
__all__ = ["Response", "ResponseStatus"]
|
||||
|
||||
|
||||
from argenta.response.entity import Response
|
||||
from argenta.response.status import ResponseStatus
|
||||
from argenta.response.entity import Response as Response
|
||||
from argenta.response.status import ResponseStatus as ResponseStatus
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["Response"]
|
||||
|
||||
from dishka import Container
|
||||
|
||||
from argenta.command.flag.flags.models import InputFlags
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["ResponseStatus"]
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
from argenta.router.entity import Router
|
||||
|
||||
|
||||
__all__ = ["Router"]
|
||||
from argenta.router.entity import Router as Router
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["CommandHandler", "CommandHandlers"]
|
||||
|
||||
from collections.abc import Iterator
|
||||
from typing import Callable
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["system_router"]
|
||||
|
||||
from argenta.router import Router
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["Router"]
|
||||
|
||||
from typing import Callable, TypeAlias
|
||||
from inspect import getfullargspec, get_annotations, getsourcefile, getsourcelines
|
||||
from rich.console import Console
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["RepeatedFlagNameException", "RequiredArgumentNotPassedException", "TriggerContainSpacesException"]
|
||||
|
||||
from typing import override
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user