From 024012a9433e947c66d459a8f54a75eeb073144e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 5 Jun 2021 12:08:00 +0800 Subject: [PATCH] pybind/ceph_daemon: add missing type annotations Signed-off-by: Kefu Chai --- src/pybind/ceph_daemon.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pybind/ceph_daemon.py b/src/pybind/ceph_daemon.py index 6ad16f4eb30..1a105eb3da0 100644 --- a/src/pybind/ceph_daemon.py +++ b/src/pybind/ceph_daemon.py @@ -19,9 +19,10 @@ from collections import OrderedDict from fcntl import ioctl from fnmatch import fnmatch from prettytable import PrettyTable, HEADER -from signal import signal, SIGWINCH +from signal import signal, Signals, SIGWINCH from termios import TIOCGWINSZ -from typing import Any, Dict, Optional, Sequence, TextIO, Tuple +from types import FrameType +from typing import Any, Callable, Dict, Optional, Sequence, TextIO, Tuple from ceph_argparse import parse_json_funcsigs, validate_command @@ -40,7 +41,7 @@ def admin_socket(asok_path: str, (daemon commands don't support 'plain' output). """ - def do_sockio(path, cmd_bytes): + def do_sockio(path: str, cmd_bytes: bytes) -> bytes: """ helper: do all the actual low-level stream I/O """ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(path) @@ -180,7 +181,7 @@ class DaemonWatcher(object): return (self.COLOR_DARK_SEQ if dark else self.COLOR_SEQ) % (30 + color) \ + msg + self.RESET_SEQ - def bold(self, msg) -> str: + def bold(self, msg: str) -> str: """ Decorate `msg` with escape sequences to make it appear bold """ @@ -365,7 +366,9 @@ class DaemonWatcher(object): if not len(self._stats): raise RuntimeError("no stats selected by filters") - def _handle_sigwinch(self, signo, frame) -> None: + def _handle_sigwinch(self, + signo: Signals, + frame: FrameType) -> None: self.termsize.update() def run(self, -- 2.39.5