Skip to content

Commit

Permalink
more anyio4
Browse files Browse the repository at this point in the history
  • Loading branch information
smurfix committed Jan 5, 2023
1 parent 58d60c2 commit ded438f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 0 additions & 4 deletions async_amqp/future.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import anyio
import logging
import outcome
from anyio._core._compat import DeprecatedAwaitable

logger = logging.getLogger(__name__)

Expand All @@ -31,7 +30,6 @@ def set_result(self, value):
raise RuntimeError("future already set")
self.result = outcome.Value(value)
self.event.set()
return DeprecatedAwaitable(self.set_result)

def set_exception(self, exc):
if self.event.is_set():
Expand All @@ -40,14 +38,12 @@ def set_exception(self, exc):
exc = exc()
self.result = outcome.Error(exc)
self.event.set()
return DeprecatedAwaitable(self.set_exception)

def cancel(self):
try:
raise FutureCancelled()
except FutureCancelled as exc:
self.set_exception(exc)
return DeprecatedAwaitable(self.cancel)

def done(self):
return self.event.is_set()
3 changes: 1 addition & 2 deletions tests/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def __init__(self, scope):

def cancel(self):
self.scope.cancel()
return DeprecatedAwaitable(self.cancel)


class TaskGroup:
Expand Down Expand Up @@ -212,7 +211,7 @@ async def stop(self):
if amqp.state != OPEN:
continue
logger.debug('Kill off amqp %s', amqp)
await amqp._nursery.cancel_scope.cancel()
amqp._nursery.cancel_scope.cancel()
await amqp.close()

def teardown(self):
Expand Down

0 comments on commit ded438f

Please sign in to comment.