From 2e50b74e93eb2d666196b4dbb611386d59bc3ca9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristoffer=20Gr=C3=B6nlund?= Date: Fri, 21 Feb 2020 14:40:43 +0100 Subject: [PATCH] cephadm: Normalize mypy annotations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Try to use `# type: ...` consistently. Signed-off-by: Kristoffer Grönlund --- src/cephadm/cephadm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 56a978c1064..afe33a71280 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -515,7 +515,7 @@ def call_throws(command, **kwargs): def call_timeout(command, timeout): - #type (List[str], int) -> int + # type: (List[str], int) -> int logger.debug('Running command (timeout=%s): %s' % (timeout, ' '.join(command))) @@ -526,7 +526,7 @@ def call_timeout(command, timeout): raise TimeoutExpired(msg) def call_timeout_py2(command, timeout): - #type (List[str], int) -> int + # type: (List[str], int) -> int proc = subprocess.Popen(command) thread = Thread(target=proc.wait) thread.start() @@ -538,7 +538,7 @@ def call_timeout(command, timeout): return proc.returncode def call_timeout_py3(command, timeout): - #type (List[str], int) -> int + # type: (List[str], int) -> int try: return subprocess.call(command, timeout=timeout) except subprocess.TimeoutExpired as e: @@ -555,7 +555,7 @@ def call_timeout(command, timeout): ################################## def is_available(what, func): - # type (str, func, Optional[int]) -> func + # type: (str, func, Optional[int]) -> func """ Wait for a service to become available @@ -656,6 +656,7 @@ def generate_password(): for i in range(10)) def normalize_container_id(i): + # type: (str) -> str # docker adds the sha256: prefix, but AFAICS both # docker (18.09.7 in bionic at least) and podman # both always use sha256, so leave off the prefix @@ -853,7 +854,7 @@ def find_program(filename): return name def get_unit_name(fsid, daemon_type, daemon_id=None): - # type (str, str, Optional[Union[int, str]]) -> str + # type: (str, str, Optional[Union[int, str]]) -> str # accept either name or type + id if daemon_id is not None: return 'ceph-%s@%s.%s' % (fsid, daemon_type, daemon_id) -- 2.39.5