]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Drop unused methods from BaseEvent (#626)
authorTom Christie <tom@tomchristie.com>
Wed, 11 Dec 2019 12:31:05 +0000 (12:31 +0000)
committerGitHub <noreply@github.com>
Wed, 11 Dec 2019 12:31:05 +0000 (12:31 +0000)
httpx/concurrency/asyncio.py
httpx/concurrency/base.py
httpx/concurrency/trio.py

index 1912fc0c1c9947e85407516478d88a6a4c76c23d..c73a13824bb1d7ca9863ea90b4628a14cddd964e 100644 (file)
@@ -265,4 +265,15 @@ class AsyncioBackend(ConcurrencyBackend):
         return PoolSemaphore(max_value)
 
     def create_event(self) -> BaseEvent:
-        return typing.cast(BaseEvent, asyncio.Event())
+        return Event()
+
+
+class Event(BaseEvent):
+    def __init__(self) -> None:
+        self._event = asyncio.Event()
+
+    def set(self) -> None:
+        self._event.set()
+
+    async def wait(self) -> None:
+        await self._event.wait()
index f0c7dc9531ccc21809b257fe75bdefca3316a5b6..da6dd986e046a54c68f2c14b5399946111779d4f 100644 (file)
@@ -62,12 +62,6 @@ class BaseEvent:
     def set(self) -> None:
         raise NotImplementedError()  # pragma: no cover
 
-    def is_set(self) -> bool:
-        raise NotImplementedError()  # pragma: no cover
-
-    def clear(self) -> None:
-        raise NotImplementedError()  # pragma: no cover
-
     async def wait(self) -> None:
         raise NotImplementedError()  # pragma: no cover
 
index d607f9c7ffe172c77f2c28af482eee4d2cb08dbe..6f2ab2d1890a773b504a5ea75df128dd7d1fac71 100644 (file)
@@ -170,13 +170,5 @@ class Event(BaseEvent):
     def set(self) -> None:
         self._event.set()
 
-    def is_set(self) -> bool:
-        return self._event.is_set()
-
     async def wait(self) -> None:
         await self._event.wait()
-
-    def clear(self) -> None:
-        # trio.Event.clear() was deprecated in Trio 0.12.
-        # https://github.com/python-trio/trio/issues/637
-        self._event = trio.Event()