mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
python: Remove space around = in keyword args
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 Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
parent
e390bb1571
commit
5e870cbda4
@ -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
|
||||
@ -629,7 +629,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
|
||||
@ -661,7 +661,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)
|
||||
@ -670,7 +670,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)
|
||||
@ -763,7 +763,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
|
||||
|
||||
@ -808,7 +808,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] == '__':
|
||||
@ -885,7 +885,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':
|
||||
|
@ -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)
|
||||
|
@ -119,7 +119,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)
|
||||
@ -610,7 +610,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:
|
||||
|
@ -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")
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user