From: Kefu Chai Date: Fri, 29 Jan 2021 02:31:04 +0000 (+0800) Subject: pybind/mgr/iostat: add typing annotations X-Git-Tag: v17.1.0~3116^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7ee1301a029f99dd9252178b7622a805508b349b;p=ceph.git pybind/mgr/iostat: add typing annotations Signed-off-by: Kefu Chai --- diff --git a/src/mypy.ini b/src/mypy.ini index 484bcc01a74..9aa575ef795 100755 --- a/src/mypy.ini +++ b/src/mypy.ini @@ -27,6 +27,9 @@ disallow_untyped_defs = True [mypy-devicehealth.*] disallow_untyped_defs = True +[mypy-iostat.*] +disallow_untyped_defs = True + [mypy-orchestrator.*] disallow_untyped_defs = True diff --git a/src/pybind/mgr/iostat/module.py b/src/pybind/mgr/iostat/module.py index 5c18f5bf0a0..c0ac9280f89 100644 --- a/src/pybind/mgr/iostat/module.py +++ b/src/pybind/mgr/iostat/module.py @@ -1,11 +1,13 @@ +from typing import Any + from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule class Module(MgrModule): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - def self_test(self): + def self_test(self) -> None: r = self.get('io_rate') assert('pg_stats_delta' in r) assert('stamp_delta' in r['pg_stats_delta']) @@ -16,7 +18,7 @@ class Module(MgrModule): assert('num_read' in r['pg_stats_delta']['stat_sum']) @CLIReadCommand('iostat', poll=True) - def iostat(self, width: int = 80, print_header: bool = False): + def iostat(self, width: int = 80, print_header: bool = False) -> HandleCommandResult: """ Get IO rates """ diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 3b917256690..f9562a0c42f 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -58,6 +58,7 @@ commands = -m cephadm \ -m dashboard \ -m devicehealth \ + -m iostat \ -m mds_autoscaler \ -m mgr_module \ -m mgr_util \