[Libguestfs] [PATCH 8/8] python: PEP 8: miscellaneous coding fixes

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


python/guestfs.py:136:37: E712 comparison to True should be 'if cond is True:' or 'if cond:'
python/t/tests_helper.py:42:8: E713 test for membership should be 'not in'

No functional changes, as the new versions follow the suggested Python
coding style to do the same things.
---
 generator/python.ml      | 2 +-
 python/t/tests_helper.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/generator/python.ml b/generator/python.ml
index 70dc076..9744b8f 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -738,7 +738,7 @@ class GuestFS(object):
             raise ClosedHandle(\"GuestFS: method called on closed handle\")
 
     def _maybe_convert_to_dict(self, r):
-        if self._python_return_dict == True:
+        if self._python_return_dict:
             r = dict(r)
         return r
 
diff --git a/python/t/tests_helper.py b/python/t/tests_helper.py
index 8493c40..4ae1375 100644
--- a/python/t/tests_helper.py
+++ b/python/t/tests_helper.py
@@ -39,7 +39,7 @@ def skipUnlessLibvirtHasCPointer():
         return unittest.skip("could not import libvirt")
     # Check we're using the version of libvirt-python that has
     # c_pointer() methods.
-    if not "c_pointer" in dir(libvirt.open(None)):
+    if "c_pointer" not in dir(libvirt.open(None)):
         return unittest.skip("libvirt-python doesn't support c_pointer()")
     return lambda func: func
 
-- 
2.5.5




More information about the Libguestfs mailing list