Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
thusser committed Dec 20, 2023
1 parent 649052a commit d001f95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pyobs/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import threading
from io import StringIO
from logging.handlers import TimedRotatingFileHandler
from typing import Optional, Any, Dict
from typing import Optional, Any, Dict, List
import yaml

from pyobs.object import get_object, get_class_from_string
Expand Down Expand Up @@ -35,7 +35,7 @@ def __init__(self, config: str, log_file: Optional[str] = None, log_level: str =

# formatter for logging, and list of logging handlers
formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d %(message)s")
handlers = []
handlers: List[logging.Handler] = []

# create stdout logging handler
stream_handler = logging.StreamHandler()
Expand Down Expand Up @@ -110,7 +110,7 @@ def run(self) -> None:
log.info("Closing loop...")
self._loop.close()

def _signal_handler(self, sig) -> None:
def _signal_handler(self, sig: int) -> None:
"""React to signals and quit module."""

# stop loop
Expand Down
13 changes: 8 additions & 5 deletions pyobs/cli/pyobs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import argparse
import os
from typing import Type, Any
from typing import Type, Any, Optional, TYPE_CHECKING

if TYPE_CHECKING:
from pyobs.application import Application

from pyobs import version


def init_cli():
def init_cli() -> argparse.ArgumentParser:
# init argument parsing
# for all command line parameters we set the default to an environment variable,
# so they can also be specified that way
Expand All @@ -30,7 +33,7 @@ def init_cli():
return parser


def parse_cli(parser: argparse.ArgumentParser):
def parse_cli(parser: argparse.ArgumentParser) -> dict[str, Any]:
from pyobs.utils.time import Time

# parse args
Expand All @@ -50,7 +53,7 @@ def parse_cli(parser: argparse.ArgumentParser):
return vars(args)


def start_daemon(app_class, pid_file=None, **kwargs: Any) -> None:
def start_daemon(app_class: Type["Application"], pid_file: str, **kwargs: Any) -> None:
"""Start process as a daemon.
Args:
Expand All @@ -70,7 +73,7 @@ def start_daemon(app_class, pid_file=None, **kwargs: Any) -> None:
run(app_class, **kwargs)


def run(app_class: Type, **kwargs: Any) -> None:
def run(app_class: Type["Application"], **kwargs: Any) -> None:
"""Run a pyobs application with the given options.
Args:
Expand Down
2 changes: 1 addition & 1 deletion pyobs/cli/pyobsw.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .pyobs import init_cli, parse_cli, run


def main():
def main() -> None:
from pyobs.application import GuiApplication

# init argument parsing and parse it
Expand Down

0 comments on commit d001f95

Please sign in to comment.