From 5b2ffe208d79dd0794b342ef129fe1acf2c373e3 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 19 Jan 2018 15:31:09 +0400 Subject: [PATCH] Run yapf --- trio/_core/tests/test_run.py | 10 ++++------ trio/_socket.py | 4 ++-- trio/_sync.py | 4 ++-- trio/_util.py | 6 +++--- trio/testing/_check_streams.py | 2 ++ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/trio/_core/tests/test_run.py b/trio/_core/tests/test_run.py index 00e972a1b..ce05f500c 100644 --- a/trio/_core/tests/test_run.py +++ b/trio/_core/tests/test_run.py @@ -185,9 +185,8 @@ async def main(): with pytest.raises(_core.MultiError) as excinfo: _core.run(main) print(excinfo.value) - assert set(type(exc) for exc in excinfo.value.exceptions) == { - ValueError, KeyError - } + assert set(type(exc) + for exc in excinfo.value.exceptions) == {ValueError, KeyError} def test_two_child_crashes(): @@ -201,9 +200,8 @@ async def main(): with pytest.raises(_core.MultiError) as excinfo: _core.run(main) - assert set(type(exc) for exc in excinfo.value.exceptions) == { - ValueError, KeyError - } + assert set(type(exc) + for exc in excinfo.value.exceptions) == {ValueError, KeyError} async def test_child_crash_wakes_parent(): diff --git a/trio/_socket.py b/trio/_socket.py index 4ad58b149..780e57309 100644 --- a/trio/_socket.py +++ b/trio/_socket.py @@ -530,8 +530,8 @@ async def _resolve_address(self, address, flags): if not self._sock.getsockopt(IPPROTO_IPV6, IPV6_V6ONLY): flags |= AI_V4MAPPED gai_res = await getaddrinfo( - host, port, self._sock.family, - real_socket_type(self._sock.type), self._sock.proto, flags + host, port, self._sock.family, real_socket_type(self._sock.type), + self._sock.proto, flags ) # AFAICT from the spec it's not possible for getaddrinfo to return an # empty list. diff --git a/trio/_sync.py b/trio/_sync.py index 9e6fac062..15bafe497 100644 --- a/trio/_sync.py +++ b/trio/_sync.py @@ -166,8 +166,8 @@ def __init__(self, total_tokens): def __repr__(self): return ( "".format( - id(self), - len(self._borrowers), self._total_tokens, len(self._lot) + id(self), len(self._borrowers), self._total_tokens, + len(self._lot) ) ) diff --git a/trio/_util.py b/trio/_util.py index e7e02a6df..b9aa1062a 100644 --- a/trio/_util.py +++ b/trio/_util.py @@ -133,9 +133,9 @@ async def __aexit__(self, type, value, traceback): # was passed to throw() and later wrapped into a RuntimeError # (see PEP 479). if ( - isinstance(value, - (StopIteration, StopAsyncIteration)) - and exc.__cause__ is value + isinstance(value, + (StopIteration, StopAsyncIteration)) + and exc.__cause__ is value ): return False raise diff --git a/trio/testing/_check_streams.py b/trio/testing/_check_streams.py index d31a44d8f..9bff4df35 100644 --- a/trio/testing/_check_streams.py +++ b/trio/testing/_check_streams.py @@ -245,6 +245,7 @@ async def receive_send_then_close(): # we can't do it here. Maybe we could do a bit better with # https://github.com/python-trio/trio/issues/77 async with _ForceCloseBoth(await stream_maker()) as (s, r): + async def expect_cancelled(afn, *args): with _assert_raises(_core.Cancelled): await afn(*args) @@ -315,6 +316,7 @@ async def receiver(): # closing the receiver causes wait_send_all_might_not_block to return async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r): + async def sender(): try: with assert_checkpoints():