Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP5
virtme
0003-Add-more-typing-annotations.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-Add-more-typing-annotations.patch of Package virtme
From 21b44d23bb81b933c2c0c11f8d32548dc5b4c9d0 Mon Sep 17 00:00:00 2001 From: Andy Lutomirski <luto@kernel.org> Date: Sun, 19 Jul 2020 11:21:40 -0700 Subject: [PATCH 3/6] Add more typing annotations Signed-off-by: Andy Lutomirski <luto@kernel.org> --- virtme/architectures.py | 23 ++++++++++++----------- virtme/commands/run.py | 2 +- virtme/qemu_helpers.py | 10 +++++++--- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/virtme/architectures.py b/virtme/architectures.py index 35bd338..c284416 100644 --- a/virtme/architectures.py +++ b/virtme/architectures.py @@ -6,9 +6,10 @@ # 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 import os +from typing import List, Optional class Arch(object): - def __init__(self, name): + def __init__(self, name) -> None: self.virtmename = name self.qemuname = name self.linuxname = name @@ -17,40 +18,40 @@ class Arch(object): defconfig_target = 'defconfig' @staticmethod - def serial_dev_name(index): + def serial_dev_name(index) -> str: return 'ttyS%d' % index @staticmethod - def qemuargs(is_native): + def qemuargs(is_native) -> List[str]: return [] @staticmethod - def virtio_dev_type(virtiotype): + def virtio_dev_type(virtiotype) -> str: # Return a full name for a virtio device. It would be # nice if QEMU abstracted this away, but it doesn't. return 'virtio-%s-pci' % virtiotype @staticmethod - def earlyconsole_args(): + def earlyconsole_args() -> List[str]: return [] @staticmethod - def serial_console_args(): + def serial_console_args() -> List[str]: return [] @staticmethod - def qemu_nodisplay_args(): + def qemu_nodisplay_args() -> List[str]: return ['-vga', 'none', '-display', 'none'] @staticmethod - def config_base(): + def config_base() -> List[str]: return [] - def kimg_path(self): + def kimg_path(self) -> str: return 'arch/%s/boot/bzImage' % self.linuxname @staticmethod - def dtb_path(): + def dtb_path() -> Optional[str]: return None class Arch_unknown(Arch): @@ -294,7 +295,7 @@ ARCHES = {arch.virtmename: arch for arch in [ Arch_s390x(), ]} -def get(arch): +def get(arch: str) -> Arch: if arch in ARCHES: return ARCHES[arch] else: diff --git a/virtme/commands/run.py b/virtme/commands/run.py index 46cf312..ec8fc28 100644 --- a/virtme/commands/run.py +++ b/virtme/commands/run.py @@ -418,7 +418,7 @@ def do_it() -> int: has_script = False - def do_script(shellcmd, use_exec=False, show_boot_console=False): + def do_script(shellcmd: str, use_exec=False, show_boot_console=False) -> None: if args.graphics: arg_fail('scripts and --graphics are mutually exclusive') diff --git a/virtme/qemu_helpers.py b/virtme/qemu_helpers.py index 6ba0c03..96ed693 100644 --- a/virtme/qemu_helpers.py +++ b/virtme/qemu_helpers.py @@ -9,9 +9,13 @@ import os import re import shutil import subprocess +from typing import Optional class Qemu(object): - def __init__(self, arch): + qemubin: str + version: Optional[str] + + def __init__(self, arch) -> None: self.arch = arch qemubin = shutil.which('qemu-system-%s' % arch) @@ -23,7 +27,7 @@ class Qemu(object): self.qemubin = qemubin self.version = None - def probe(self): + def probe(self) -> None: if self.version is None: self.version = subprocess.check_output([self.qemubin, '--version'])\ .decode('utf-8') @@ -34,7 +38,7 @@ class Qemu(object): self.has_multidevs = ( re.search(r'version (?:1\.|2\.|3\.|4\.[01][^\d])', self.version) is None) - def quote_optarg(self, a): + def quote_optarg(self, a: str) -> str: """Quote an argument to an option.""" return a.replace(',', ',,') -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor