Reformat python files checked by pylint (part 1/2).
After recently changing .pylintrc (see [1]) we discovered that the presubmit check always checks all the python files when just one python file gets updated. This CL moves all these files one step closer to what the linter wants. Autogenerated with: # Added all the files under pylint control to ~/Desktop/to-reformat cat ~/Desktop/to-reformat | xargs sed -i '1i\\' git cl format --python --full This is part 1 out of 2. The second part will fix function names and will not be automated. [1] - https://webrtc-review.googlesource.com/c/src/+/186664 No-Presubmit: True Bug: webrtc:12114 Change-Id: Idfec4d759f209a2090440d0af2413a1ddc01b841 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190980 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32530}
This commit is contained in:
committed by
Commit Bot
parent
d3a3e9ef36
commit
8cc6695652
@ -15,30 +15,32 @@ import sys
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--isolated-script-test-perf-output')
|
||||
args, unrecognized_args = parser.parse_known_args()
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--isolated-script-test-perf-output')
|
||||
args, unrecognized_args = parser.parse_known_args()
|
||||
|
||||
test_command = _ForcePythonInterpreter(unrecognized_args)
|
||||
if args.isolated_script_test_perf_output:
|
||||
test_command += ['--isolated_script_test_perf_output=' +
|
||||
args.isolated_script_test_perf_output]
|
||||
logging.info('Running %r', test_command)
|
||||
test_command = _ForcePythonInterpreter(unrecognized_args)
|
||||
if args.isolated_script_test_perf_output:
|
||||
test_command += [
|
||||
'--isolated_script_test_perf_output=' +
|
||||
args.isolated_script_test_perf_output
|
||||
]
|
||||
logging.info('Running %r', test_command)
|
||||
|
||||
return subprocess.call(test_command)
|
||||
return subprocess.call(test_command)
|
||||
|
||||
|
||||
def _ForcePythonInterpreter(cmd):
|
||||
"""Returns the fixed command line to call the right python executable."""
|
||||
out = cmd[:]
|
||||
if out[0] == 'python':
|
||||
out[0] = sys.executable
|
||||
elif out[0].endswith('.py'):
|
||||
out.insert(0, sys.executable)
|
||||
return out
|
||||
"""Returns the fixed command line to call the right python executable."""
|
||||
out = cmd[:]
|
||||
if out[0] == 'python':
|
||||
out[0] = sys.executable
|
||||
elif out[0].endswith('.py'):
|
||||
out.insert(0, sys.executable)
|
||||
return out
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pylint: disable=W0101
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
sys.exit(main())
|
||||
# pylint: disable=W0101
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
sys.exit(main())
|
||||
|
||||
Reference in New Issue
Block a user