]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/iostat: add typing annotations
authorKefu Chai <kchai@redhat.com>
Fri, 29 Jan 2021 02:31:04 +0000 (10:31 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 29 Jan 2021 11:42:32 +0000 (19:42 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mypy.ini
src/pybind/mgr/iostat/module.py
src/pybind/mgr/tox.ini

index 484bcc01a744f5b9c57c56b10ebccca5f830b12d..9aa575ef79502a3076fc5cec06c798d7635b490d 100755 (executable)
@@ -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
 
index 5c18f5bf0a022bd63cae3f54df55203d63680b86..c0ac9280f89e2cf221d8bf7c62920739241ed955 100644 (file)
@@ -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
         """
index 3b917256690445e5898e00f48c635ccf439aa94a..f9562a0c42f21fedda76e7e230ea26ba3b7a6a9c 100644 (file)
@@ -58,6 +58,7 @@ commands =
            -m cephadm \
            -m dashboard \
            -m devicehealth \
+           -m iostat \
            -m mds_autoscaler \
            -m mgr_module \
            -m mgr_util \