@@ -64,21 +64,32 @@ DtypeObj = Union[np.dtype[np.generic], ExtensionDtype]
64
64
AnyStr_cov = TypeVar ("AnyStr_cov" , str , bytes , covariant = True )
65
65
AnyStr_con = TypeVar ("AnyStr_con" , str , bytes , contravariant = True )
66
66
67
- class BaseBuffer (Protocol ): ...
68
- class ReadBuffer (BaseBuffer , Protocol [AnyStr_cov ]): ...
69
- class WriteBuffer (BaseBuffer , Protocol [AnyStr_cov ]): ...
67
+ class BaseBuffer (Protocol ):
68
+ @property
69
+ def mode (self ) -> str : ...
70
+ def seek (self , __offset : int , __whence : int = ...) -> int : ...
71
+ def seekable (self ) -> bool : ...
72
+ def tell (self ) -> int : ...
73
+
74
+ class ReadBuffer (BaseBuffer , Protocol [AnyStr_cov ]):
75
+ def read (self , __n : int = ...) -> AnyStr_cov : ...
76
+
77
+ class WriteBuffer (BaseBuffer , Protocol [AnyStr_con ]):
78
+ def write (self , __b : AnyStr_con ) -> Any : ...
79
+ def flush (self ) -> Any : ...
70
80
71
81
class ReadPickleBuffer (ReadBuffer [bytes ], Protocol ):
72
- def readline (self , size : int | None = ... ) -> bytes : ...
82
+ def readline (self ) -> bytes : ...
73
83
74
84
class ReadCsvBuffer (ReadBuffer [AnyStr_cov ], Protocol [AnyStr_cov ]):
75
85
def __iter__ (self ) -> Iterator [AnyStr_cov ]: ...
86
+ def fileno (self ) -> int : ...
76
87
def readline (self ) -> AnyStr_cov : ...
77
88
@property
78
89
def closed (self ) -> bool : ...
79
90
80
91
class WriteExcelBuffer (WriteBuffer [bytes ], Protocol ):
81
- def truncate (self , size : Union [ int , None ] = ...) -> int : ...
92
+ def truncate (self , size : int | None = ...) -> int : ...
82
93
83
94
FilePath = Union [str , PathLike [str ]]
84
95
FilePathOrBuffer = Union [
0 commit comments