diff options
author | Alberto Contreras <aciba90@gmail.com> | 2022-05-23 18:30:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-23 11:30:00 -0500 |
commit | 53a995e2f852d043d51ad25c1b9afbbe1edafd57 (patch) | |
tree | a91be715e11a2cc509a4c953e8f456154ed60589 /cloudinit/util.py | |
parent | 4938c9c1407cdc21daabd70791300c3058a16f71 (diff) | |
download | cloud-init-git-53a995e2f852d043d51ad25c1b9afbbe1edafd57.tar.gz |
Drop mypy excluded files (#1454)
- Add types to let mypy pass.
- Add mypy flags:
- detect unused ignores
- redundant casts
- Drop support of `ConfigParser` in Python 2
- Harden DataSourceLXD.network_config
- Convert old-style commented types to proper types.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 2639478a..1cf10885 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -35,7 +35,7 @@ from base64 import b64decode, b64encode from collections import deque from errno import EACCES, ENOENT from functools import lru_cache -from typing import List +from typing import Callable, List, TypeVar from urllib import parse from cloudinit import importer @@ -2618,7 +2618,17 @@ def get_mount_info(path, log=LOG, get_mnt_opts=False): return parse_mount(path) -def log_time(logfunc, msg, func, args=None, kwargs=None, get_uptime=False): +T = TypeVar("T") + + +def log_time( + logfunc, + msg, + func: Callable[..., T], + args=None, + kwargs=None, + get_uptime=False, +) -> T: if args is None: args = [] if kwargs is None: |