[virt-tools-list] [libvirt] [PATCH 10/22] python: Remove space around = in keyword args

Radostin Stoyanov rstoyanov1 at gmail.com
Sat Mar 17 13:48:46 UTC 2018


PEP8 recommends not having spaces around = in a keyword argument or
a default parameter value.

https://www.python.org/dev/peps/pep-0008/#other-recommendations

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 docs/apibuild.py                  | 24 ++++++++++++------------
 docs/index.py                     | 26 +++++++++++++-------------
 src/esx/esx_vi_generator.py       |  4 ++--
 tests/cputestdata/cpu-cpuid.py    |  4 ++--
 tests/cputestdata/cpu-reformat.py |  2 +-
 5 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/docs/apibuild.py b/docs/apibuild.py
index 1b9401226..8fecf5a81 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -137,8 +137,8 @@ def uniq(items):
     return k
 
 class identifier:
-    def __init__(self, name, header=None, module=None, type=None, lineno = 0,
-                 info=None, extra=None, conditionals = None):
+    def __init__(self, name, header=None, module=None, type=None, lineno=0,
+                 info=None, extra=None, conditionals=None):
         self.name = name
         self.header = header
         self.module = module
@@ -209,7 +209,7 @@ class identifier:
     def get_conditionals(self):
         return self.conditionals
 
-    def update(self, header, module, type = None, info = None, extra=None,
+    def update(self, header, module, type=None, info=None, extra=None,
                conditionals=None):
         if self.name == debugsym and not quiet:
             print("=> update %s : %s" % (debugsym, (module, type, info,
@@ -228,7 +228,7 @@ class identifier:
             self.set_conditionals(conditionals)
 
 class index:
-    def __init__(self, name = "noname"):
+    def __init__(self, name="noname"):
         self.name = name
         self.identifiers = {}
         self.functions = {}
@@ -247,7 +247,7 @@ class index:
         warnings = warnings + 1
         print(msg)
 
-    def add_ref(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals = None):
+    def add_ref(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals=None):
         if name[0:2] == '__':
             return None
         d = None
@@ -269,7 +269,7 @@ class index:
 
         return d
 
-    def add(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals = None):
+    def add(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals=None):
         if name[0:2] == '__':
             return None
         d = None
@@ -630,7 +630,7 @@ class CLexer:
 
 class CParser:
     """The C module parser"""
-    def __init__(self, filename, idx = None):
+    def __init__(self, filename, idx=None):
         self.filename = filename
         if len(filename) > 2 and filename[-2:] == '.h':
             self.is_header = 1
@@ -662,7 +662,7 @@ class CParser:
     def lineno(self):
         return self.lexer.getlineno()
 
-    def index_add(self, name, module, static, type, info=None, extra = None):
+    def index_add(self, name, module, static, type, info=None, extra=None):
         if self.is_header == 1:
             self.index.add(name, module, module, static, type, self.lineno(),
                            info, extra, self.conditionals)
@@ -671,7 +671,7 @@ class CParser:
                            info, extra, self.conditionals)
 
     def index_add_ref(self, name, module, static, type, info=None,
-                      extra = None):
+                      extra=None):
         if self.is_header == 1:
             self.index.add_ref(name, module, module, static, type,
                                self.lineno(), info, extra, self.conditionals)
@@ -764,7 +764,7 @@ class CParser:
     #
     # Parse a comment block associate to a typedef
     #
-    def parseTypeComment(self, name, quiet = 0):
+    def parseTypeComment(self, name, quiet=0):
         if name[0:2] == '__':
             quiet = 1
 
@@ -809,7 +809,7 @@ class CParser:
     #
     # Parse a comment block associate to a macro
     #
-    def parseMacroComment(self, name, quiet = 0):
+    def parseMacroComment(self, name, quiet=0):
         global ignored_macros
 
         if name[0:2] == '__':
@@ -886,7 +886,7 @@ class CParser:
      # parameters descriptions, finally returns a block as complete
      # as possible
      #
-    def mergeFunctionComment(self, name, description, quiet = 0):
+    def mergeFunctionComment(self, name, description, quiet=0):
         global ignored_functions
 
         if name == 'main':
diff --git a/docs/index.py b/docs/index.py
index 5224324b1..0d07ca4d0 100755
--- a/docs/index.py
+++ b/docs/index.py
@@ -144,7 +144,7 @@ def createTable(db, name):
         return -1
     return ret
 
-def checkTables(db, verbose = 1):
+def checkTables(db, verbose=1):
     global TABLES
 
     if db is None:
@@ -188,7 +188,7 @@ def checkTables(db, verbose = 1):
         pass
     return 0
 
-def openMySQL(db="libvir", passwd=None, verbose = 1):
+def openMySQL(db="libvir", passwd=None, verbose=1):
     global DB
 
     if passwd is None:
@@ -275,25 +275,25 @@ def updateSymbol(name, module, type, desc):
 
     return ret
 
-def addFunction(name, module, desc = ""):
+def addFunction(name, module, desc=""):
     return updateSymbol(name, module, 'function', desc)
 
-def addMacro(name, module, desc = ""):
+def addMacro(name, module, desc=""):
     return updateSymbol(name, module, 'macro', desc)
 
-def addEnum(name, module, desc = ""):
+def addEnum(name, module, desc=""):
     return updateSymbol(name, module, 'enum', desc)
 
-def addStruct(name, module, desc = ""):
+def addStruct(name, module, desc=""):
     return updateSymbol(name, module, 'struct', desc)
 
-def addConst(name, module, desc = ""):
+def addConst(name, module, desc=""):
     return updateSymbol(name, module, 'const', desc)
 
-def addType(name, module, desc = ""):
+def addType(name, module, desc=""):
     return updateSymbol(name, module, 'type', desc)
 
-def addFunctype(name, module, desc = ""):
+def addFunctype(name, module, desc=""):
     return updateSymbol(name, module, 'functype', desc)
 
 def addPage(resource, title):
@@ -1055,7 +1055,7 @@ def analyzeHTMLPages():
 
 import time
 
-def getXMLDateArchive(t = None):
+def getXMLDateArchive(t=None):
     if t is None:
         t = time.time()
     T = time.gmtime(t)
@@ -1064,7 +1064,7 @@ def getXMLDateArchive(t = None):
     url = "http://www.redhat.com/archives/libvir-list/%d-%s/date.html" % (year, month)
     return url
 
-def scanXMLMsgArchive(url, title, force = 0):
+def scanXMLMsgArchive(url, title, force=0):
     if url is None or title is None:
         return 0
 
@@ -1094,7 +1094,7 @@ def scanXMLMsgArchive(url, title, force = 0):
 
     return 1
 
-def scanXMLDateArchive(t = None, force = 0):
+def scanXMLDateArchive(t=None, force=0):
     global wordsDictArchive
 
     wordsDictArchive = {}
@@ -1138,7 +1138,7 @@ def scanXMLDateArchive(t = None, force = 0):
 #          Main code: open the DB, the API XML and analyze it           #
 #                                                                       #
 #########################################################################
-def analyzeArchives(t = None, force = 0):
+def analyzeArchives(t=None, force=0):
     global wordsDictArchive
 
     ret = scanXMLDateArchive(t, force)
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 0dca44fed..1e61cc71e 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -118,7 +118,7 @@ class Parameter(Member):
             return aligned(string, self.get_occurrence_comment() + "\n")
 
 
-    def generate_return(self, offset = 0, end_of_line = ";"):
+    def generate_return(self, offset=0, end_of_line=";"):
         if self.occurrence == OCCURRENCE__IGNORED:
             raise ValueError("invalid function parameter occurrence value '%s'"
                              % self.occurrence)
@@ -609,7 +609,7 @@ class Object(GenericObject):
         return source
 
 
-    def generate_deep_copy_code(self, add_banner = False):
+    def generate_deep_copy_code(self, add_banner=False):
         source = ""
 
         if self.extends is not None:
diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py
index 43c92731a..c45118512 100755
--- a/tests/cputestdata/cpu-cpuid.py
+++ b/tests/cputestdata/cpu-cpuid.py
@@ -343,12 +343,12 @@ def convert(path):
     with open(path, "w") as f:
         json.dump({"return": {"model": {"name": "base", "props": props}},
                    "id": "model-expansion"},
-                  f, indent = 2, separators = (',', ': '))
+                  f, indent=2, separators=(',', ': '))
         f.write("\n")
 
         for chunk in rest:
             f.write("\n")
-            json.dump(chunk, f, indent = 2, separators = (',', ': '))
+            json.dump(chunk, f, indent=2, separators=(',', ': '))
             f.write("\n")
 
 
diff --git a/tests/cputestdata/cpu-reformat.py b/tests/cputestdata/cpu-reformat.py
index 999ef1698..33976e775 100755
--- a/tests/cputestdata/cpu-reformat.py
+++ b/tests/cputestdata/cpu-reformat.py
@@ -5,5 +5,5 @@ import json
 
 dec = json.JSONDecoder()
 data, pos = dec.raw_decode(sys.stdin.read())
-json.dump(data, sys.stdout, indent = 2, separators = (',', ': '))
+json.dump(data, sys.stdout, indent=2, separators=(',', ': '))
 print
-- 
2.14.3




More information about the virt-tools-list mailing list