From df3e693b1b3a617e7d1b6982fc6d57bf0b8268c7 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 10 Jan 2020 13:05:37 +0100 Subject: [PATCH] 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. --- 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 0e1ed20d8..7b7379935 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -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) 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