Fix the rest of the typing hints (#232)

* ignore kad

* fix swarm, and minor

* fix init and swarm

* ignore pb

* enable mypy

* fix basic host

* fix tcp

* fix mplex

* add typing for pb

* skip format pyi

* [mypy] no need to ignore pb now

* add typing to chat
This commit is contained in:
Chih Cheng Liang
2019-08-11 16:47:54 +08:00
committed by GitHub
parent dbb702548f
commit 28f6de37ee
21 changed files with 465 additions and 98 deletions

View File

@ -1,6 +1,7 @@
from abc import ABC, abstractmethod
from libp2p.stream_muxer.abc import IMuxedConn
from libp2p.typing import TProtocol
class INetStream(ABC):
@ -8,13 +9,13 @@ class INetStream(ABC):
mplex_conn: IMuxedConn
@abstractmethod
def get_protocol(self) -> str:
def get_protocol(self) -> TProtocol:
"""
:return: protocol id that stream runs on
"""
@abstractmethod
def set_protocol(self, protocol_id: str) -> bool:
def set_protocol(self, protocol_id: TProtocol) -> bool:
"""
:param protocol_id: protocol id that stream runs on
:return: true if successful