forked from aegis/pyserveX
fixed pyservectl linter errors and formatting
This commit is contained in:
+12
-8
@@ -7,7 +7,7 @@ Usage:
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
import click
|
||||
|
||||
@@ -28,22 +28,26 @@ from .commands import (
|
||||
|
||||
from .. import __version__
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..config import Config
|
||||
from .state import StateManager
|
||||
|
||||
DEFAULT_CONFIG = "config.yaml"
|
||||
DEFAULT_STATE_DIR = ".pyserve"
|
||||
|
||||
|
||||
class Context:
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self.config_file: str = DEFAULT_CONFIG
|
||||
self.state_dir: Path = Path(DEFAULT_STATE_DIR)
|
||||
self.verbose: bool = False
|
||||
self.debug: bool = False
|
||||
self.project: Optional[str] = None
|
||||
self._config = None
|
||||
self._state = None
|
||||
self._config: Optional["Config"] = None
|
||||
self._state: Optional["StateManager"] = None
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
def config(self) -> "Config":
|
||||
if self._config is None:
|
||||
from ..config import Config
|
||||
|
||||
@@ -54,7 +58,7 @@ class Context:
|
||||
return self._config
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
def state(self) -> "StateManager":
|
||||
if self._state is None:
|
||||
from .state import StateManager
|
||||
|
||||
@@ -96,7 +100,7 @@ pass_context = click.make_pass_decorator(Context, ensure=True)
|
||||
)
|
||||
@click.version_option(version=__version__, prog_name="pyservectl")
|
||||
@click.pass_context
|
||||
def cli(ctx, config_file: str, project: Optional[str], verbose: bool, debug: bool):
|
||||
def cli(ctx: click.Context, config_file: str, project: Optional[str], verbose: bool, debug: bool) -> None:
|
||||
"""
|
||||
PyServeCTL - Service management CLI for PyServe.
|
||||
|
||||
@@ -145,7 +149,7 @@ cli.add_command(scale_cmd, name="scale")
|
||||
cli.add_command(ps_cmd, name="status")
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
try:
|
||||
cli(standalone_mode=False)
|
||||
except click.ClickException as e:
|
||||
|
||||
Reference in New Issue
Block a user