mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
apibuild: Remove whitespace before ', ' and ':'
PEP8 recommends removing whitespace immediately before a comma, semicolon, or colon [1]. In addition remove multiple spaces after keyword (PEP8 - E271). 1: https://www.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-statements Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
committed by
Daniel P. Berrangé
parent
6d43a754af
commit
28593b5b54
104
docs/apibuild.py
104
docs/apibuild.py
@@ -590,7 +590,7 @@ class CLexer:
|
||||
# line[i] == '>' or line[i] == '<' or line[i] == '=' or \
|
||||
# line[i] == '/' or line[i] == '%' or line[i] == '&' or \
|
||||
# line[i] == '!' or line[i] == '|' or line[i] == '.':
|
||||
if line[i] == '.' and i + 2 < l and \
|
||||
if line[i] == '.' and i + 2 < l and \
|
||||
line[i+1] == '.' and line[i+2] == '.':
|
||||
self.tokens.append(('name', '...'))
|
||||
i = i + 3
|
||||
@@ -1401,7 +1401,7 @@ class CParser:
|
||||
while token[0] != "sep" or (token[1] != ',' and
|
||||
token[1] != '}'):
|
||||
# We might be dealing with '1U << 12' here
|
||||
value = value + re.sub("^(\d+)U$","\\1", token[1])
|
||||
value = value + re.sub("^(\d+)U$", "\\1", token[1])
|
||||
token = self.token()
|
||||
else:
|
||||
try:
|
||||
@@ -1735,7 +1735,7 @@ class CParser:
|
||||
while token is not None and token[0] == "op" and token[1] == '*':
|
||||
self.type = self.type + token[1]
|
||||
token = self.token()
|
||||
if token is None or token[0] != "name" :
|
||||
if token is None or token[0] != "name":
|
||||
self.error("parsing function type, name expected", token)
|
||||
return token
|
||||
self.type = self.type + token[1]
|
||||
@@ -1825,41 +1825,42 @@ class CParser:
|
||||
# this dict contains the functions that are allowed to use [unsigned]
|
||||
# long for legacy reasons in their signature and return type. this list is
|
||||
# fixed. new procedures and public APIs have to use [unsigned] long long
|
||||
long_legacy_functions = \
|
||||
{ "virGetVersion" : (False, ("libVer", "typeVer")),
|
||||
"virConnectGetLibVersion" : (False, ("libVer")),
|
||||
"virConnectGetVersion" : (False, ("hvVer")),
|
||||
"virDomainGetMaxMemory" : (True, ()),
|
||||
"virDomainMigrate" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrate2" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateBegin3" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateConfirm3" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateDirect" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateFinish" : (False, ("flags")),
|
||||
"virDomainMigrateFinish2" : (False, ("flags")),
|
||||
"virDomainMigrateFinish3" : (False, ("flags")),
|
||||
"virDomainMigratePeer2Peer" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePerform" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePerform3" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepare" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepare2" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepare3" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepareTunnel" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepareTunnel3" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateToURI" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateToURI2" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateVersion1" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateVersion2" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateVersion3" : (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateSetMaxSpeed" : (False, ("bandwidth")),
|
||||
"virDomainSetMaxMemory" : (False, ("memory")),
|
||||
"virDomainSetMemory" : (False, ("memory")),
|
||||
"virDomainSetMemoryFlags" : (False, ("memory")),
|
||||
"virDomainBlockCommit" : (False, ("bandwidth")),
|
||||
"virDomainBlockJobSetSpeed" : (False, ("bandwidth")),
|
||||
"virDomainBlockPull" : (False, ("bandwidth")),
|
||||
"virDomainBlockRebase" : (False, ("bandwidth")),
|
||||
"virDomainMigrateGetMaxSpeed" : (False, ("bandwidth")) }
|
||||
long_legacy_functions = {
|
||||
"virGetVersion": (False, ("libVer", "typeVer")),
|
||||
"virConnectGetLibVersion": (False, ("libVer")),
|
||||
"virConnectGetVersion": (False, ("hvVer")),
|
||||
"virDomainGetMaxMemory": (True, ()),
|
||||
"virDomainMigrate": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrate2": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateBegin3": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateConfirm3": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateDirect": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateFinish": (False, ("flags")),
|
||||
"virDomainMigrateFinish2": (False, ("flags")),
|
||||
"virDomainMigrateFinish3": (False, ("flags")),
|
||||
"virDomainMigratePeer2Peer": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePerform": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePerform3": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepare": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepare2": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepare3": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepareTunnel": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigratePrepareTunnel3": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateToURI": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateToURI2": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateVersion1": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateVersion2": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateVersion3": (False, ("flags", "bandwidth")),
|
||||
"virDomainMigrateSetMaxSpeed": (False, ("bandwidth")),
|
||||
"virDomainSetMaxMemory": (False, ("memory")),
|
||||
"virDomainSetMemory": (False, ("memory")),
|
||||
"virDomainSetMemoryFlags": (False, ("memory")),
|
||||
"virDomainBlockCommit": (False, ("bandwidth")),
|
||||
"virDomainBlockJobSetSpeed": (False, ("bandwidth")),
|
||||
"virDomainBlockPull": (False, ("bandwidth")),
|
||||
"virDomainBlockRebase": (False, ("bandwidth")),
|
||||
"virDomainMigrateGetMaxSpeed": (False, ("bandwidth"))
|
||||
}
|
||||
|
||||
def checkLongLegacyFunction(self, name, return_type, signature):
|
||||
if "long" in return_type and "long long" not in return_type:
|
||||
@@ -1883,10 +1884,11 @@ class CParser:
|
||||
# this dict contains the structs that are allowed to use [unsigned]
|
||||
# long for legacy reasons. this list is fixed. new structs have to use
|
||||
# [unsigned] long long
|
||||
long_legacy_struct_fields = \
|
||||
{ "_virDomainInfo" : ("maxMem", "memory"),
|
||||
"_virNodeInfo" : ("memory"),
|
||||
"_virDomainBlockJobInfo" : ("bandwidth") }
|
||||
long_legacy_struct_fields = {
|
||||
"_virDomainInfo": ("maxMem", "memory"),
|
||||
"_virNodeInfo": ("memory"),
|
||||
"_virDomainBlockJobInfo": ("bandwidth")
|
||||
}
|
||||
|
||||
def checkLongLegacyStruct(self, name, fields):
|
||||
for field in fields:
|
||||
@@ -1934,7 +1936,7 @@ class CParser:
|
||||
elif token[1] == 'static':
|
||||
static = 1
|
||||
token = self.token()
|
||||
if token is None or token[0] != 'name':
|
||||
if token is None or token[0] != 'name':
|
||||
return token
|
||||
|
||||
if token[1] == 'typedef':
|
||||
@@ -2205,7 +2207,7 @@ class docBuilder:
|
||||
output.write(" </macro>\n")
|
||||
|
||||
def serialize_union(self, output, field, desc):
|
||||
output.write(" <field name='%s' type='union' info='%s'>\n" % (field[1] , desc))
|
||||
output.write(" <field name='%s' type='union' info='%s'>\n" % (field[1], desc))
|
||||
output.write(" <union>\n")
|
||||
for f in field[3]:
|
||||
desc = f[2]
|
||||
@@ -2213,7 +2215,7 @@ class docBuilder:
|
||||
desc = ''
|
||||
else:
|
||||
desc = escape(desc)
|
||||
output.write(" <field name='%s' type='%s' info='%s'/>\n" % (f[1] , f[0], desc))
|
||||
output.write(" <field name='%s' type='%s' info='%s'/>\n" % (f[1], f[0], desc))
|
||||
|
||||
output.write(" </union>\n")
|
||||
output.write(" </field>\n")
|
||||
@@ -2238,13 +2240,13 @@ class docBuilder:
|
||||
if field[0] == "union":
|
||||
self.serialize_union(output, field, desc)
|
||||
else:
|
||||
output.write(" <field name='%s' type='%s' info='%s'/>\n" % (field[1] , field[0], desc))
|
||||
output.write(" <field name='%s' type='%s' info='%s'/>\n" % (field[1], field[0], desc))
|
||||
except:
|
||||
self.warning("Failed to serialize struct %s" % (name))
|
||||
output.write(" </struct>\n")
|
||||
else:
|
||||
output.write("/>\n")
|
||||
else :
|
||||
else:
|
||||
output.write(" <typedef name='%s' file='%s' type='%s'" % (
|
||||
name, self.modulename_file(id.header), id.info))
|
||||
try:
|
||||
@@ -2401,7 +2403,7 @@ class docBuilder:
|
||||
typ = sorted(funcs.keys())
|
||||
for type in typ:
|
||||
if type == '' or type == 'void' or type == "int" or \
|
||||
type == "char *" or type == "const char *" :
|
||||
type == "char *" or type == "const char *":
|
||||
continue
|
||||
output.write(" <type name='%s'>\n" % (type))
|
||||
ids = funcs[type]
|
||||
@@ -2430,7 +2432,7 @@ class docBuilder:
|
||||
typ = sorted(funcs.keys())
|
||||
for type in typ:
|
||||
if type == '' or type == 'void' or type == "int" or \
|
||||
type == "char *" or type == "const char *" :
|
||||
type == "char *" or type == "const char *":
|
||||
continue
|
||||
output.write(" <type name='%s'>\n" % (type))
|
||||
ids = sorted(funcs[type])
|
||||
@@ -2589,7 +2591,7 @@ class app:
|
||||
builddir = os.path.abspath((os.environ["builddir"]))
|
||||
if srcdir == builddir:
|
||||
builddir = None
|
||||
if glob.glob(srcdir + "/../src/libvirt.c") != [] :
|
||||
if glob.glob(srcdir + "/../src/libvirt.c") != []:
|
||||
if not quiet:
|
||||
print("Rebuilding API description for %s" % name)
|
||||
dirs = [srcdir + "/../src",
|
||||
@@ -2599,7 +2601,7 @@ class app:
|
||||
not os.path.exists(srcdir + "/../include/libvirt/libvirt-common.h")):
|
||||
dirs.append(builddir + "/../include/libvirt")
|
||||
builder = docBuilder(name, srcdir, dirs, [])
|
||||
elif glob.glob("src/libvirt.c") != [] :
|
||||
elif glob.glob("src/libvirt.c") != []:
|
||||
if not quiet:
|
||||
print("Rebuilding API description for %s" % name)
|
||||
builder = docBuilder(name, srcdir,
|
||||
|
||||
@@ -59,21 +59,21 @@ libxml2.registerErrorHandler(callback, None)
|
||||
# to create them
|
||||
#
|
||||
TABLES={
|
||||
"symbols" : """CREATE TABLE symbols (
|
||||
"symbols": """CREATE TABLE symbols (
|
||||
name varchar(255) BINARY NOT NULL,
|
||||
module varchar(255) BINARY NOT NULL,
|
||||
type varchar(25) NOT NULL,
|
||||
descr varchar(255),
|
||||
UNIQUE KEY name (name),
|
||||
KEY module (module))""",
|
||||
"words" : """CREATE TABLE words (
|
||||
"words": """CREATE TABLE words (
|
||||
name varchar(50) BINARY NOT NULL,
|
||||
symbol varchar(255) BINARY NOT NULL,
|
||||
relevance int,
|
||||
KEY name (name),
|
||||
KEY symbol (symbol),
|
||||
UNIQUE KEY ID (name, symbol))""",
|
||||
"wordsHTML" : """CREATE TABLE wordsHTML (
|
||||
"wordsHTML": """CREATE TABLE wordsHTML (
|
||||
name varchar(50) BINARY NOT NULL,
|
||||
resource varchar(255) BINARY NOT NULL,
|
||||
section varchar(255),
|
||||
@@ -82,30 +82,30 @@ TABLES={
|
||||
KEY name (name),
|
||||
KEY resource (resource),
|
||||
UNIQUE KEY ref (name, resource))""",
|
||||
"wordsArchive" : """CREATE TABLE wordsArchive (
|
||||
"wordsArchive": """CREATE TABLE wordsArchive (
|
||||
name varchar(50) BINARY NOT NULL,
|
||||
ID int(11) NOT NULL,
|
||||
relevance int,
|
||||
KEY name (name),
|
||||
UNIQUE KEY ref (name, ID))""",
|
||||
"pages" : """CREATE TABLE pages (
|
||||
"pages": """CREATE TABLE pages (
|
||||
resource varchar(255) BINARY NOT NULL,
|
||||
title varchar(255) BINARY NOT NULL,
|
||||
UNIQUE KEY name (resource))""",
|
||||
"archives" : """CREATE TABLE archives (
|
||||
"archives": """CREATE TABLE archives (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
resource varchar(255) BINARY NOT NULL,
|
||||
title varchar(255) BINARY NOT NULL,
|
||||
UNIQUE KEY id (ID,resource(255)),
|
||||
INDEX (ID),
|
||||
INDEX (resource))""",
|
||||
"Queries" : """CREATE TABLE Queries (
|
||||
"Queries": """CREATE TABLE Queries (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
Value varchar(50) NOT NULL,
|
||||
Count int(11) NOT NULL,
|
||||
UNIQUE KEY id (ID,Value(35)),
|
||||
INDEX (ID))""",
|
||||
"AllQueries" : """CREATE TABLE AllQueries (
|
||||
"AllQueries": """CREATE TABLE AllQueries (
|
||||
ID int(11) NOT NULL auto_increment,
|
||||
Value varchar(50) NOT NULL,
|
||||
Count int(11) NOT NULL,
|
||||
@@ -171,7 +171,7 @@ def checkTables(db, verbose = 1):
|
||||
if verbose:
|
||||
print "Table %s contains %d records" % (table, row[0])
|
||||
except:
|
||||
print "Troubles with table %s : repairing" % (table)
|
||||
print "Troubles with table %s: repairing" % (table)
|
||||
ret = c.execute("repair table %s" % table)
|
||||
print "repairing returned %d" % (ret)
|
||||
ret = c.execute("SELECT count(*) from %s" % table)
|
||||
@@ -1041,7 +1041,7 @@ def analyzeHTMLPages():
|
||||
doc = libxml2.htmlParseFile(html, None)
|
||||
try:
|
||||
res = analyzeHTML(doc, html)
|
||||
print "Parsed %s : %d paragraphs" % (html, res)
|
||||
print "Parsed %s: %d paragraphs" % (html, res)
|
||||
ret = ret + 1
|
||||
except:
|
||||
print "could not parse %s" % (html)
|
||||
@@ -1230,7 +1230,7 @@ def main():
|
||||
elif args[i] == '--archive-year':
|
||||
i = i + 1
|
||||
year = args[i]
|
||||
months = ["January" , "February", "March", "April", "May",
|
||||
months = ["January", "February", "March", "April", "May",
|
||||
"June", "July", "August", "September", "October",
|
||||
"November", "December"]
|
||||
for month in months:
|
||||
|
||||
Reference in New Issue
Block a user