Skip to content

Commit

Permalink
Merge pull request #1146 from jakob-keller/remove-helpers-asynccontex…
Browse files Browse the repository at this point in the history
…tmanager

Remove legacy `asynccontextmanager` import from `_helpers`
  • Loading branch information
jakob-keller authored Aug 18, 2024
2 parents 6179c56 + ad0b581 commit 089ce8c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
9 changes: 0 additions & 9 deletions aiobotocore/_helpers.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import inspect

try:
from contextlib import ( # noqa: F401 lgtm[py/unused-import]
asynccontextmanager,
)
except ImportError:
from async_generator import ( # noqa: F401 E501, lgtm[py/unused-import]
asynccontextmanager,
)


async def resolve_awaitable(obj):
if inspect.isawaitable(obj):
Expand Down
4 changes: 2 additions & 2 deletions aiobotocore/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import contextlib
import functools
import inspect
import json
Expand Down Expand Up @@ -34,7 +35,6 @@
)

import aiobotocore.httpsession
from aiobotocore._helpers import asynccontextmanager

logger = logging.getLogger(__name__)

Expand All @@ -45,7 +45,7 @@ def __init__(self, *args, **kwargs):
self.__ref_count = 0
self.__lock = None

@asynccontextmanager
@contextlib.asynccontextmanager
async def acquire(self):
if not self.__lock:
self.__lock = asyncio.Lock()
Expand Down
3 changes: 1 addition & 2 deletions tests/boto_tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from contextlib import AsyncExitStack
from contextlib import AsyncExitStack, asynccontextmanager

from botocore.stub import Stubber

import aiobotocore.session
from aiobotocore._helpers import asynccontextmanager


class StubbedSession(aiobotocore.session.AioSession):
Expand Down
2 changes: 1 addition & 1 deletion tests/boto_tests/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
import tempfile
import uuid
from contextlib import asynccontextmanager
from datetime import datetime, timedelta
from functools import partial
from typing import Optional
Expand All @@ -31,7 +32,6 @@
from dateutil.tz import tzlocal, tzutc

from aiobotocore import credentials
from aiobotocore._helpers import asynccontextmanager
from aiobotocore.credentials import (
AioAssumeRoleProvider,
AioCanonicalNameCredentialSourcer,
Expand Down
2 changes: 1 addition & 1 deletion tests/boto_tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import itertools
import json
from contextlib import asynccontextmanager
from typing import Iterator, Tuple, Union

import pytest
from botocore.exceptions import ReadTimeoutError
from botocore.utils import BadIMDSRequestError

from aiobotocore import utils
from aiobotocore._helpers import asynccontextmanager

# TypeAlias (requires typing_extensions or >=3.10 to annotate)
Response = Tuple[Union[str, object], int]
Expand Down

0 comments on commit 089ce8c

Please sign in to comment.