python: PEP 8: adapt empty lines

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.
This commit is contained in:
Pino Toscano
2020-01-10 13:05:37 +01:00
parent 40251e4b3c
commit df3e693b1b
6 changed files with 9 additions and 3 deletions

View File

@@ -792,7 +792,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 =
@@ -809,6 +808,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);
@@ -906,12 +906,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)

View File

@@ -18,6 +18,7 @@
import unittest
import guestfs
class Test020Create(unittest.TestCase):
def test_create(self):
_ = guestfs.GuestFS(python_return_dict=True)

View File

@@ -18,6 +18,7 @@
import unittest
import guestfs
class Test030CreateFlags(unittest.TestCase):
def test_create_flags(self):
g = guestfs.GuestFS(python_return_dict=True,

View File

@@ -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)

View File

@@ -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)

View File

@@ -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