Skip to content

Commit bb58be8

Browse files
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 <[email protected]>
1 parent 6405f75 commit bb58be8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/cephadm/cephadmlib/daemons/nvmeof.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ def for_daemon_type(cls, daemon_type: str) -> bool:
3333
return cls.daemon_type == daemon_type
3434

3535
def __init__(
36-
self, ctx, fsid, daemon_id, config_json, image=DEFAULT_NVMEOF_IMAGE
37-
):
38-
# type: (CephadmContext, str, Union[int, str], Dict, str) -> None
36+
self,
37+
ctx: CephadmContext,
38+
fsid: str,
39+
daemon_id: Union[int, str],
40+
config_json: Dict,
41+
image: str = DEFAULT_NVMEOF_IMAGE,
42+
) -> None:
3943
self.ctx = ctx
4044
self.fsid = fsid
4145
self.daemon_id = daemon_id
@@ -48,8 +52,9 @@ def __init__(
4852
self.validate()
4953

5054
@classmethod
51-
def init(cls, ctx, fsid, daemon_id):
52-
# type: (CephadmContext, str, Union[int, str]) -> CephNvmeof
55+
def init(
56+
cls, ctx: CephadmContext, fsid: str, daemon_id: Union[int, str]
57+
) -> 'CephNvmeof':
5358
return cls(ctx, fsid, daemon_id, fetch_configs(ctx), ctx.image)
5459

5560
@classmethod

0 commit comments

Comments
 (0)