Skip to content

Commit a45dcfd

Browse files
authored
STYLE enable pylint: typevar-name-incorrect-variance (#49768)
1 parent c37dfc1 commit a45dcfd

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

pandas/_typing.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@
188188
PythonFuncType = 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

195195
class 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

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ disable = [
8585
"missing-module-docstring",
8686
"singleton-comparison",
8787
"too-many-lines",
88-
"typevar-name-incorrect-variance",
8988
"ungrouped-imports",
9089
"unidiomatic-typecheck",
9190
"unnecessary-dunder-call",

0 commit comments

Comments
 (0)