From: John Mulligan Date: Fri, 1 Nov 2024 18:36:35 +0000 (-0400) Subject: cephadm: update some type annotations X-Git-Tag: v20.0.0~647^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bb58be856a6d08b79e8b7565cd621a36ea9d744f;p=ceph.git cephadm: update some type annotations Update some function typing from the old comment based style to the current type annotations style. Not only does this modernize the code but it fixes issues found by newer versions of flake8 that were flagging types only referenced in type comments as unused imports. Part of an effort to get ceph tox environments passing on Python 3.12. Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadmlib/daemons/nvmeof.py b/src/cephadm/cephadmlib/daemons/nvmeof.py index 2c20a900f45c..2d523d517d6c 100644 --- a/src/cephadm/cephadmlib/daemons/nvmeof.py +++ b/src/cephadm/cephadmlib/daemons/nvmeof.py @@ -33,9 +33,13 @@ class CephNvmeof(ContainerDaemonForm): return cls.daemon_type == daemon_type def __init__( - self, ctx, fsid, daemon_id, config_json, image=DEFAULT_NVMEOF_IMAGE - ): - # type: (CephadmContext, str, Union[int, str], Dict, str) -> None + self, + ctx: CephadmContext, + fsid: str, + daemon_id: Union[int, str], + config_json: Dict, + image: str = DEFAULT_NVMEOF_IMAGE, + ) -> None: self.ctx = ctx self.fsid = fsid self.daemon_id = daemon_id @@ -48,8 +52,9 @@ class CephNvmeof(ContainerDaemonForm): self.validate() @classmethod - def init(cls, ctx, fsid, daemon_id): - # type: (CephadmContext, str, Union[int, str]) -> CephNvmeof + def init( + cls, ctx: CephadmContext, fsid: str, daemon_id: Union[int, str] + ) -> 'CephNvmeof': return cls(ctx, fsid, daemon_id, fetch_configs(ctx), ctx.image) @classmethod