From: Sebastian Wagner Date: Fri, 20 Nov 2020 11:06:59 +0000 (+0100) Subject: mgr/cephadm: make annotations for schedule.py mandatory X-Git-Tag: v15.2.9~88^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4821e6e4f21e31a5ba89d6de622833f059f3ed6;p=ceph.git mgr/cephadm: make annotations for schedule.py mandatory Signed-off-by: Sebastian Wagner (cherry picked from commit ba3189b13882ff919ad39a2e377fa6b29c04c79a) Conflicts: src/mypy.ini --- diff --git a/src/mypy.ini b/src/mypy.ini index 94f852f5e515..a736839c88e7 100755 --- a/src/mypy.ini +++ b/src/mypy.ini @@ -18,3 +18,6 @@ disallow_untyped_defs = True [mypy-cephadm.inventory] disallow_untyped_defs = True +[mypy-cephadm.schedule] +disallow_untyped_defs = True + diff --git a/src/pybind/mgr/cephadm/schedule.py b/src/pybind/mgr/cephadm/schedule.py index 26bee82d9d5d..e2e3c926ab91 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: