[Libguestfs] [PATCH 4/8] python: PEP 8: break compound statements

Pino Toscano ptoscano at redhat.com
Wed May 4 14:23:14 UTC 2016


Avoid compound statements, simply indenting their blocks.

No functional changes.
---
 generator/python.ml           | 6 ++++--
 python/examples/inspect_vm.py | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/generator/python.ml b/generator/python.ml
index 8da36bc..b5ab168 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -718,8 +718,10 @@ class GuestFS(object):
         in libguestfs <= 1.20.
         \"\"\"
         flags = 0
-        if not environment: flags |= 1
-        if not close_on_exit: flags |= 2
+        if not environment:
+            flags |= 1
+        if not close_on_exit:
+            flags |= 2
         self._o = libguestfsmod.create(flags)
         self._python_return_dict = python_return_dict
 
diff --git a/python/examples/inspect_vm.py b/python/examples/inspect_vm.py
index 8bfbbbc..077157c 100644
--- a/python/examples/inspect_vm.py
+++ b/python/examples/inspect_vm.py
@@ -39,7 +39,8 @@ for root in roots:
     # Sort keys by length, shortest first, so that we end up
     # mounting the filesystems in the correct order.
     mps = g.inspect_get_mountpoints(root)
-    def compare(a, b): return len(a) - len(b)
+    def compare(a, b):
+        return len(a) - len(b)
     for device in sorted(mps.keys(), compare):
         try:
             g.mount_ro(mps[device], device)
@@ -51,7 +52,8 @@ for root in roots:
     if g.is_file(filename):
         print "--- %s ---" % filename
         lines = g.head_n(3, filename)
-        for line in lines: print line
+        for line in lines:
+            print line
 
     # Unmount everything.
     g.umount_all()
-- 
2.5.5




More information about the Libguestfs mailing list