[Libguestfs] [PATCH 1/7] python: PEP 8: adapt empty lines

Pino Toscano ptoscano at redhat.com
Fri Jan 10 14:28:53 UTC 2020


Add or remove empty lines to match the needed ones around
blocks/functions/etc.

Adapt the generation of guestfs.py to emit the separating empty line
before adding a new function/alias, rather than after it.

This is just formatting, no behaviour changes.
---
 generator/python.ml                 | 5 ++---
 python/t/test020Create.py           | 1 +
 python/t/test030CreateFlags.py      | 1 +
 python/t/test040CreateMultiple.py   | 2 ++
 python/t/test050HandleProperties.py | 1 +
 python/t/test430ProgressMessages.py | 2 ++
 6 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/generator/python.ml b/generator/python.ml
index fd297321e..f5e400110 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -786,7 +786,6 @@ class GuestFS(object):
         \"\"\"Delete an event callback.\"\"\"
         self._check_not_closed()
         libguestfsmod.delete_event_callback(self._o, event_handle)
-
 ";
 
   let map_join f l =
@@ -803,6 +802,7 @@ class GuestFS(object):
           args ^
         map_join (fun optarg -> sprintf ", %s=None" (name_of_optargt optarg))
           optargs in
+      pr "\n";
       pr "    def %s(%s):\n"
         f.name (indent_python decl_string (9 + len_name) 78);
 
@@ -900,12 +900,11 @@ class GuestFS(object):
       );
 
       pr "        return r\n";
-      pr "\n";
 
       (* Aliases. *)
       List.iter (
         fun alias ->
-          pr "    %s = %s\n\n" alias f.name
+          pr "\n    %s = %s\n" alias f.name
       ) f.non_c_aliases
   ) (actions |> external_functions |> sort)
 
diff --git a/python/t/test020Create.py b/python/t/test020Create.py
index 16e19ec76..277fa7051 100644
--- a/python/t/test020Create.py
+++ b/python/t/test020Create.py
@@ -18,6 +18,7 @@
 import unittest
 import guestfs
 
+
 class Test020Create(unittest.TestCase):
     def test_create(self):
         _ = guestfs.GuestFS(python_return_dict=True)
diff --git a/python/t/test030CreateFlags.py b/python/t/test030CreateFlags.py
index b69e488b3..ab522fab4 100644
--- a/python/t/test030CreateFlags.py
+++ b/python/t/test030CreateFlags.py
@@ -18,6 +18,7 @@
 import unittest
 import guestfs
 
+
 class Test030CreateFlags(unittest.TestCase):
     def test_create_flags(self):
         g = guestfs.GuestFS(python_return_dict=True,
diff --git a/python/t/test040CreateMultiple.py b/python/t/test040CreateMultiple.py
index 190ef256b..d73501edc 100644
--- a/python/t/test040CreateMultiple.py
+++ b/python/t/test040CreateMultiple.py
@@ -18,9 +18,11 @@
 import unittest
 import guestfs
 
+
 def ignore(_):
     pass
 
+
 class Test040CreateMultiple(unittest.TestCase):
     def test_create_multiple(self):
         g1 = guestfs.GuestFS(python_return_dict=True)
diff --git a/python/t/test050HandleProperties.py b/python/t/test050HandleProperties.py
index 59de8b806..131482c8f 100644
--- a/python/t/test050HandleProperties.py
+++ b/python/t/test050HandleProperties.py
@@ -19,6 +19,7 @@ import unittest
 import warnings
 import guestfs
 
+
 class Test050HandleProperties(unittest.TestCase):
     def test_verbose(self):
         g = guestfs.GuestFS(python_return_dict=True)
diff --git a/python/t/test430ProgressMessages.py b/python/t/test430ProgressMessages.py
index cbc404cd0..3dab4bd1c 100644
--- a/python/t/test430ProgressMessages.py
+++ b/python/t/test430ProgressMessages.py
@@ -21,10 +21,12 @@ import guestfs
 
 callback_invoked = 0
 
+
 def callback(ev, eh, buf, array):
     global callback_invoked
     callback_invoked += 1
 
+
 class Test430ProgressMessages(unittest.TestCase):
     def test_progress_messages(self):
         global callback_invoked
-- 
2.24.1




More information about the Libguestfs mailing list