mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-17 00:59:36 +03:00
examples: Cleanup imports
Break import into multiple lines as recommended by PEP-8 Move imports to top Remove unused imports Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
committed by
Philipp Hahn
parent
4e22f4de6f
commit
f496dc55ee
@ -1,7 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# consolecallback - provide a persistent console that survives guest reboots
|
# consolecallback - provide a persistent console that survives guest reboots
|
||||||
|
|
||||||
import sys, os, logging, libvirt, tty, termios, atexit
|
import os
|
||||||
|
import logging
|
||||||
|
import libvirt
|
||||||
|
import tty
|
||||||
|
import termios
|
||||||
|
import atexit
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Optional # noqa F401
|
from typing import Optional # noqa F401
|
||||||
|
|
||||||
|
@ -5,9 +5,7 @@ Print information about the domain DOMAIN
|
|||||||
|
|
||||||
import libvirt
|
import libvirt
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import libxml2
|
import libxml2
|
||||||
import pdb
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -69,7 +67,7 @@ print_section("Devices")
|
|||||||
devs = ctx.xpathEval("/domain/devices/*")
|
devs = ctx.xpathEval("/domain/devices/*")
|
||||||
for d in devs:
|
for d in devs:
|
||||||
ctx.setContextNode(d)
|
ctx.setContextNode(d)
|
||||||
#pdb.set_trace()
|
# import pdb; pdb.set_trace()
|
||||||
type = print_xml("Type:", ctx, "@type")
|
type = print_xml("Type:", ctx, "@type")
|
||||||
if type == "file":
|
if type == "file":
|
||||||
print_xml("Source:", ctx, "source/@file")
|
print_xml("Source:", ctx, "source/@file")
|
||||||
|
@ -7,8 +7,6 @@ It is assumed that all files in DIR are images of domU's previously created with
|
|||||||
import libvirt
|
import libvirt
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import libxml2
|
|
||||||
import pdb
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@ DIR must exist and be writable by this process.
|
|||||||
import libvirt
|
import libvirt
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import libxml2
|
|
||||||
import pdb
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
|
||||||
@ -35,4 +33,4 @@ for id in doms:
|
|||||||
else:
|
else:
|
||||||
print("error %d" % ret)
|
print("error %d" % ret)
|
||||||
|
|
||||||
#pdb.set_trace()
|
# import pdb; pdb.set_trace()
|
||||||
|
@ -6,9 +6,7 @@ If the domain is not running, create it.
|
|||||||
|
|
||||||
import libvirt
|
import libvirt
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import libxml2
|
import libxml2
|
||||||
import pdb
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ List active domains of an ESX host and print some info.
|
|||||||
|
|
||||||
import libvirt
|
import libvirt
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import libxml2
|
import libxml2
|
||||||
import getpass
|
import getpass
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
@ -9,8 +9,6 @@ import libvirt
|
|||||||
import threading
|
import threading
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
import time
|
import time
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
uri = "qemu:///system"
|
uri = "qemu:///system"
|
||||||
|
@ -8,7 +8,8 @@ VOLUME into local FILE while preserving FILE/VOLUME sparseness
|
|||||||
# Authors:
|
# Authors:
|
||||||
# Michal Privoznik <mprivozn@redhat.com>
|
# Michal Privoznik <mprivozn@redhat.com>
|
||||||
|
|
||||||
import libvirt, sys, os
|
import libvirt
|
||||||
|
import os
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
def bytesWriteHandler(stream: libvirt.virStream, buf: bytes, opaque: int) -> int:
|
def bytesWriteHandler(stream: libvirt.virStream, buf: bytes, opaque: int) -> int:
|
||||||
|
Reference in New Issue
Block a user