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: v16.1.0~348^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38208%2Fhead;p=ceph.git mgr/cephadm: make annotations for schedule.py mandatory Signed-off-by: Sebastian Wagner --- diff --git a/src/mypy.ini b/src/mypy.ini index de3ed392d3e4..0a0737659bb3 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 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: