[clang-tools-extra] r274511 - [clang-include-fixer] fix PEP8 warnings
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 4 09:47:18 PDT 2016
Author: d0k
Date: Mon Jul 4 11:47:17 2016
New Revision: 274511
URL: http://llvm.org/viewvc/llvm-project?rev=274511&view=rev
Log:
[clang-include-fixer] fix PEP8 warnings
This fixes PEP8 E231, E225, E226, E302 warnings.
Patch by Kirill Bobyrev!
Differential revision: http://reviews.llvm.org/D21974
Modified:
clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
Modified: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py?rev=274511&r1=274510&r2=274511&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py (original)
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py Mon Jul 4 11:47:17 2016
@@ -28,22 +28,23 @@ binary = 'clang-include-fixer'
if vim.eval('exists("g:clang_include_fixer_path")') == "1":
binary = vim.eval('g:clang_include_fixer_path')
-maximum_suggested_headers=3
+maximum_suggested_headers = 3
if vim.eval('exists("g:clang_include_fixer_maximum_suggested_headers")') == "1":
maximum_suggested_headers = max(
1,
vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
-increment_num=5
+increment_num = 5
if vim.eval('exists("g:clang_include_fixer_increment_num")') == "1":
increment_num = max(
1,
vim.eval('g:clang_include_fixer_increment_num'))
+
def GetUserSelection(message, headers, maximum_suggested_headers):
eval_message = message + '\n'
for idx, header in enumerate(headers[0:maximum_suggested_headers]):
- eval_message += "({0}). {1}\n".format(idx+1, header)
+ eval_message += "({0}). {1}\n".format(idx + 1, header)
eval_message += "Enter (q) to quit;"
if maximum_suggested_headers < len(headers):
eval_message += " (m) to show {0} more candidates.".format(
@@ -69,7 +70,8 @@ def GetUserSelection(message, headers, m
# don't need to wait for another include-fixer run.
print >> sys.stderr, "Invalid option:", res
return GetUserSelection(message, headers, maximum_suggested_headers)
- return headers[idx-1]
+ return headers[idx - 1]
+
def execute(command, text):
p = subprocess.Popen(command,
@@ -79,7 +81,7 @@ def execute(command, text):
def InsertHeaderToVimBuffer(header, text):
- command = [binary, "-stdin", "-insert-header="+json.dumps(header),
+ command = [binary, "-stdin", "-insert-header=" + json.dumps(header),
vim.current.buffer.name]
stdout, stderr = execute(command, text)
if stdout:
@@ -104,8 +106,8 @@ def main():
text = '\n'.join(buf)
# Run command to get all headers.
- command = [binary, "-stdin", "-output-headers", "-db="+args.db,
- "-input="+args.input, vim.current.buffer.name]
+ command = [binary, "-stdin", "-output-headers", "-db=" + args.db,
+ "-input=" + args.input, vim.current.buffer.name]
stdout, stderr = execute(command, text)
if stderr:
print >> sys.stderr, "Error while running clang-include-fixer: " + stderr
@@ -127,7 +129,7 @@ def main():
# If there is only one suggested header, insert it directly.
if len(headers) == 1 or maximum_suggested_headers == 1:
InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
- "Headers":[headers[0]]}, text)
+ "Headers": [headers[0]]}, text)
print "Added #include {0} for {1}.\n".format(headers[0], symbol)
return
@@ -136,7 +138,7 @@ def main():
headers, maximum_suggested_headers)
# Insert a selected header.
InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
- "Headers":[selected]}, text)
+ "Headers": [selected]}, text)
print "Added #include {0} for {1}.\n".format(selected, symbol)
except Exception as error:
print >> sys.stderr, error.message
More information about the cfe-commits
mailing list