mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
import asynccontextmanager from context lib and remove async_generator dep
This commit is contained in:
@ -49,7 +49,6 @@ repos:
|
|||||||
- id: mypy
|
- id: mypy
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
- mypy-protobuf
|
- mypy-protobuf
|
||||||
# exclude: 'tests/|crypto/|identity/|pubsub/|insecure/|noise/|security/'
|
|
||||||
exclude: 'tests/'
|
exclude: 'tests/'
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
|
|||||||
@ -78,8 +78,8 @@ async def run(port: int, destination: str, seed: int = None) -> None:
|
|||||||
await stream.close()
|
await stream.close()
|
||||||
response = await stream.read()
|
response = await stream.read()
|
||||||
|
|
||||||
print(f"Sent: {msg}")
|
print(f"Sent: {msg.decode('utf-8')}")
|
||||||
print(f"Got: {response}")
|
print(f"Got: {response.decode('utf-8')}")
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
from contextlib import (
|
||||||
|
asynccontextmanager,
|
||||||
|
)
|
||||||
import logging
|
import logging
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
@ -6,9 +9,6 @@ from typing import (
|
|||||||
Sequence,
|
Sequence,
|
||||||
)
|
)
|
||||||
|
|
||||||
from async_generator import (
|
|
||||||
asynccontextmanager,
|
|
||||||
)
|
|
||||||
from async_service import (
|
from async_service import (
|
||||||
background_trio_service,
|
background_trio_service,
|
||||||
)
|
)
|
||||||
@ -145,8 +145,7 @@ class BasicHost(IHost):
|
|||||||
addrs.append(addr.encapsulate(p2p_part))
|
addrs.append(addr.encapsulate(p2p_part))
|
||||||
return addrs
|
return addrs
|
||||||
|
|
||||||
# type ignored because asynccontextmanager decorator is untyped
|
@asynccontextmanager
|
||||||
@asynccontextmanager # type: ignore
|
|
||||||
async def run(
|
async def run(
|
||||||
self, listen_addrs: Sequence[multiaddr.Multiaddr]
|
self, listen_addrs: Sequence[multiaddr.Multiaddr]
|
||||||
) -> AsyncIterator[None]:
|
) -> AsyncIterator[None]:
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
from contextlib import (
|
||||||
|
asynccontextmanager,
|
||||||
|
)
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
AsyncIterator,
|
AsyncIterator,
|
||||||
@ -12,9 +15,6 @@ from typing import (
|
|||||||
from async_exit_stack import (
|
from async_exit_stack import (
|
||||||
AsyncExitStack,
|
AsyncExitStack,
|
||||||
)
|
)
|
||||||
from async_generator import (
|
|
||||||
asynccontextmanager,
|
|
||||||
)
|
|
||||||
from async_service import (
|
from async_service import (
|
||||||
background_trio_service,
|
background_trio_service,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
|
from contextlib import (
|
||||||
|
asynccontextmanager,
|
||||||
|
)
|
||||||
from typing import (
|
from typing import (
|
||||||
AsyncIterator,
|
AsyncIterator,
|
||||||
)
|
)
|
||||||
|
|
||||||
from async_generator import (
|
|
||||||
asynccontextmanager,
|
|
||||||
)
|
|
||||||
import multiaddr
|
import multiaddr
|
||||||
from multiaddr import (
|
from multiaddr import (
|
||||||
Multiaddr,
|
Multiaddr,
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
from contextlib import (
|
||||||
|
asynccontextmanager,
|
||||||
|
)
|
||||||
from typing import (
|
from typing import (
|
||||||
AsyncIterator,
|
AsyncIterator,
|
||||||
Dict,
|
Dict,
|
||||||
@ -7,9 +10,6 @@ from typing import (
|
|||||||
from async_exit_stack import (
|
from async_exit_stack import (
|
||||||
AsyncExitStack,
|
AsyncExitStack,
|
||||||
)
|
)
|
||||||
from async_generator import (
|
|
||||||
asynccontextmanager,
|
|
||||||
)
|
|
||||||
from async_service import (
|
from async_service import (
|
||||||
Service,
|
Service,
|
||||||
background_trio_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
|
||||||
1
setup.py
1
setup.py
@ -61,7 +61,6 @@ install_requires = [
|
|||||||
"protobuf>=3.10.0",
|
"protobuf>=3.10.0",
|
||||||
"coincurve>=10.0.0",
|
"coincurve>=10.0.0",
|
||||||
"pynacl==1.3.0",
|
"pynacl==1.3.0",
|
||||||
"async_generator==1.10",
|
|
||||||
"trio>=0.15.0",
|
"trio>=0.15.0",
|
||||||
"async-service>=0.1.0a6",
|
"async-service>=0.1.0a6",
|
||||||
"async-exit-stack==1.0.1",
|
"async-exit-stack==1.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user