File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1515# specific language governing permissions and limitations
1616# under the License.
1717
18+ import asyncio
1819import logging
1920from typing import (
2021 Any ,
3233 Union ,
3334)
3435
35- import anyio
36+ import sniffio
3637
3738from ..exceptions import ApiError , NotFoundError , TransportError
3839from ..helpers .actions import (
5455T = TypeVar ("T" )
5556
5657
58+ async def _sleep (seconds : float ) -> None :
59+ if sniffio .current_async_library () == "trio" :
60+ import trio
61+
62+ await trio .sleep (seconds )
63+ else :
64+ await asyncio .sleep (seconds )
65+
66+
5767async def _chunk_actions (
5868 actions : AsyncIterable [_TYPE_BULK_ACTION_HEADER_AND_BODY ],
5969 chunk_size : int ,
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ dependencies = [
4545 " elastic-transport @ git+https://github.com/pquentin/elastic-transport-python.git@trio-support" ,
4646 " python-dateutil" ,
4747 " typing-extensions" ,
48- " anyio " ,
48+ " sniffio " ,
4949]
5050
5151# TODO revert before merging/releasing
@@ -86,7 +86,7 @@ dev = [
8686 " jinja2" ,
8787 " tqdm" ,
8888 " trio" ,
89- " sniffio " ,
89+ " anyio " ,
9090 " mypy" ,
9191 " pyright" ,
9292 " types-python-dateutil" ,
You can’t perform that action at this time.
0 commit comments