From 196ff823b3543981cf60e812200f67d5e0550e6a Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Fri, 2 May 2014 10:20:59 -0400 Subject: [PATCH] Fix warnings with latest pep8 --- tests/clitest.py | 2 -- tests/pep8.cfg | 4 ++-- tests/storage.py | 8 ++++---- tests/xmlconfig.py | 2 +- virt-clone | 2 +- virt-image | 2 +- virtManager/autodrawer.py | 4 ++-- virtManager/details.py | 2 +- virtManager/error.py | 2 +- virtManager/preferences.py | 8 ++++---- virtManager/serialcon.py | 2 +- virtManager/systray.py | 2 +- virtconv/ovf.py | 2 +- virtinst/capabilities.py | 14 +++++++------- virtinst/cli.py | 4 ++-- virtinst/distroinstaller.py | 2 +- virtinst/osdict.py | 2 +- virtinst/virtimage.py | 8 ++++---- 18 files changed, 35 insertions(+), 37 deletions(-) diff --git a/tests/clitest.py b/tests/clitest.py index 60827120..3810aefe 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -123,12 +123,10 @@ test_files = { } - ###################### # Test class helpers # ###################### - class Command(object): """ Instance of a single cli command to test diff --git a/tests/pep8.cfg b/tests/pep8.cfg index c02241e1..a375c6a0 100644 --- a/tests/pep8.cfg +++ b/tests/pep8.cfg @@ -2,7 +2,7 @@ format = pylint -# E12*: # Continuation line indents +# E1* : # Continuation line indents # E203: # Space before : in dictionary defs # E221: # Multiple spaces before operator # (warngs about column aligning assigments) @@ -11,4 +11,4 @@ format = pylint # E303: # Too many blank lines # 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 diff --git a/tests/storage.py b/tests/storage.py index 154ef368..60422ddb 100644 --- a/tests/storage.py +++ b/tests/storage.py @@ -188,10 +188,10 @@ class TestStorage(unittest.TestCase): # Test creating with many devices # XXX: Need to wire this up - #createPool(self.conn, - # StoragePool.TYPE_LOGICAL, "pool-logical-manydev", - # source_path=["/tmp/path1", "/tmp/path2", "/tmp/path3"], - # target_path=None) + # createPool(self.conn, + # StoragePool.TYPE_LOGICAL, "pool-logical-manydev", + # source_path=["/tmp/path1", "/tmp/path2", "/tmp/path3"], + # target_path=None) def testDiskPool(self): poolobj = createPool(self.conn, diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py index 0e0019f4..914653d9 100644 --- a/tests/xmlconfig.py +++ b/tests/xmlconfig.py @@ -870,7 +870,7 @@ class TestXMLConfig(unittest.TestCase): g.add_device(redir1) g.add_device(redir2) - #Panic Notifier device + # Panic Notifier device pdev = VirtualPanicDevice(g.conn) g.add_device(pdev) diff --git a/virt-clone b/virt-clone index 1facd0bf..4bd5ca3a 100755 --- a/virt-clone +++ b/virt-clone @@ -31,7 +31,7 @@ from virtinst import Cloner 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): if not new_name and auto_clone: # Generate a name to use diff --git a/virt-image b/virt-image index 60e38aed..95562ce9 100755 --- a/virt-image +++ b/virt-image @@ -33,7 +33,7 @@ from virtinst.cli import fail, print_stdout, print_stderr from virtinst import virtimage -### Option parsing +# Option parsing def parse_args(): parser = cli.setupParser( "%(prog)s image.xml [OPTIONS]", diff --git a/virtManager/autodrawer.py b/virtManager/autodrawer.py index 2cb9a007..120c459a 100644 --- a/virtManager/autodrawer.py +++ b/virtManager/autodrawer.py @@ -241,8 +241,8 @@ class OverBox(Gtk.Box): # There's something weird here with destroying this gdk window, # then destroying the over/under widgets. Error seems harmless # but lets shut it up anyways. - #self.underWin.destroy() - #self.overWin.destroy() + # self.underWin.destroy() + # self.overWin.destroy() self.underWin = None self.overWin = None diff --git a/virtManager/details.py b/virtManager/details.py index 30a68c1f..3cce4bc7 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -2439,7 +2439,7 @@ class vmmDetails(vmmGObjectUI): # Machine settings machtype = self.vm.get_machtype() - if not arch in ["i686", "x86_64"]: + if arch not in ["i686", "x86_64"]: if machtype is not None: uiutil.set_combo_entry(self.widget("machine-type"), machtype) diff --git a/virtManager/error.py b/virtManager/error.py index 3c6f39d7..50f71990 100644 --- a/virtManager/error.py +++ b/virtManager/error.py @@ -80,7 +80,7 @@ class vmmErrorDialog(vmmGObject): logging.debug(debugmsg) # 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 dialog = _errorDialog(parent=self.get_parent(), diff --git a/virtManager/preferences.py b/virtManager/preferences.py index d63cdf33..eccb6993 100644 --- a/virtManager/preferences.py +++ b/virtManager/preferences.py @@ -301,10 +301,10 @@ class vmmPreferences(vmmGObjectUI): dialog.set_default_size(325, 160) dialog.set_border_width(6) - infolabel = Gtk.Label(label= - _("You can now define grab keys by pressing them.\n" - "To confirm your selection please click OK button\n" - "while you have desired keys pressed.")) + infolabel = Gtk.Label( + label=_("You can now define grab keys by pressing them.\n" + "To confirm your selection please click OK button\n" + "while you have desired keys pressed.")) keylabel = Gtk.Label(label=_("Please press desired grab key combination")) vbox = Gtk.VBox() diff --git a/virtManager/serialcon.py b/virtManager/serialcon.py index 6662084d..21534c9c 100644 --- a/virtManager/serialcon.py +++ b/virtManager/serialcon.py @@ -282,7 +282,7 @@ class vmmSerialConsole(vmmGObject): "connection") elif not vm.is_active(): 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") % ctype) elif (not is_remote and diff --git a/virtManager/systray.py b/virtManager/systray.py index b0898339..679f19b9 100644 --- a/virtManager/systray.py +++ b/virtManager/systray.py @@ -230,7 +230,7 @@ class vmmSystray(vmmGObject): self.populate_vm_list(conn) def conn_removed(self, engine_ignore, uri): - if not uri in self.conn_menuitems: + if uri not in self.conn_menuitems: return menu_item = self.conn_menuitems[uri] diff --git a/virtconv/ovf.py b/virtconv/ovf.py index 31609432..9521a1c3 100644 --- a/virtconv/ovf.py +++ b/virtconv/ovf.py @@ -285,7 +285,7 @@ def _import_file(doc, ctx, conn, input_file): ifaces = [] for node in ctx.xpathEval(vhbase % DEVICE_ETHERNET): 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") if net_model and not net_model.isdigit(): iface.model = net_model.lower() diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py index aadb1603..455633f5 100644 --- a/virtinst/capabilities.py +++ b/virtinst/capabilities.py @@ -226,7 +226,7 @@ class CPU(object): self.threads = 1 self.features = CapabilityFeatures() - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): @@ -268,7 +268,7 @@ class Host(object): self.topology = None self.secmodels = [] - if not node is None: + if node is not None: self.parseXML(node) def get_secmodel(self): @@ -301,7 +301,7 @@ class Guest(object): self.features = CapabilityFeatures() - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): @@ -408,7 +408,7 @@ class Topology(object): def __init__(self, node=None): self.cells = [] - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): @@ -424,7 +424,7 @@ class TopologyCell(object): self.id = None self.cpus = [] - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): @@ -440,7 +440,7 @@ class TopologyCPU(object): def __init__(self, node=None): self.id = None - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): @@ -453,7 +453,7 @@ class SecurityModel(object): self.doi = None self.baselabels = {} - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): diff --git a/virtinst/cli.py b/virtinst/cli.py index 9954fb04..79e7e06b 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -117,7 +117,7 @@ def setupLogging(appname, debug_stdout, do_quiet, cli_app=True): quiet = do_quiet 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() if vi_dir and not os.access(vi_dir, os.W_OK): @@ -1421,7 +1421,7 @@ class ParserBoot(VirtCLIParser): # Build boot order boot_order = [] for cliname, ignore in opts.orderedopts: - if not cliname in inst.os.BOOT_DEVICES: + if cliname not in inst.os.BOOT_DEVICES: continue del(opts.opts[cliname]) diff --git a/virtinst/distroinstaller.py b/virtinst/distroinstaller.py index 29a35373..fb1c26b9 100644 --- a/virtinst/distroinstaller.py +++ b/virtinst/distroinstaller.py @@ -167,7 +167,7 @@ def _rhel4_initrd_inject(initrd, injections): file_proc = subprocess.Popen(["file", "-z", initrd], stdout=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 except: logging.exception("Failed to file command for rhel4 initrd detection") diff --git a/virtinst/osdict.py b/virtinst/osdict.py index 20b73f26..16bb8071 100644 --- a/virtinst/osdict.py +++ b/virtinst/osdict.py @@ -97,7 +97,7 @@ def _sort(tosort, sortpref=None): sorted_distro_list.sort() sortpref.reverse() for prefer in sortpref: - if not prefer in sorted_distro_list: + if prefer not in sorted_distro_list: continue sorted_distro_list.remove(prefer) sorted_distro_list.insert(0, prefer) diff --git a/virtinst/virtimage.py b/virtinst/virtimage.py index 284064f5..96871ae0 100644 --- a/virtinst/virtimage.py +++ b/virtinst/virtimage.py @@ -53,7 +53,7 @@ class Image(object): self.descr = None self.version = None self.release = None - if not node is None: + if node is not None: self.parseXML(node) def abspath(self, p): @@ -97,7 +97,7 @@ class Domain(object): self.memory = None self.interface = 0 self.graphics = None - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): @@ -151,7 +151,7 @@ class Boot(object): self.drives = [] self.arch = None self.features = ImageFeatures() - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node): @@ -221,7 +221,7 @@ class Disk(object): self.size = None self.use = None self.csum = {} - if not node is None: + if node is not None: self.parseXML(node) def parseXML(self, node):