Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy asynccontextmanager import from _helpers #1146

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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