feat: remove async_timeout dependency (#218)

This commit is contained in:
J. Nick Koston
2023-08-02 09:11:39 -10:00
committed by GitHub
parent b3dac76dff
commit 7826897359
3 changed files with 8 additions and 25 deletions

19
poetry.lock generated
View File

@@ -12,21 +12,6 @@ files = [
{file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, {file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"},
] ]
[[package]]
name = "async-timeout"
version = "4.0.2"
description = "Timeout context manager for asyncio programs"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
{file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"},
{file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"},
]
[package.dependencies]
typing-extensions = {version = ">=3.6.5", markers = "python_version < \"3.8\""}
[[package]] [[package]]
name = "babel" name = "babel"
version = "2.12.1" version = "2.12.1"
@@ -994,7 +979,7 @@ files = [
name = "typing-extensions" name = "typing-extensions"
version = "4.5.0" version = "4.5.0"
description = "Backported and Experimental Type Hints for Python 3.7+" description = "Backported and Experimental Type Hints for Python 3.7+"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
@@ -1038,4 +1023,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.7" python-versions = "^3.7"
content-hash = "efe6bba7d1d4270ef6646994cdb335ff93e9394bd8046121834b21e88302374b" content-hash = "b66b41484e96b04db380a0821db014a05ecf99c4be505734c5cbbd4f8955c688"

View File

@@ -28,7 +28,6 @@ script = "build_ext.py"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.7" python = "^3.7"
async-timeout = {version = ">=3.0.0", python = "<3.11"}
# duplicated in docs/requirements.txt for readthedocs compatibility # duplicated in docs/requirements.txt for readthedocs compatibility
[tool.poetry.group.docs.dependencies] [tool.poetry.group.docs.dependencies]

View File

@@ -2,16 +2,10 @@ import array
import asyncio import asyncio
import logging import logging
import socket import socket
import sys
from collections import deque from collections import deque
from copy import copy from copy import copy
from typing import Any, Optional 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 .. import introspection as intr
from ..auth import Authenticator, AuthExternal from ..auth import Authenticator, AuthExternal
from ..constants import ( from ..constants import (
@@ -273,8 +267,13 @@ class MessageBus(BaseMessageBus):
super().introspect(bus_name, path, reply_handler) 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 return await future
finally:
timer_handle.cancel()
async def request_name( async def request_name(
self, name: str, flags: NameFlag = NameFlag.NONE self, name: str, flags: NameFlag = NameFlag.NONE