Merge pull request #221 from mhchia/feature/add-flake8-and-change-cfg

Add flake8 and change flake8 configs
This commit is contained in:
Alex Stokes 2019-08-03 11:13:58 -07:00 committed by GitHub
commit 910c3fa6f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 14 deletions

View File

@ -7,9 +7,9 @@ format:
lintroll: lintroll:
# NOTE: disabling `mypy` until we get typing sorted in this repo # NOTE: disabling `mypy` until we get typing sorted in this repo
# mypy -p libp2p -p examples --config-file {toxinidir}/mypy.ini # mypy -p libp2p -p examples --config-file {toxinidir}/mypy.ini
# TODO: add flake8
black --check $(FILES_TO_LINT) black --check $(FILES_TO_LINT)
isort --recursive --check-only $(FILES_TO_LINT) isort --recursive --check-only $(FILES_TO_LINT)
flake8 $(FILES_TO_LINT)
protobufs: protobufs:
cd libp2p/pubsub/pb && protoc --python_out=. rpc.proto cd libp2p/pubsub/pb && protoc --python_out=. rpc.proto

View File

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Dict, cast from typing import TYPE_CHECKING, cast
from libp2p.security.secure_conn_interface import ISecureConn from libp2p.security.secure_conn_interface import ISecureConn
from libp2p.security.secure_transport_interface import ISecureTransport from libp2p.security.secure_transport_interface import ISecureTransport
@ -6,7 +6,6 @@ from libp2p.security.secure_transport_interface import ISecureTransport
if TYPE_CHECKING: if TYPE_CHECKING:
from libp2p.network.connection.raw_connection_interface import IRawConnection from libp2p.network.connection.raw_connection_interface import IRawConnection
from libp2p.peer.id import ID from libp2p.peer.id import ID
from .secure_conn_interface import ISecureConn
from .typing import TSecurityDetails from .typing import TSecurityDetails

View File

@ -7,7 +7,6 @@ from libp2p.protocol_muxer.multiselect_client import MultiselectClient
if TYPE_CHECKING: if TYPE_CHECKING:
from libp2p.network.connection.raw_connection_interface import IRawConnection from libp2p.network.connection.raw_connection_interface import IRawConnection
from libp2p.peer.id import ID from libp2p.peer.id import ID
from .typing import TSecurityDetails
from .secure_conn_interface import ISecureConn from .secure_conn_interface import ISecureConn
from .secure_transport_interface import ISecureTransport from .secure_transport_interface import ISecureTransport

View File

@ -1,3 +1,3 @@
from typing import Any, Dict, NewType, TypeVar from typing import Dict, NewType
TSecurityDetails = NewType("TSecurityDetails", Dict[str, str]) TSecurityDetails = NewType("TSecurityDetails", Dict[str, str])

View File

@ -3,7 +3,6 @@ import asyncio
import multiaddr import multiaddr
from libp2p.network.connection.raw_connection import RawConnection from libp2p.network.connection.raw_connection import RawConnection
from libp2p.peer.id import ID
from ..listener_interface import IListener from ..listener_interface import IListener
from ..transport_interface import ITransport from ..transport_interface import ITransport

View File

@ -11,7 +11,12 @@ extras_require = {
"pytest-cov>=2.7.1,<3.0.0", "pytest-cov>=2.7.1,<3.0.0",
"pytest-asyncio>=0.10.0,<1.0.0", "pytest-asyncio>=0.10.0,<1.0.0",
], ],
"lint": ["mypy>=0.701,<1.0", "black==19.3b0", "isort==4.3.21"], "lint": [
"mypy>=0.701,<1.0",
"black==19.3b0",
"isort==4.3.21",
"flake8>=3.7.7,<4.0.0",
],
"dev": ["tox>=3.13.2,<4.0.0"], "dev": ["tox>=3.13.2,<4.0.0"],
} }

View File

@ -1,9 +1,7 @@
import asyncio import asyncio
import multiaddr
import pytest import pytest
from libp2p import new_node
from libp2p.peer.peerinfo import info_from_p2p_addr from libp2p.peer.peerinfo import info_from_p2p_addr
from libp2p.protocol_muxer.multiselect_client import MultiselectClientError from libp2p.protocol_muxer.multiselect_client import MultiselectClientError
from tests.utils import cleanup, set_up_nodes_by_transport_opt from tests.utils import cleanup, set_up_nodes_by_transport_opt

View File

@ -1,5 +1,3 @@
import functools
import factory import factory
from libp2p import initialize_default_swarm from libp2p import initialize_default_swarm

View File

@ -8,7 +8,9 @@ envlist =
[flake8] [flake8]
max-line-length = 100 max-line-length = 100
exclude = *_pb2*.py exclude = *_pb2*.py
ignore= ignore = E203, E266, E501, W503
max-complexity = 18
select = B,C,E,F,W,T4,B9
[isort] [isort]
force_sort_within_sections=True force_sort_within_sections=True