mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
fix public api
This commit is contained in:
@@ -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
|
||||
@@ -38,7 +40,7 @@ class AutoCompleter:
|
||||
i += 1
|
||||
common_prefix = common_prefix[:i]
|
||||
if state == 0:
|
||||
readline.insert_text(common_prefix[len(text) :])
|
||||
readline.insert_text(common_prefix[len(text) :])
|
||||
readline.redisplay()
|
||||
return None
|
||||
elif len(matches) == 1:
|
||||
@@ -54,10 +56,10 @@ class AutoCompleter:
|
||||
"""
|
||||
if self.history_filename:
|
||||
if os.path.exists(self.history_filename):
|
||||
readline.read_history_file(self.history_filename)
|
||||
readline.read_history_file(self.history_filename)
|
||||
else:
|
||||
for line in all_commands:
|
||||
readline.add_history(line)
|
||||
readline.add_history(line)
|
||||
|
||||
readline.set_completer(self._complete)
|
||||
readline.set_completer_delims(readline.get_completer_delims().replace(" ", ""))
|
||||
@@ -69,7 +71,7 @@ class AutoCompleter:
|
||||
:return: None
|
||||
"""
|
||||
if self.history_filename:
|
||||
readline.write_history_file(self.history_filename)
|
||||
readline.write_history_file(self.history_filename)
|
||||
with open(self.history_filename, "r") as history_file:
|
||||
raw_history = history_file.read()
|
||||
pretty_history: list[str] = []
|
||||
@@ -86,5 +88,5 @@ def _get_history_items() -> list[str] | list[Never]:
|
||||
"""
|
||||
return [
|
||||
readline.get_history_item(i)
|
||||
for i in range(1, readline.get_current_history_length() + 1)
|
||||
for i in range(1, readline.get_current_history_length() + 1)
|
||||
]
|
||||
|
||||
@@ -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
|
||||
@@ -6,11 +8,11 @@ T = TypeVar('T', contravariant=True) # noqa: WPS111
|
||||
class NonStandardBehaviorHandler(Protocol[T]):
|
||||
def __call__(self, __param: T) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class EmptyCommandHandler(Protocol):
|
||||
def __call__(self) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
||||
class Printer(Protocol):
|
||||
def __call__(self, __text: str) -> None:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
__all__ = ["RegisteredRouters"]
|
||||
|
||||
from typing import Iterator, Optional
|
||||
|
||||
from argenta.router import Router
|
||||
|
||||
Reference in New Issue
Block a user