Apply yapf formatting to all Python files (issue #2171)

This commit is contained in:
Marshall Greenblatt
2017-05-28 15:04:18 +02:00
parent 59606b88d2
commit 12150b43d2
34 changed files with 5101 additions and 4557 deletions

View File

@ -5,6 +5,7 @@
from subprocess import Popen, PIPE
import sys
def exec_cmd(cmd, path, input_string=None):
""" Execute the specified command and return the result. """
out = ''
@ -12,12 +13,21 @@ def exec_cmd(cmd, path, input_string=None):
parts = cmd.split()
try:
if input_string is None:
process = Popen(parts, cwd=path, stdout=PIPE, stderr=PIPE,
shell=(sys.platform == 'win32'))
process = Popen(
parts,
cwd=path,
stdout=PIPE,
stderr=PIPE,
shell=(sys.platform == 'win32'))
out, err = process.communicate()
else:
process = Popen(parts, cwd=path, stdin=PIPE, stdout=PIPE, stderr=PIPE,
shell=(sys.platform == 'win32'))
process = Popen(
parts,
cwd=path,
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
shell=(sys.platform == 'win32'))
out, err = process.communicate(input=input_string)
except IOError, (errno, strerror):
raise