Skip to content

Commit

Permalink
feat: remove async_timeout dependency (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Aug 2, 2023
1 parent b3dac76 commit 7826897
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
19 changes: 2 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ script = "build_ext.py"

[tool.poetry.dependencies]
python = "^3.7"
async-timeout = {version = ">=3.0.0", python = "<3.11"}

# duplicated in docs/requirements.txt for readthedocs compatibility
[tool.poetry.group.docs.dependencies]
Expand Down
13 changes: 6 additions & 7 deletions src/dbus_fast/aio/message_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
import asyncio
import logging
import socket
import sys
from collections import deque
from copy import copy
from typing import Any, Optional

if sys.version_info[:2] < (3, 11):
from async_timeout import timeout as asyncio_timeout
else:
from asyncio import timeout as asyncio_timeout

from .. import introspection as intr
from ..auth import Authenticator, AuthExternal
from ..constants import (
Expand Down Expand Up @@ -273,8 +267,13 @@ def reply_handler(reply: Any, err: Exception) -> None:

super().introspect(bus_name, path, reply_handler)

async with asyncio_timeout(timeout):
timer_handle = self._loop.call_later(
timeout, _future_set_exception, future, asyncio.TimeoutError
)
try:
return await future
finally:
timer_handle.cancel()

async def request_name(
self, name: str, flags: NameFlag = NameFlag.NONE
Expand Down

0 comments on commit 7826897

Please sign in to comment.