1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-01 00:21:59 +03:00

examples: Add/fix PEP 484 type annotation

Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
Philipp Hahn
2020-04-27 11:10:13 +02:00
committed by Philipp Hahn
parent 5434ed53ff
commit 9cf539a2a8
11 changed files with 129 additions and 120 deletions

View File

@ -6,19 +6,20 @@ import sys
import os
import libxml2
import pdb
from typing import Any
def usage():
def usage() -> None:
print('Usage: %s DOMAIN' % sys.argv[0])
print(' Print information about the domain DOMAIN')
def print_section(title):
def print_section(title: str) -> None:
print("\n%s" % title)
print("=" * 60)
def print_entry(key, value):
def print_entry(key: str, value: Any) -> None:
print("%-10s %-10s" % (key, value))
def print_xml(key, ctx, path):
def print_xml(key: str, ctx, path: str) -> str:
res = ctx.xpathEval(path)
if res is None or len(res) == 0:
value="Unknown"