python: sanitize spaces either side of operators

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@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-09-24 16:47:02 +01:00
parent bc59247df9
commit 43d29cb40b
5 changed files with 17 additions and 19 deletions

View File

@ -884,12 +884,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)

View File

@ -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")