remove if TYPE_CHECKING as much as possible

This commit is contained in:
Chih Cheng Liang
2019-08-05 10:20:30 +08:00
parent 4c9a930f84
commit 87ef2e4618
7 changed files with 69 additions and 93 deletions

View File

@ -1,14 +1,11 @@
import asyncio
from typing import TYPE_CHECKING
from libp2p.stream_muxer.muxed_stream_interface import IMuxedStream
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
from .constants import HeaderTags
if TYPE_CHECKING:
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
class MplexStream(IMuxedStream):
"""
reference: https://github.com/libp2p/go-mplex/blob/master/stream.go
@ -16,16 +13,14 @@ class MplexStream(IMuxedStream):
stream_id: int
initiator: bool
mplex_conn: "IMuxedConn"
mplex_conn: IMuxedConn
read_deadline: float
write_deadline: float
local_closed: bool
remote_closed: bool
stream_lock: asyncio.Lock
def __init__(
self, stream_id: int, initiator: bool, mplex_conn: "IMuxedConn"
) -> None:
def __init__(self, stream_id: int, initiator: bool, mplex_conn: IMuxedConn) -> None:
"""
create new MuxedStream in muxer
:param stream_id: stream stream id