188188PythonFuncType = Callable [[Any ], Any ]
189189
190190# filenames and file-like-objects
191- AnyStr_cov = TypeVar ("AnyStr_cov " , str , bytes , covariant = True )
192- AnyStr_con = TypeVar ("AnyStr_con " , str , bytes , contravariant = True )
191+ AnyStr_co = TypeVar ("AnyStr_co " , str , bytes , covariant = True )
192+ AnyStr_contra = TypeVar ("AnyStr_contra " , str , bytes , contravariant = True )
193193
194194
195195class BaseBuffer (Protocol ):
@@ -212,14 +212,14 @@ def tell(self) -> int:
212212 ...
213213
214214
215- class ReadBuffer (BaseBuffer , Protocol [AnyStr_cov ]):
216- def read (self , __n : int = ...) -> AnyStr_cov :
215+ class ReadBuffer (BaseBuffer , Protocol [AnyStr_co ]):
216+ def read (self , __n : int = ...) -> AnyStr_co :
217217 # for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File
218218 ...
219219
220220
221- class WriteBuffer (BaseBuffer , Protocol [AnyStr_con ]):
222- def write (self , __b : AnyStr_con ) -> Any :
221+ class WriteBuffer (BaseBuffer , Protocol [AnyStr_contra ]):
222+ def write (self , __b : AnyStr_contra ) -> Any :
223223 # for gzip.GzipFile, bz2.BZ2File
224224 ...
225225
@@ -238,16 +238,16 @@ def truncate(self, size: int | None = ...) -> int:
238238 ...
239239
240240
241- class ReadCsvBuffer (ReadBuffer [AnyStr_cov ], Protocol ):
242- def __iter__ (self ) -> Iterator [AnyStr_cov ]:
241+ class ReadCsvBuffer (ReadBuffer [AnyStr_co ], Protocol ):
242+ def __iter__ (self ) -> Iterator [AnyStr_co ]:
243243 # for engine=python
244244 ...
245245
246246 def fileno (self ) -> int :
247247 # for _MMapWrapper
248248 ...
249249
250- def readline (self ) -> AnyStr_cov :
250+ def readline (self ) -> AnyStr_co :
251251 # for engine=python
252252 ...
253253
0 commit comments