@@ -3,10 +3,13 @@ from typing import (
3
3
)
4
4
import builtins
5
5
import codecs
6
+ from mmap import mmap
6
7
import sys
7
8
from types import TracebackType
8
9
from typing import TypeVar
9
10
11
+ _bytearray_like = Union [bytearray , mmap ]
12
+
10
13
DEFAULT_BUFFER_SIZE = ... # type: int
11
14
12
15
SEEK_SET = ... # type: int
@@ -65,10 +68,10 @@ class RawIOBase(IOBase):
65
68
66
69
class BufferedIOBase (IOBase ):
67
70
def detach (self ) -> RawIOBase : ...
68
- def readinto (self , b : bytearray ) -> int : ...
71
+ def readinto (self , b : _bytearray_like ) -> int : ...
69
72
def write (self , b : Union [bytes , bytearray ]) -> int : ...
70
73
if sys .version_info >= (3 , 5 ):
71
- def readinto1 (self , b : bytearray ) -> int : ...
74
+ def readinto1 (self , b : _bytearray_like ) -> int : ...
72
75
if sys .version_info >= (3 , 4 ):
73
76
def read (self , size : Optional [int ] = ...) -> bytes : ...
74
77
def read1 (self , size : int = ...) -> bytes : ...
@@ -129,10 +132,10 @@ class BytesIO(BinaryIO):
129
132
def closed (self ) -> bool : ...
130
133
# copied from BufferedIOBase
131
134
def detach (self ) -> RawIOBase : ...
132
- def readinto (self , b : bytearray ) -> int : ...
135
+ def readinto (self , b : _bytearray_like ) -> int : ...
133
136
def write (self , b : Union [bytes , bytearray ]) -> int : ...
134
137
if sys .version_info >= (3 , 5 ):
135
- def readinto1 (self , b : bytearray ) -> int : ...
138
+ def readinto1 (self , b : _bytearray_like ) -> int : ...
136
139
if sys .version_info >= (3 , 4 ):
137
140
def read (self , size : Optional [int ] = ...) -> bytes : ...
138
141
def read1 (self , size : int = ...) -> bytes : ...
0 commit comments