File tree Expand file tree Collapse file tree 4 files changed +11
-12
lines changed
Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 33import types
44import typing
55
6+ import certifi
7+
68from ._streams import Stream
79
8- import certifi
910
1011__all__ = ["NetworkBackend" , "NetworkStream" , "timeout" ]
1112
Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ def __repr__(self) -> str:
350350 return f'<HTTPParser [{ detail } ]>'
351351
352352
353- class ReadAheadParser ( Stream ) :
353+ class ReadAheadParser :
354354 """
355355 A buffered I/O stream, with methods for read-ahead parsing.
356356 """
@@ -369,7 +369,7 @@ def _push_back(self, buffer):
369369 assert self ._buffer == b''
370370 self ._buffer = buffer
371371
372- async def read (self , size : int = - 1 ) -> bytes :
372+ async def read (self , size : int ) -> bytes :
373373 """
374374 Read and return up to 'size' bytes from the stream, with I/O buffering provided.
375375
Original file line number Diff line number Diff line change 99import types
1010import typing
1111
12- from ._streams import Stream
13-
1412import certifi
1513
14+ from ._streams import Stream
1615
17- _timeout_stack : contextvars .ContextVar [list [float ]] = contextvars .ContextVar ("timeout_context" , default = [])
1816
1917__all__ = ["NetworkBackend" , "NetworkStream" , "timeout" ]
2018
19+ _timeout_stack : contextvars .ContextVar [list [float ]] = contextvars .ContextVar ("timeout_context" , default = [])
20+
2121
2222@contextlib .contextmanager
2323def timeout (duration : float ) -> typing .Iterator [None ]:
@@ -82,10 +82,8 @@ def write(self, buffer: bytes) -> None:
8282
8383 def close (self ) -> None :
8484 if not self ._is_closed :
85- timeout = get_current_timeout ()
86- self ._socket .settimeout (timeout )
87- self ._socket .close ()
8885 self ._is_closed = True
86+ self ._socket .close ()
8987
9088 def __repr__ (self ):
9189 description = ""
@@ -96,7 +94,7 @@ def __repr__(self):
9694 def __del__ (self ):
9795 if not self ._is_closed :
9896 import warnings
99- warnings .warn ("NetworkStream was garbage collected without being closed." )
97+ warnings .warn (f "NetworkStream was garbage collected without being closed." )
10098
10199 def __enter__ (self ) -> "NetworkStream" :
102100 return self
Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ def __repr__(self) -> str:
350350 return f'<HTTPParser [{ detail } ]>'
351351
352352
353- class ReadAheadParser ( Stream ) :
353+ class ReadAheadParser :
354354 """
355355 A buffered I/O stream, with methods for read-ahead parsing.
356356 """
@@ -369,7 +369,7 @@ def _push_back(self, buffer):
369369 assert self ._buffer == b''
370370 self ._buffer = buffer
371371
372- def read (self , size : int = - 1 ) -> bytes :
372+ def read (self , size : int ) -> bytes :
373373 """
374374 Read and return up to 'size' bytes from the stream, with I/O buffering provided.
375375
You can’t perform that action at this time.
0 commit comments