From bb58be856a6d08b79e8b7565cd621a36ea9d744f Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Fri, 1 Nov 2024 14:36:35 -0400 Subject: [PATCH] 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 --- src/cephadm/cephadmlib/daemons/nvmeof.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cephadm/cephadmlib/daemons/nvmeof.py b/src/cephadm/cephadmlib/daemons/nvmeof.py index 2c20a900f45..2d523d517d6 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 -- 2.47.3