]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: update some type annotations
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 1 Nov 2024 18:36:26 +0000 (14:36 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Mon, 4 Nov 2024 20:38:43 +0000 (15:38 -0500)
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 <jmulligan@redhat.com>
src/cephadm/cephadmlib/daemons/nfs.py

index f09374d5f4648b8220b99ee9764d708099615cfc..70ccea65b5b44acae8b6124dca61301589d3254b 100644 (file)
@@ -42,9 +42,13 @@ class NFSGanesha(ContainerDaemonForm):
         return cls.daemon_type == daemon_type
 
     def __init__(
-        self, ctx, fsid, daemon_id, config_json, image=DEFAULT_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_IMAGE,
+    ) -> None:
         self.ctx = ctx
         self.fsid = fsid
         self.daemon_id = daemon_id
@@ -62,8 +66,9 @@ class NFSGanesha(ContainerDaemonForm):
         self.validate()
 
     @classmethod
-    def init(cls, ctx, fsid, daemon_id):
-        # type: (CephadmContext, str, Union[int, str]) -> NFSGanesha
+    def init(
+        cls, ctx: CephadmContext, fsid: str, daemon_id: Union[int, str]
+    ) -> 'NFSGanesha':
         return cls(ctx, fsid, daemon_id, fetch_configs(ctx), ctx.image)
 
     @classmethod