Fix warnings with latest pep8
This commit is contained in:
parent
cddb9cc426
commit
196ff823b3
|
@ -123,12 +123,10 @@ test_files = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# Test class helpers #
|
# Test class helpers #
|
||||||
######################
|
######################
|
||||||
|
|
||||||
|
|
||||||
class Command(object):
|
class Command(object):
|
||||||
"""
|
"""
|
||||||
Instance of a single cli command to test
|
Instance of a single cli command to test
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
format = pylint
|
format = pylint
|
||||||
|
|
||||||
# E12*: # Continuation line indents
|
# E1* : # Continuation line indents
|
||||||
# E203: # Space before : in dictionary defs
|
# E203: # Space before : in dictionary defs
|
||||||
# E221: # Multiple spaces before operator
|
# E221: # Multiple spaces before operator
|
||||||
# (warngs about column aligning assigments)
|
# (warngs about column aligning assigments)
|
||||||
|
@ -11,4 +11,4 @@ format = pylint
|
||||||
# E303: # Too many blank lines
|
# E303: # Too many blank lines
|
||||||
# E501: # Line too long
|
# E501: # Line too long
|
||||||
|
|
||||||
ignore=E121,E122,E123,E124,E125,E126,E127,E128,E203,E221,E241,E301,E303,E501
|
ignore=E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E203,E221,E241,E301,E303,E501
|
||||||
|
|
|
@ -188,10 +188,10 @@ class TestStorage(unittest.TestCase):
|
||||||
|
|
||||||
# Test creating with many devices
|
# Test creating with many devices
|
||||||
# XXX: Need to wire this up
|
# XXX: Need to wire this up
|
||||||
#createPool(self.conn,
|
# createPool(self.conn,
|
||||||
# StoragePool.TYPE_LOGICAL, "pool-logical-manydev",
|
# StoragePool.TYPE_LOGICAL, "pool-logical-manydev",
|
||||||
# source_path=["/tmp/path1", "/tmp/path2", "/tmp/path3"],
|
# source_path=["/tmp/path1", "/tmp/path2", "/tmp/path3"],
|
||||||
# target_path=None)
|
# target_path=None)
|
||||||
|
|
||||||
def testDiskPool(self):
|
def testDiskPool(self):
|
||||||
poolobj = createPool(self.conn,
|
poolobj = createPool(self.conn,
|
||||||
|
|
|
@ -870,7 +870,7 @@ class TestXMLConfig(unittest.TestCase):
|
||||||
g.add_device(redir1)
|
g.add_device(redir1)
|
||||||
g.add_device(redir2)
|
g.add_device(redir2)
|
||||||
|
|
||||||
#Panic Notifier device
|
# Panic Notifier device
|
||||||
pdev = VirtualPanicDevice(g.conn)
|
pdev = VirtualPanicDevice(g.conn)
|
||||||
g.add_device(pdev)
|
g.add_device(pdev)
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ from virtinst import Cloner
|
||||||
from virtinst.cli import fail, print_stdout, print_stderr
|
from virtinst.cli import fail, print_stdout, print_stderr
|
||||||
|
|
||||||
|
|
||||||
### General input gathering functions
|
# General input gathering functions
|
||||||
def get_clone_name(new_name, auto_clone, design):
|
def get_clone_name(new_name, auto_clone, design):
|
||||||
if not new_name and auto_clone:
|
if not new_name and auto_clone:
|
||||||
# Generate a name to use
|
# Generate a name to use
|
||||||
|
|
|
@ -33,7 +33,7 @@ from virtinst.cli import fail, print_stdout, print_stderr
|
||||||
from virtinst import virtimage
|
from virtinst import virtimage
|
||||||
|
|
||||||
|
|
||||||
### Option parsing
|
# Option parsing
|
||||||
def parse_args():
|
def parse_args():
|
||||||
parser = cli.setupParser(
|
parser = cli.setupParser(
|
||||||
"%(prog)s image.xml [OPTIONS]",
|
"%(prog)s image.xml [OPTIONS]",
|
||||||
|
|
|
@ -241,8 +241,8 @@ class OverBox(Gtk.Box):
|
||||||
# There's something weird here with destroying this gdk window,
|
# There's something weird here with destroying this gdk window,
|
||||||
# then destroying the over/under widgets. Error seems harmless
|
# then destroying the over/under widgets. Error seems harmless
|
||||||
# but lets shut it up anyways.
|
# but lets shut it up anyways.
|
||||||
#self.underWin.destroy()
|
# self.underWin.destroy()
|
||||||
#self.overWin.destroy()
|
# self.overWin.destroy()
|
||||||
|
|
||||||
self.underWin = None
|
self.underWin = None
|
||||||
self.overWin = None
|
self.overWin = None
|
||||||
|
|
|
@ -2439,7 +2439,7 @@ class vmmDetails(vmmGObjectUI):
|
||||||
|
|
||||||
# Machine settings
|
# Machine settings
|
||||||
machtype = self.vm.get_machtype()
|
machtype = self.vm.get_machtype()
|
||||||
if not arch in ["i686", "x86_64"]:
|
if arch not in ["i686", "x86_64"]:
|
||||||
if machtype is not None:
|
if machtype is not None:
|
||||||
uiutil.set_combo_entry(self.widget("machine-type"), machtype)
|
uiutil.set_combo_entry(self.widget("machine-type"), machtype)
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class vmmErrorDialog(vmmGObject):
|
||||||
logging.debug(debugmsg)
|
logging.debug(debugmsg)
|
||||||
|
|
||||||
# Make sure we have consistent details for error dialogs
|
# Make sure we have consistent details for error dialogs
|
||||||
if (dialog_type == Gtk.MessageType.ERROR and not summary in details):
|
if (dialog_type == Gtk.MessageType.ERROR and summary not in details):
|
||||||
details = summary + "\n\n" + details
|
details = summary + "\n\n" + details
|
||||||
|
|
||||||
dialog = _errorDialog(parent=self.get_parent(),
|
dialog = _errorDialog(parent=self.get_parent(),
|
||||||
|
|
|
@ -301,10 +301,10 @@ class vmmPreferences(vmmGObjectUI):
|
||||||
dialog.set_default_size(325, 160)
|
dialog.set_default_size(325, 160)
|
||||||
dialog.set_border_width(6)
|
dialog.set_border_width(6)
|
||||||
|
|
||||||
infolabel = Gtk.Label(label=
|
infolabel = Gtk.Label(
|
||||||
_("You can now define grab keys by pressing them.\n"
|
label=_("You can now define grab keys by pressing them.\n"
|
||||||
"To confirm your selection please click OK button\n"
|
"To confirm your selection please click OK button\n"
|
||||||
"while you have desired keys pressed."))
|
"while you have desired keys pressed."))
|
||||||
keylabel = Gtk.Label(label=_("Please press desired grab key combination"))
|
keylabel = Gtk.Label(label=_("Please press desired grab key combination"))
|
||||||
|
|
||||||
vbox = Gtk.VBox()
|
vbox = Gtk.VBox()
|
||||||
|
|
|
@ -282,7 +282,7 @@ class vmmSerialConsole(vmmGObject):
|
||||||
"connection")
|
"connection")
|
||||||
elif not vm.is_active():
|
elif not vm.is_active():
|
||||||
err = _("Serial console not available for inactive guest")
|
err = _("Serial console not available for inactive guest")
|
||||||
elif not ctype in usable_types:
|
elif ctype not in usable_types:
|
||||||
err = (_("Console for device type '%s' not yet supported") %
|
err = (_("Console for device type '%s' not yet supported") %
|
||||||
ctype)
|
ctype)
|
||||||
elif (not is_remote and
|
elif (not is_remote and
|
||||||
|
|
|
@ -230,7 +230,7 @@ class vmmSystray(vmmGObject):
|
||||||
self.populate_vm_list(conn)
|
self.populate_vm_list(conn)
|
||||||
|
|
||||||
def conn_removed(self, engine_ignore, uri):
|
def conn_removed(self, engine_ignore, uri):
|
||||||
if not uri in self.conn_menuitems:
|
if uri not in self.conn_menuitems:
|
||||||
return
|
return
|
||||||
|
|
||||||
menu_item = self.conn_menuitems[uri]
|
menu_item = self.conn_menuitems[uri]
|
||||||
|
|
|
@ -285,7 +285,7 @@ def _import_file(doc, ctx, conn, input_file):
|
||||||
ifaces = []
|
ifaces = []
|
||||||
for node in ctx.xpathEval(vhbase % DEVICE_ETHERNET):
|
for node in ctx.xpathEval(vhbase % DEVICE_ETHERNET):
|
||||||
iface = virtinst.VirtualNetworkInterface(conn)
|
iface = virtinst.VirtualNetworkInterface(conn)
|
||||||
# XXX: Just ignore 'source' info and choose the default
|
# XXX: Just ignore 'source' info and choose the default
|
||||||
net_model = _get_child_content(node, "ResourceSubType")
|
net_model = _get_child_content(node, "ResourceSubType")
|
||||||
if net_model and not net_model.isdigit():
|
if net_model and not net_model.isdigit():
|
||||||
iface.model = net_model.lower()
|
iface.model = net_model.lower()
|
||||||
|
|
|
@ -226,7 +226,7 @@ class CPU(object):
|
||||||
self.threads = 1
|
self.threads = 1
|
||||||
self.features = CapabilityFeatures()
|
self.features = CapabilityFeatures()
|
||||||
|
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
@ -268,7 +268,7 @@ class Host(object):
|
||||||
self.topology = None
|
self.topology = None
|
||||||
self.secmodels = []
|
self.secmodels = []
|
||||||
|
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def get_secmodel(self):
|
def get_secmodel(self):
|
||||||
|
@ -301,7 +301,7 @@ class Guest(object):
|
||||||
|
|
||||||
self.features = CapabilityFeatures()
|
self.features = CapabilityFeatures()
|
||||||
|
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
@ -408,7 +408,7 @@ class Topology(object):
|
||||||
def __init__(self, node=None):
|
def __init__(self, node=None):
|
||||||
self.cells = []
|
self.cells = []
|
||||||
|
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
@ -424,7 +424,7 @@ class TopologyCell(object):
|
||||||
self.id = None
|
self.id = None
|
||||||
self.cpus = []
|
self.cpus = []
|
||||||
|
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
@ -440,7 +440,7 @@ class TopologyCPU(object):
|
||||||
def __init__(self, node=None):
|
def __init__(self, node=None):
|
||||||
self.id = None
|
self.id = None
|
||||||
|
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
@ -453,7 +453,7 @@ class SecurityModel(object):
|
||||||
self.doi = None
|
self.doi = None
|
||||||
self.baselabels = {}
|
self.baselabels = {}
|
||||||
|
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
|
|
@ -117,7 +117,7 @@ def setupLogging(appname, debug_stdout, do_quiet, cli_app=True):
|
||||||
quiet = do_quiet
|
quiet = do_quiet
|
||||||
|
|
||||||
vi_dir = None
|
vi_dir = None
|
||||||
if not "VIRTINST_TEST_SUITE" in os.environ:
|
if "VIRTINST_TEST_SUITE" not in os.environ:
|
||||||
vi_dir = util.get_cache_dir()
|
vi_dir = util.get_cache_dir()
|
||||||
|
|
||||||
if vi_dir and not os.access(vi_dir, os.W_OK):
|
if vi_dir and not os.access(vi_dir, os.W_OK):
|
||||||
|
@ -1421,7 +1421,7 @@ class ParserBoot(VirtCLIParser):
|
||||||
# Build boot order
|
# Build boot order
|
||||||
boot_order = []
|
boot_order = []
|
||||||
for cliname, ignore in opts.orderedopts:
|
for cliname, ignore in opts.orderedopts:
|
||||||
if not cliname in inst.os.BOOT_DEVICES:
|
if cliname not in inst.os.BOOT_DEVICES:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
del(opts.opts[cliname])
|
del(opts.opts[cliname])
|
||||||
|
|
|
@ -167,7 +167,7 @@ def _rhel4_initrd_inject(initrd, injections):
|
||||||
file_proc = subprocess.Popen(["file", "-z", initrd],
|
file_proc = subprocess.Popen(["file", "-z", initrd],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
if not "ext2 filesystem" in file_proc.communicate()[0]:
|
if "ext2 filesystem" not in file_proc.communicate()[0]:
|
||||||
return False
|
return False
|
||||||
except:
|
except:
|
||||||
logging.exception("Failed to file command for rhel4 initrd detection")
|
logging.exception("Failed to file command for rhel4 initrd detection")
|
||||||
|
|
|
@ -97,7 +97,7 @@ def _sort(tosort, sortpref=None):
|
||||||
sorted_distro_list.sort()
|
sorted_distro_list.sort()
|
||||||
sortpref.reverse()
|
sortpref.reverse()
|
||||||
for prefer in sortpref:
|
for prefer in sortpref:
|
||||||
if not prefer in sorted_distro_list:
|
if prefer not in sorted_distro_list:
|
||||||
continue
|
continue
|
||||||
sorted_distro_list.remove(prefer)
|
sorted_distro_list.remove(prefer)
|
||||||
sorted_distro_list.insert(0, prefer)
|
sorted_distro_list.insert(0, prefer)
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Image(object):
|
||||||
self.descr = None
|
self.descr = None
|
||||||
self.version = None
|
self.version = None
|
||||||
self.release = None
|
self.release = None
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def abspath(self, p):
|
def abspath(self, p):
|
||||||
|
@ -97,7 +97,7 @@ class Domain(object):
|
||||||
self.memory = None
|
self.memory = None
|
||||||
self.interface = 0
|
self.interface = 0
|
||||||
self.graphics = None
|
self.graphics = None
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
@ -151,7 +151,7 @@ class Boot(object):
|
||||||
self.drives = []
|
self.drives = []
|
||||||
self.arch = None
|
self.arch = None
|
||||||
self.features = ImageFeatures()
|
self.features = ImageFeatures()
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
@ -221,7 +221,7 @@ class Disk(object):
|
||||||
self.size = None
|
self.size = None
|
||||||
self.use = None
|
self.use = None
|
||||||
self.csum = {}
|
self.csum = {}
|
||||||
if not node is None:
|
if node is not None:
|
||||||
self.parseXML(node)
|
self.parseXML(node)
|
||||||
|
|
||||||
def parseXML(self, node):
|
def parseXML(self, node):
|
||||||
|
|
Loading…
Reference in New Issue