mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-04-02 12:01:27 +00:00
import asynccontextmanager from context lib and remove async_generator dep
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
from contextlib import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
import logging
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
@ -6,9 +9,6 @@ from typing import (
|
||||
Sequence,
|
||||
)
|
||||
|
||||
from async_generator import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
from async_service import (
|
||||
background_trio_service,
|
||||
)
|
||||
@ -145,8 +145,7 @@ class BasicHost(IHost):
|
||||
addrs.append(addr.encapsulate(p2p_part))
|
||||
return addrs
|
||||
|
||||
# type ignored because asynccontextmanager decorator is untyped
|
||||
@asynccontextmanager # type: ignore
|
||||
@asynccontextmanager
|
||||
async def run(
|
||||
self, listen_addrs: Sequence[multiaddr.Multiaddr]
|
||||
) -> AsyncIterator[None]:
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
from contextlib import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
AsyncIterator,
|
||||
@ -12,9 +15,6 @@ from typing import (
|
||||
from async_exit_stack import (
|
||||
AsyncExitStack,
|
||||
)
|
||||
from async_generator import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
from async_service import (
|
||||
background_trio_service,
|
||||
)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
from contextlib import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
from typing import (
|
||||
AsyncIterator,
|
||||
)
|
||||
|
||||
from async_generator import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
import multiaddr
|
||||
from multiaddr import (
|
||||
Multiaddr,
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
from contextlib import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
from typing import (
|
||||
AsyncIterator,
|
||||
Dict,
|
||||
@ -7,9 +10,6 @@ from typing import (
|
||||
from async_exit_stack import (
|
||||
AsyncExitStack,
|
||||
)
|
||||
from async_generator import (
|
||||
asynccontextmanager,
|
||||
)
|
||||
from async_service import (
|
||||
Service,
|
||||
background_trio_service,
|
||||
|
||||
Reference in New Issue
Block a user