Apply PR feedback
This commit is contained in:
parent
d516cf51b8
commit
3b9d7c7acd
|
@ -48,24 +48,30 @@ jobs:
|
|||
- image: circleci/python:3.6
|
||||
environment:
|
||||
TOXENV: lint
|
||||
py36-test:
|
||||
py36-core:
|
||||
<<: *common
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
environment:
|
||||
TOXENV: py36-test
|
||||
py37-test:
|
||||
TOXENV: py36-core
|
||||
py37-core:
|
||||
<<: *common
|
||||
docker:
|
||||
- image: circleci/python:3.7
|
||||
environment:
|
||||
TOXENV: py37-test
|
||||
|
||||
TOXENV: py37-core
|
||||
pypy3-core:
|
||||
<<: *common
|
||||
docker:
|
||||
- image: pypy
|
||||
environment:
|
||||
TOXENV: pypy3-core
|
||||
workflows:
|
||||
version: 2
|
||||
test:
|
||||
jobs:
|
||||
- docs
|
||||
- lint
|
||||
- py36-test
|
||||
- py37-test
|
||||
- py36-core
|
||||
- py37-core
|
||||
- pypy3-core
|
||||
|
|
|
@ -53,5 +53,6 @@ class RawConnection(IRawConnection):
|
|||
|
||||
async def close(self) -> None:
|
||||
self.writer.close()
|
||||
if sys.version_info[0:2] > (3, 6):
|
||||
await self.writer.wait_closed()
|
||||
if sys.version_info < (3, 7):
|
||||
return
|
||||
await self.writer.wait_closed()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import asyncio
|
||||
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
|
||||
|
||||
from libp2p import generate_new_rsa_identity, generate_peer_id_from
|
||||
|
@ -32,12 +34,6 @@ from .constants import (
|
|||
)
|
||||
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:
|
||||
peer_store = PeerStore()
|
||||
|
@ -177,7 +173,7 @@ async def host_pair_factory(is_secure: bool) -> Tuple[BasicHost, BasicHost]:
|
|||
return hosts[0], hosts[1]
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
@asynccontextmanager # type: ignore
|
||||
async def pair_of_connected_hosts(
|
||||
is_secure: bool = True
|
||||
) -> AsyncIterator[Tuple[BasicHost, BasicHost]]:
|
||||
|
|
|
@ -54,9 +54,11 @@ class TCPListener(IListener):
|
|||
if self.server is None:
|
||||
return
|
||||
self.server.close()
|
||||
if sys.version_info[0:2] > (3, 6):
|
||||
await self.server.wait_closed()
|
||||
server = self.server
|
||||
self.server = None
|
||||
if sys.version_info < (3, 7):
|
||||
return
|
||||
await server.wait_closed()
|
||||
|
||||
|
||||
class TCP(ITransport):
|
||||
|
|
3
setup.py
3
setup.py
|
@ -59,7 +59,7 @@ install_requires = [
|
|||
"coincurve>=10.0.0,<11.0.0",
|
||||
"pynacl==1.3.0",
|
||||
"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",
|
||||
"Natural Language :: English",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
],
|
||||
platforms=["unix", "linux", "osx"],
|
||||
|
|
|
@ -151,8 +151,9 @@ class DaemonStream(ReadWriteCloser):
|
|||
|
||||
async def close(self) -> None:
|
||||
self.writer.close()
|
||||
if sys.version_info[0:2] > (3, 6):
|
||||
await self.writer.wait_closed()
|
||||
if sys.version_info < (3, 7):
|
||||
return
|
||||
await self.writer.wait_closed()
|
||||
|
||||
async def read(self, n: int = -1) -> bytes:
|
||||
return await self.reader.read(n)
|
||||
|
|
Loading…
Reference in New Issue
Block a user