There should be a single space either side of operators. Inline
comments should have two spaces before the '#'
src/hyperv/hyperv_wmi_generator.py:130:45: E261 at least two spaces before inline comment
source += ' { "", "", 0 },\n' # null
terminated
^
src/esx/esx_vi_generator.py:417:25: E221 multiple spaces before operator
FEATURE__DESERIALIZE = (1 << 6)
^
tests/cputestdata/cpu-cpuid.py:187:78: E225 missing whitespace around operator
f.write(" <msr index='0x%x' edx='0x%08x'
eax='0x%08x'/>\n" %(
^
docs/apibuild.py:524:47: E226 missing whitespace around arithmetic operator
self.line = line[i+2:]
^
...more...
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
build-aux/syntax-check.mk | 2 --
docs/apibuild.py | 16 ++++++++--------
src/esx/esx_vi_generator.py | 12 ++++++------
src/hyperv/hyperv_wmi_generator.py | 2 +-
tests/cputestdata/cpu-cpuid.py | 4 ++--
5 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index c6d7ad1b9d..1dcf9f169c 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -880,12 +880,10 @@ sc_require_enum_last_marker:
# Validate many python style rules
FLAKE8_INDENTATION = E114,E115,E116,E121,E125,E126,E127,E128,E129,E131
-FLAKE8_WHITESPACE = E211,E221,E222,E225,E226,E231,E261
FLAKE8_LINE_LENGTH = E501
FLAKE8_WARNINGS = W504
FLAKE8_IGNORE = $(FLAKE8_INDENTATION),$\
- $(FLAKE8_WHITESPACE),$\
$(FLAKE8_LINE_LENGTH),$\
$(FLAKE8_WARNINGS) \
$(NULL)
diff --git a/docs/apibuild.py b/docs/apibuild.py
index e944c01321..bdf217f52c 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -520,9 +520,9 @@ class CLexer:
i = 0
nline = len(line)
while i < nline:
- if line[i] == '*' and i+1 < nline and line[i+1] ==
'/':
- self.line = line[i+2:]
- line = line[:i-1]
+ if line[i] == '*' and i + 1 < nline and line[i + 1] ==
'/':
+ self.line = line[i + 2:]
+ line = line[:i - 1]
nline = i
found = 1
break
@@ -542,11 +542,11 @@ class CLexer:
return self.last
i = 0
while i < nline:
- if line[i] == '/' and i+1 < nline and line[i+1] ==
'/':
+ if line[i] == '/' and i + 1 < nline and line[i + 1] ==
'/':
self.line = line[i:]
line = line[:i]
break
- if line[i] == '/' and i+1 < nline and line[i+1] ==
'*':
+ if line[i] == '/' and i + 1 < nline and line[i + 1] ==
'*':
self.line = line[i:]
line = line[:i]
break
@@ -576,14 +576,14 @@ class CLexer:
continue
if line[i] in "+-*><=/%&!|.":
if line[i] == '.' and i + 2 < nline and \
- line[i+1] == '.' and line[i+2] == '.':
+ line[i + 1] == '.' and line[i + 2] == '.':
self.tokens.append(('name', '...'))
i = i + 3
continue
j = i + 1
if j < nline and line[j] in "+-*><=/%&!|":
- self.tokens.append(('op', line[i:j+1]))
+ self.tokens.append(('op', line[i:j + 1]))
i = j + 1
else:
self.tokens.append(('op', line[i]))
@@ -994,7 +994,7 @@ class CParser:
lst.append(token[1])
token = self.lexer.token()
try:
- name = name.split('(') [0]
+ name = name.split('(')[0]
except Exception:
pass
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 2310b56ad0..d6e5e1c7cd 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -402,7 +402,7 @@ class Type:
return string
def generate_typefromstring(self):
- string = " if (STREQ(type, \"%s\"))\n" %
self.name
+ string = " if (STREQ(type, \"%s\"))\n" % self.name
string += " return esxVI_Type_%s;\n" % self.name
return string
@@ -410,11 +410,11 @@ class Type:
class GenericObject(Type):
FEATURE__DYNAMIC_CAST = (1 << 1)
- FEATURE__LIST = (1 << 2)
- FEATURE__DEEP_COPY = (1 << 3)
- FEATURE__ANY_TYPE = (1 << 4)
- FEATURE__SERIALIZE = (1 << 5)
- FEATURE__DESERIALIZE = (1 << 6)
+ FEATURE__LIST = (1 << 2)
+ FEATURE__DEEP_COPY = (1 << 3)
+ FEATURE__ANY_TYPE = (1 << 4)
+ FEATURE__SERIALIZE = (1 << 5)
+ FEATURE__DESERIALIZE = (1 << 6)
def __init__(self, name, category, managed, generic_objects_by_name):
Type.__init__(self, "struct", name)
diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py
index 64a198a12c..02d948f98d 100755
--- a/src/hyperv/hyperv_wmi_generator.py
+++ b/src/hyperv/hyperv_wmi_generator.py
@@ -127,7 +127,7 @@ class WmiClass:
for property in cls.properties:
source += property.generate_typemap()
- source += ' { "", "", 0 },\n' # null
terminated
+ source += ' { "", "", 0 },\n' # null
terminated
source += '};\n\n'
source += self._define_WmiInfo_struct()
diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py
index 40b6c19c23..37d00e3c97 100755
--- a/tests/cputestdata/cpu-cpuid.py
+++ b/tests/cputestdata/cpu-cpuid.py
@@ -184,8 +184,8 @@ def formatCPUData(cpuData, path, comment):
if "msr" in cpuData:
msr = cpuData["msr"]
for index in sorted(msr.keys()):
- f.write(" <msr index='0x%x' edx='0x%08x'
eax='0x%08x'/>\n" %(
- index, msr[index]['edx'], msr[index]['eax']))
+ f.write(" <msr index='0x%x' edx='0x%08x'
eax='0x%08x'/>\n" %
+ (index, msr[index]['edx'], msr[index]['eax']))
f.write("</cpudata>\n")
--
2.21.0