From: John Mulligan Date: Fri, 1 Nov 2024 18:35:46 +0000 (-0400) Subject: cephadm: update some type annotations X-Git-Tag: v20.0.0~647^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a141ffb7b1583dbd589ab2e02a5e0ee955e3f3c8;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/call_wrappers.py b/src/cephadm/cephadmlib/call_wrappers.py index 3fe2171e99d..d3d327c218c 100644 --- a/src/cephadm/cephadmlib/call_wrappers.py +++ b/src/cephadm/cephadmlib/call_wrappers.py @@ -311,14 +311,14 @@ def call_throws( return out, err, ret -def call_timeout(ctx, command, timeout): - # type: (CephadmContext, List[str], int) -> int +def call_timeout( + ctx: CephadmContext, command: List[str], timeout: int +) -> int: logger.debug( 'Running command (timeout=%s): %s' % (timeout, ' '.join(command)) ) - def raise_timeout(command, timeout): - # type: (List[str], int) -> NoReturn + def raise_timeout(command: List[str], timeout: int) -> NoReturn: msg = 'Command `%s` timed out after %s seconds' % (command, timeout) logger.debug(msg) raise TimeoutExpired(msg)