Skip to content
Myr

concurrency.py

This file

Path

tests/concurrency.py

37 lines · 985 bytes · Python

Last changed by

Drop `run` and `run_in_threadpool` (#710)Tom Christiebefore adoption6ac49da

History of this file

Take it

The walk stopped after 200 commits: lines older than 49ed77a point at it.

Rely on getproxies for all proxy environment variables (#470)camellia256before adoption49ed77a

lines 1–7why, one step back
1"""
2This module contains concurrency utilities that are only used in tests, thus not3required as part of the ConcurrencyBackend API.4"""56import asyncio7

Drop `run` and `run_in_threadpool` (#710)Tom Christiebefore adoption6ac49da

line 8why, one step back
8import sniffio

Fix race condition on stream.read (#535)Florimond Mancabefore adoptiona05ba2e

lines 9–10why, one step back
9import trio
10

Rely on getproxies for all proxy environment variables (#470)camellia256before adoption49ed77a

line 11why, one step back
11

Drop `run` and `run_in_threadpool` (#710)Tom Christiebefore adoption6ac49da

lines 12–16why, one step back
12async def sleep(seconds: float):
13 if sniffio.current_async_library() == "trio":14 await trio.sleep(seconds)15 else:16 await asyncio.sleep(seconds)

Rely on getproxies for all proxy environment variables (#470)camellia256before adoption49ed77a

line 17why, one step back
17

Fix race condition on stream.read (#535)Florimond Mancabefore adoptiona05ba2e

line 18why, one step back
18

Drop `run` and `run_in_threadpool` (#710)Tom Christiebefore adoption6ac49da

lines 19–26why, one step back
19async def run_concurrently(*coroutines):
20 if sniffio.current_async_library() == "trio":21 async with trio.open_nursery() as nursery:22 for coroutine in coroutines:23 nursery.start_soon(coroutine)24 else:25 coros = (coroutine() for coroutine in coroutines)26 await asyncio.gather(*coros)

Fix race condition on stream.read (#535)Florimond Mancabefore adoptiona05ba2e

line 27why, one step back
27

Refactor tests in the light of backend auto-detection (#615)Florimond Mancabefore adoptionab41a5d

line 28why, one step back
28

Drop `run` and `run_in_threadpool` (#710)Tom Christiebefore adoption6ac49da

lines 29–37why, one step back
29def get_cipher(stream):
30 if sniffio.current_async_library() == "trio":31 return (32 stream.stream.cipher()33 if isinstance(stream.stream, trio.SSLStream)34 else None35 )36 else:37 return stream.stream_writer.get_extra_info("cipher", default=None)