mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
import asynccontextmanager from context lib and remove async_generator dep
This commit is contained in:
@ -49,7 +49,6 @@ repos:
|
||||
- id: mypy
|
||||
additional_dependencies:
|
||||
- mypy-protobuf
|
||||
# exclude: 'tests/|crypto/|identity/|pubsub/|insecure/|noise/|security/'
|
||||
exclude: 'tests/'
|
||||
- repo: local
|
||||
hooks:
|
||||
|
||||
@ -78,8 +78,8 @@ async def run(port: int, destination: str, seed: int = None) -> None:
|
||||
await stream.close()
|
||||
response = await stream.read()
|
||||
|
||||
print(f"Sent: {msg}")
|
||||
print(f"Got: {response}")
|
||||
print(f"Sent: {msg.decode('utf-8')}")
|
||||
print(f"Got: {response.decode('utf-8')}")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
||||
@ -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,
|
||||
|
||||
1
newsfragments/464.internal.rst
Normal file
1
newsfragments/464.internal.rst
Normal file
@ -0,0 +1 @@
|
||||
Turn ``mypy`` checks on and remove ``async_generator`` dependency
|
||||
Reference in New Issue
Block a user