mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
python: sanitize blank line usage
Coding style expects 1 blank line between each method and 2 blank lines
before each class.
docs/apibuild.py:171:5: E303 too many blank lines (2)
def set_header(self, header):
^
docs/apibuild.py:230:1: E302 expected 2 blank lines, found 1
class index:
^
docs/apibuild.py:175:5: E301 expected 1 blank line, found 0
def set_module(self, module):
^
...more...
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -123,6 +123,7 @@ hidden_macros = {
|
||||
"VIR_EXPORT_VAR": "internal macro to mark exported vars",
|
||||
}
|
||||
|
||||
|
||||
def escape(raw):
|
||||
raw = raw.replace('&', '&')
|
||||
raw = raw.replace('<', '<')
|
||||
@@ -131,9 +132,11 @@ def escape(raw):
|
||||
raw = raw.replace('"', '"')
|
||||
return raw
|
||||
|
||||
|
||||
def uniq(items):
|
||||
return sorted(set(items))
|
||||
|
||||
|
||||
class identifier:
|
||||
def __init__(self, name, header=None, module=None, type=None, lineno=0,
|
||||
info=None, extra=None, conditionals=None):
|
||||
@@ -167,21 +170,27 @@ class identifier:
|
||||
r = r + " " + repr(self.conditionals)
|
||||
return r
|
||||
|
||||
|
||||
def set_header(self, header):
|
||||
self.header = header
|
||||
|
||||
def set_module(self, module):
|
||||
self.module = module
|
||||
|
||||
def set_type(self, type):
|
||||
self.type = type
|
||||
|
||||
def set_info(self, info):
|
||||
self.info = info
|
||||
|
||||
def set_extra(self, extra):
|
||||
self.extra = extra
|
||||
|
||||
def set_lineno(self, lineno):
|
||||
self.lineno = lineno
|
||||
|
||||
def set_static(self, static):
|
||||
self.static = static
|
||||
|
||||
def set_conditionals(self, conditionals):
|
||||
if conditionals is None or len(conditionals) == 0:
|
||||
self.conditionals = None
|
||||
@@ -190,20 +199,28 @@ class identifier:
|
||||
|
||||
def get_name(self):
|
||||
return self.name
|
||||
|
||||
def get_header(self):
|
||||
return self.module
|
||||
|
||||
def get_module(self):
|
||||
return self.module
|
||||
|
||||
def get_type(self):
|
||||
return self.type
|
||||
|
||||
def get_info(self):
|
||||
return self.info
|
||||
|
||||
def get_lineno(self):
|
||||
return self.lineno
|
||||
|
||||
def get_extra(self):
|
||||
return self.extra
|
||||
|
||||
def get_static(self):
|
||||
return self.static
|
||||
|
||||
def get_conditionals(self):
|
||||
return self.conditionals
|
||||
|
||||
@@ -225,6 +242,7 @@ class identifier:
|
||||
if conditionals is not None:
|
||||
self.set_conditionals(conditionals)
|
||||
|
||||
|
||||
class index:
|
||||
def __init__(self, name="noname"):
|
||||
self.name = name
|
||||
@@ -409,7 +427,6 @@ class index:
|
||||
elif count != 0:
|
||||
print(" %d public %s" % (count, type))
|
||||
|
||||
|
||||
def analyze(self):
|
||||
if not quiet:
|
||||
self.analyze_dict("functions", self.functions)
|
||||
@@ -419,6 +436,7 @@ class index:
|
||||
self.analyze_dict("typedefs", self.typedefs)
|
||||
self.analyze_dict("macros", self.macros)
|
||||
|
||||
|
||||
class CLexer:
|
||||
"""A lexer for the C language, tokenize the input by reading and
|
||||
analyzing it line by line"""
|
||||
@@ -584,6 +602,7 @@ class CLexer:
|
||||
self.last = tok
|
||||
return tok
|
||||
|
||||
|
||||
class CParser:
|
||||
"""The C module parser"""
|
||||
def __init__(self, filename, idx=None):
|
||||
@@ -745,6 +764,7 @@ class CParser:
|
||||
% name)
|
||||
|
||||
return desc
|
||||
|
||||
#
|
||||
# Parse a comment block associate to a macro
|
||||
#
|
||||
@@ -945,7 +965,6 @@ class CParser:
|
||||
if desc == "":
|
||||
self.warning("Function comment for %s lacks description of the function" % name)
|
||||
|
||||
|
||||
return (ret[0], retdesc), args, desc
|
||||
|
||||
def parsePreproc(self, token):
|
||||
@@ -1434,7 +1453,6 @@ class CParser:
|
||||
if token[0] == "comment":
|
||||
token = self.token()
|
||||
|
||||
|
||||
if token[0] == "sep" and token[1] == ';':
|
||||
token = self.token()
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import sys
|
||||
|
||||
COLUMNS = 80
|
||||
|
||||
|
||||
def reformat_with_indent(text, initial_indent, indent):
|
||||
|
||||
res = ""
|
||||
|
||||
Reference in New Issue
Block a user