Apply PR feedback
This commit is contained in:
parent
d516cf51b8
commit
3b9d7c7acd
|
@ -48,24 +48,30 @@ jobs:
|
||||||
- image: circleci/python:3.6
|
- image: circleci/python:3.6
|
||||||
environment:
|
environment:
|
||||||
TOXENV: lint
|
TOXENV: lint
|
||||||
py36-test:
|
py36-core:
|
||||||
<<: *common
|
<<: *common
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/python:3.6
|
- image: circleci/python:3.6
|
||||||
environment:
|
environment:
|
||||||
TOXENV: py36-test
|
TOXENV: py36-core
|
||||||
py37-test:
|
py37-core:
|
||||||
<<: *common
|
<<: *common
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/python:3.7
|
- image: circleci/python:3.7
|
||||||
environment:
|
environment:
|
||||||
TOXENV: py37-test
|
TOXENV: py37-core
|
||||||
|
pypy3-core:
|
||||||
|
<<: *common
|
||||||
|
docker:
|
||||||
|
- image: pypy
|
||||||
|
environment:
|
||||||
|
TOXENV: pypy3-core
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
test:
|
test:
|
||||||
jobs:
|
jobs:
|
||||||
- docs
|
- docs
|
||||||
- lint
|
- lint
|
||||||
- py36-test
|
- py36-core
|
||||||
- py37-test
|
- py37-core
|
||||||
|
- pypy3-core
|
||||||
|
|
|
@ -53,5 +53,6 @@ class RawConnection(IRawConnection):
|
||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
self.writer.close()
|
self.writer.close()
|
||||||
if sys.version_info[0:2] > (3, 6):
|
if sys.version_info < (3, 7):
|
||||||
|
return
|
||||||
await self.writer.wait_closed()
|
await self.writer.wait_closed()
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from typing import Any, AsyncIterator, Dict, Tuple, cast
|
from typing import Any, AsyncIterator, Dict, Tuple, cast
|
||||||
|
|
||||||
|
# NOTE: import ``asynccontextmanager`` from ``contextlib`` when support for python 3.6 is dropped.
|
||||||
|
from async_generator import asynccontextmanager
|
||||||
import factory
|
import factory
|
||||||
|
|
||||||
from libp2p import generate_new_rsa_identity, generate_peer_id_from
|
from libp2p import generate_new_rsa_identity, generate_peer_id_from
|
||||||
|
@ -32,12 +34,6 @@ from .constants import (
|
||||||
)
|
)
|
||||||
from .utils import connect, connect_swarm
|
from .utils import connect, connect_swarm
|
||||||
|
|
||||||
try:
|
|
||||||
from contextlib import asynccontextmanager
|
|
||||||
except ImportError:
|
|
||||||
# NOTE: mypy complains about a duplicate import without the following ``# type: ignore``
|
|
||||||
from async_generator import asynccontextmanager # type: ignore
|
|
||||||
|
|
||||||
|
|
||||||
def initialize_peerstore_with_our_keypair(self_id: ID, key_pair: KeyPair) -> PeerStore:
|
def initialize_peerstore_with_our_keypair(self_id: ID, key_pair: KeyPair) -> PeerStore:
|
||||||
peer_store = PeerStore()
|
peer_store = PeerStore()
|
||||||
|
@ -177,7 +173,7 @@ async def host_pair_factory(is_secure: bool) -> Tuple[BasicHost, BasicHost]:
|
||||||
return hosts[0], hosts[1]
|
return hosts[0], hosts[1]
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager # type: ignore
|
||||||
async def pair_of_connected_hosts(
|
async def pair_of_connected_hosts(
|
||||||
is_secure: bool = True
|
is_secure: bool = True
|
||||||
) -> AsyncIterator[Tuple[BasicHost, BasicHost]]:
|
) -> AsyncIterator[Tuple[BasicHost, BasicHost]]:
|
||||||
|
|
|
@ -54,9 +54,11 @@ class TCPListener(IListener):
|
||||||
if self.server is None:
|
if self.server is None:
|
||||||
return
|
return
|
||||||
self.server.close()
|
self.server.close()
|
||||||
if sys.version_info[0:2] > (3, 6):
|
server = self.server
|
||||||
await self.server.wait_closed()
|
|
||||||
self.server = None
|
self.server = None
|
||||||
|
if sys.version_info < (3, 7):
|
||||||
|
return
|
||||||
|
await server.wait_closed()
|
||||||
|
|
||||||
|
|
||||||
class TCP(ITransport):
|
class TCP(ITransport):
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -59,7 +59,7 @@ install_requires = [
|
||||||
"coincurve>=10.0.0,<11.0.0",
|
"coincurve>=10.0.0,<11.0.0",
|
||||||
"pynacl==1.3.0",
|
"pynacl==1.3.0",
|
||||||
"dataclasses>=0.7, <1;python_version<'3.7'",
|
"dataclasses>=0.7, <1;python_version<'3.7'",
|
||||||
"async_generator==1.10;python_version<'3.7'",
|
"async_generator==1.10",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ setup(
|
||||||
"License :: OSI Approved :: Apache Software License",
|
"License :: OSI Approved :: Apache Software License",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.6",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
],
|
],
|
||||||
platforms=["unix", "linux", "osx"],
|
platforms=["unix", "linux", "osx"],
|
||||||
|
|
|
@ -151,7 +151,8 @@ class DaemonStream(ReadWriteCloser):
|
||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
self.writer.close()
|
self.writer.close()
|
||||||
if sys.version_info[0:2] > (3, 6):
|
if sys.version_info < (3, 7):
|
||||||
|
return
|
||||||
await self.writer.wait_closed()
|
await self.writer.wait_closed()
|
||||||
|
|
||||||
async def read(self, n: int = -1) -> bytes:
|
async def read(self, n: int = -1) -> bytes:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user