From ba3189b13882ff919ad39a2e377fa6b29c04c79a Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 20 Nov 2020 12:06:59 +0100 Subject: [PATCH] mgr/cephadm: make annotations for schedule.py mandatory Signed-off-by: Sebastian Wagner --- src/mypy.ini | 3 +++ src/pybind/mgr/cephadm/schedule.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mypy.ini b/src/mypy.ini index de3ed392d3e..0a0737659bb 100755 --- a/src/mypy.ini +++ b/src/mypy.ini @@ -31,6 +31,9 @@ disallow_untyped_defs = True [mypy-cephadm.inventory] disallow_untyped_defs = True +[mypy-cephadm.schedule] +disallow_untyped_defs = True + # Make cephadm and rook happy [mypy-OpenSSL] ignore_missing_imports = True diff --git a/src/pybind/mgr/cephadm/schedule.py b/src/pybind/mgr/cephadm/schedule.py index 26bee82d9d5..e2e3c926ab9 100644 --- a/src/pybind/mgr/cephadm/schedule.py +++ b/src/pybind/mgr/cephadm/schedule.py @@ -36,7 +36,7 @@ class SimpleScheduler(BaseScheduler): 2) Select from list up to :count """ - def __init__(self, spec): + def __init__(self, spec: ServiceSpec): super(SimpleScheduler, self).__init__(spec) def place(self, host_pool, count=None): @@ -74,7 +74,7 @@ class HostAssignment(object): def get_hostnames(self) -> List[str]: return [h.hostname for h in self.hosts] - def validate(self): + def validate(self) -> None: self.spec.validate() if self.spec.placement.count == 0: @@ -186,7 +186,7 @@ class HostAssignment(object): # remove duplicates before returning return list(dict.fromkeys(active_hosts)) - def prefer_hosts_with_active_daemons(self, hosts: List[HostPlacementSpec], count) -> List[HostPlacementSpec]: + def prefer_hosts_with_active_daemons(self, hosts: List[HostPlacementSpec], count: int) -> List[HostPlacementSpec]: # try to prefer host with active daemon if possible active_hosts = self.get_hosts_with_active_daemon(hosts) if len(active_hosts) != 0 and count > 0: -- 2.47.3