mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
remove "run" Interface method
This commit is contained in:
parent
c016f4b510
commit
87317cea66
2 changed files with 1 additions and 15 deletions
|
@ -4,7 +4,6 @@ import inspect
|
||||||
import types
|
import types
|
||||||
import fastapi
|
import fastapi
|
||||||
import pydantic
|
import pydantic
|
||||||
import uvicorn
|
|
||||||
|
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
@ -77,16 +76,6 @@ class Interface:
|
||||||
interface.instance, prefix=f"/{interface.name}", tags=[interface.name]
|
interface.instance, prefix=f"/{interface.name}", tags=[interface.name]
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self, host="127.0.0.1", port=6787, debug=False, reload=False):
|
|
||||||
uvicorn.run(
|
|
||||||
self.instance,
|
|
||||||
host=host,
|
|
||||||
port=port,
|
|
||||||
log_level="info" if not debug else "debug",
|
|
||||||
reload=reload,
|
|
||||||
root_path="/yunohost/api",
|
|
||||||
)
|
|
||||||
|
|
||||||
def cli(self, *args, **kwargs):
|
def cli(self, *args, **kwargs):
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
return func
|
return func
|
||||||
|
|
|
@ -11,7 +11,7 @@ from rich.syntax import Syntax
|
||||||
|
|
||||||
def parse_cli_command(command: str) -> tuple[str, list[str]]:
|
def parse_cli_command(command: str) -> tuple[str, list[str]]:
|
||||||
command, *args = command.split(" ")
|
command, *args = command.split(" ")
|
||||||
return (command, [arg.strip("{}") for arg in args])
|
return command, [arg.strip("{}") for arg in args]
|
||||||
|
|
||||||
|
|
||||||
def print_as_yaml(data: Any):
|
def print_as_yaml(data: Any):
|
||||||
|
@ -32,9 +32,6 @@ class Interface:
|
||||||
def add(self, interface: Interface):
|
def add(self, interface: Interface):
|
||||||
self.instance.add_typer(interface.instance, name=interface.name)
|
self.instance.add_typer(interface.instance, name=interface.name)
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.instance()
|
|
||||||
|
|
||||||
def cli(self, command_def: str, **kwargs):
|
def cli(self, command_def: str, **kwargs):
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
signature = inspect.signature(func)
|
signature = inspect.signature(func)
|
||||||
|
|
Loading…
Add table
Reference in a new issue