Skip to content
Myr

Drop Queue from concurrency backends, since it's no longer required (#562)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Drop Queue from concurrency backends, since it's no longer required * Drop unused import

authored by Tom Christie · committed by GitHub · parent e045b86 · Browse files · 3 files+0 added−35 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+0 added−35 removed

  • other:+0 added−35 removed

3 files+0 added−35 removed

modified:httpx/concurrency/asyncio.py-4 removed
9 unmodified lines
10from .base import (11 BaseBackgroundManager,12 BaseEvent,13 BasePoolSemaphore,14 BaseQueue,14 BaseSocketStream,15 ConcurrencyBackend,16 TimeoutFlag,17)
305 unmodified lines
323324 def get_semaphore(self, limits: PoolLimits) -> BasePoolSemaphore:325 return PoolSemaphore(limits)326328 def create_queue(self, max_size: int) -> BaseQueue:329 return typing.cast(BaseQueue, asyncio.Queue(maxsize=max_size))330327 def create_event(self) -> BaseEvent:328 return typing.cast(BaseEvent, asyncio.Event())329330 def background_manager(
24 unmodified lines
modified:httpx/concurrency/base.py-15 removed
68 unmodified lines
69 def is_connection_dropped(self) -> bool:70 raise NotImplementedError() # pragma: no cover717273class BaseQueue:74 """75 A FIFO queue. Abstracts away any asyncio-specific interfaces.76 """7778 async def get(self) -> typing.Any:79 raise NotImplementedError() # pragma: no cover8081 async def put(self, value: typing.Any) -> None:82 raise NotImplementedError() # pragma: no cover838473class BaseEvent:74 """75 An event object. Abstracts away any asyncio-specific interfaces.76 """
79 unmodified lines
156 yield self.run(async_iterator.__anext__)157 except StopAsyncIteration:158 break159172 def create_queue(self, max_size: int) -> BaseQueue:173 raise NotImplementedError() # pragma: no cover174160 def create_event(self) -> BaseEvent:161 raise NotImplementedError() # pragma: no cover162163 def background_manager(
23 unmodified lines
modified:httpx/concurrency/trio.py-16 removed
1import functools2import math2import ssl3import typing4from types import TracebackType5
4 unmodified lines
10from .base import (11 BaseBackgroundManager,12 BaseEvent,13 BasePoolSemaphore,15 BaseQueue,14 BaseSocketStream,15 ConcurrencyBackend,16 TimeoutFlag,17)
209 unmodified lines
227228 def get_semaphore(self, limits: PoolLimits) -> BasePoolSemaphore:229 return PoolSemaphore(limits)230233 def create_queue(self, max_size: int) -> BaseQueue:234 return Queue(max_size=max_size)235231 def create_event(self) -> BaseEvent:232 return Event()233234 def background_manager(
1 unmodified line
236 ) -> "BackgroundManager":237 return BackgroundManager(coroutine, *args)238239245class Queue(BaseQueue):246 def __init__(self, max_size: int) -> None:247 self.send_channel, self.receive_channel = trio.open_memory_channel(math.inf)248249 async def get(self) -> typing.Any:250 return await self.receive_channel.receive()251252 async def put(self, value: typing.Any) -> None:253 await self.send_channel.send(value)254255240class Event(BaseEvent):241 def __init__(self) -> None:242 self._event = trio.Event()243
35 unmodified lines