diff options
author | John Snow | 2020-10-07 01:58:08 +0200 |
---|---|---|
committer | John Snow | 2020-10-20 15:37:57 +0200 |
commit | f12a282ff4728c8b66435eaddde589db41745beb (patch) | |
tree | c48a7857e616a5c30da5bd4ca0ba0e28d4fe95d6 /python/qemu/accel.py | |
parent | iotests.py: Adjust HMP kwargs typing (diff) | |
download | qemu-f12a282ff4728c8b66435eaddde589db41745beb.tar.gz qemu-f12a282ff4728c8b66435eaddde589db41745beb.tar.xz qemu-f12a282ff4728c8b66435eaddde589db41745beb.zip |
python/qemu: Add mypy type annotations
These should all be purely annotations with no changes in behavior at
all. You need to be in the python folder, but you should be able to
confirm that these annotations are correct (or at least self-consistent)
by running `mypy --strict qemu`.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20201006235817.3280413-12-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python/qemu/accel.py')
-rw-r--r-- | python/qemu/accel.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/qemu/accel.py b/python/qemu/accel.py index 3ec6bdcfdb..297933df2a 100644 --- a/python/qemu/accel.py +++ b/python/qemu/accel.py @@ -17,6 +17,7 @@ accelerators. import logging import os import subprocess +from typing import List, Optional LOG = logging.getLogger(__name__) @@ -30,7 +31,7 @@ ADDITIONAL_ARCHES = { } -def list_accel(qemu_bin): +def list_accel(qemu_bin: str) -> List[str]: """ List accelerators enabled in the QEMU binary. @@ -50,7 +51,8 @@ def list_accel(qemu_bin): return [acc.strip() for acc in out.splitlines()[1:]] -def kvm_available(target_arch=None, qemu_bin=None): +def kvm_available(target_arch: Optional[str] = None, + qemu_bin: Optional[str] = None) -> bool: """ Check if KVM is available using the following heuristic: - Kernel module is present in the host; @@ -73,7 +75,7 @@ def kvm_available(target_arch=None, qemu_bin=None): return True -def tcg_available(qemu_bin): +def tcg_available(qemu_bin: str) -> bool: """ Check if TCG is available. |