Skip to content

Commit 48d3fe3

Browse files
committed
pep8-ify the code.
1 parent 93132bc commit 48d3fe3

File tree

6 files changed

+28
-13
lines changed

6 files changed

+28
-13
lines changed

asyncio/base_events.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,10 @@ def subprocess_shell(self, protocol_factory, cmd, *, stdin=subprocess.PIPE,
605605
return transport, protocol
606606

607607
@tasks.coroutine
608-
def subprocess_exec(self, protocol_factory, program, *args, stdin=subprocess.PIPE,
609-
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
610-
universal_newlines=False, shell=False, bufsize=0,
611-
**kwargs):
608+
def subprocess_exec(self, protocol_factory, program, *args,
609+
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
610+
stderr=subprocess.PIPE, universal_newlines=False,
611+
shell=False, bufsize=0, **kwargs):
612612
if universal_newlines:
613613
raise ValueError("universal_newlines must be False")
614614
if shell:
@@ -623,7 +623,8 @@ def subprocess_exec(self, protocol_factory, program, *args, stdin=subprocess.PIP
623623
% type(arg).__name__)
624624
protocol = protocol_factory()
625625
transport = yield from self._make_subprocess_transport(
626-
protocol, popen_args, False, stdin, stdout, stderr, bufsize, **kwargs)
626+
protocol, popen_args, False, stdin, stdout, stderr,
627+
bufsize, **kwargs)
627628
return transport, protocol
628629

629630
def set_exception_handler(self, handler):

asyncio/subprocess.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ def create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None,
180180
return Process(transport, protocol, loop)
181181

182182
@tasks.coroutine
183-
def create_subprocess_exec(program, *args, stdin=None, stdout=None, stderr=None,
184-
loop=None, limit=streams._DEFAULT_LIMIT, **kwds):
183+
def create_subprocess_exec(program, *args, stdin=None, stdout=None,
184+
stderr=None, loop=None,
185+
limit=streams._DEFAULT_LIMIT, **kwds):
185186
if loop is None:
186187
loop = events.get_event_loop()
187188
protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,

examples/subprocess_shell.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def main():
7878
asyncio.set_event_loop(loop)
7979
else:
8080
loop = asyncio.get_event_loop()
81-
loop.run_until_complete(start('sleep 2; wc', input=[b'foo bar baz\n'*300 for i in range(100)]))
81+
loop.run_until_complete(start(
82+
'sleep 2; wc', input=[b'foo bar baz\n'*300 for i in range(100)]))
8283

8384

8485
if __name__ == '__main__':

tests/test_subprocess.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'sys.stdout.buffer.write(data)'))]
2222

2323
class SubprocessMixin:
24+
2425
def test_stdin_stdout(self):
2526
args = PROGRAM_CAT
2627

@@ -132,6 +133,7 @@ def test_broken_pipe(self):
132133
if sys.platform != 'win32':
133134
# Unix
134135
class SubprocessWatcherMixin(SubprocessMixin):
136+
135137
Watcher = None
136138

137139
def setUp(self):
@@ -151,14 +153,20 @@ def tearDown(self):
151153
self.loop.close()
152154
policy.set_event_loop(None)
153155

154-
class SubprocessSafeWatcherTests(SubprocessWatcherMixin, unittest.TestCase):
156+
class SubprocessSafeWatcherTests(SubprocessWatcherMixin,
157+
unittest.TestCase):
158+
155159
Watcher = unix_events.SafeChildWatcher
156160

157-
class SubprocessFastWatcherTests(SubprocessWatcherMixin, unittest.TestCase):
161+
class SubprocessFastWatcherTests(SubprocessWatcherMixin,
162+
unittest.TestCase):
163+
158164
Watcher = unix_events.FastChildWatcher
165+
159166
else:
160167
# Windows
161168
class SubprocessProactorTests(SubprocessMixin, unittest.TestCase):
169+
162170
def setUp(self):
163171
policy = asyncio.get_event_loop_policy()
164172
self.loop = asyncio.ProactorEventLoop()

tests/test_tasks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ def gen():
876876
self.assertEqual(set(f.result() for f in done), {'a', 'b'})
877877

878878
def test_as_completed_duplicate_coroutines(self):
879+
879880
@asyncio.coroutine
880881
def coro(s):
881882
return s
@@ -884,7 +885,8 @@ def coro(s):
884885
def runner():
885886
result = []
886887
c = coro('ham')
887-
for f in asyncio.as_completed([c, c, coro('spam')], loop=self.loop):
888+
for f in asyncio.as_completed([c, c, coro('spam')],
889+
loop=self.loop):
888890
result.append((yield from f))
889891
return result
890892

tests/test_unix_events.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ def test__read_ready_error(self, m_read, m_logexc):
367367
tr._close.assert_called_with(err)
368368
m_logexc.assert_called_with(
369369
test_utils.MockPattern(
370-
'Fatal read error on pipe transport\nprotocol:.*\ntransport:.*'),
370+
'Fatal read error on pipe transport'
371+
'\nprotocol:.*\ntransport:.*'),
371372
exc_info=(OSError, MOCK_ANY, MOCK_ANY))
372373

373374
@unittest.mock.patch('os.read')
@@ -664,7 +665,8 @@ def test__write_ready_err(self, m_write, m_logexc):
664665
self.assertTrue(tr._closing)
665666
m_logexc.assert_called_with(
666667
test_utils.MockPattern(
667-
'Fatal write error on pipe transport\nprotocol:.*\ntransport:.*'),
668+
'Fatal write error on pipe transport'
669+
'\nprotocol:.*\ntransport:.*'),
668670
exc_info=(OSError, MOCK_ANY, MOCK_ANY))
669671
self.assertEqual(1, tr._conn_lost)
670672
test_utils.run_briefly(self.loop)

0 commit comments

Comments
 (0)