Skip to content

Commit 0dfe2cb

Browse files
committed
Fixes
1 parent dd75e66 commit 0dfe2cb

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

pandas/_typing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107

108108

109109
class SequenceNotStr(Protocol[_T_co]):
110-
__module__ = "pandas.api.typing.aliases"
110+
__module__: str = "pandas.api.typing.aliases"
111111

112112
@overload
113113
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
@@ -280,15 +280,15 @@ def tell(self) -> int:
280280

281281

282282
class ReadBuffer(BaseBuffer, Protocol[AnyStr_co]):
283-
__module__ = "pandas.api.typing.aliases"
283+
__module__: str = "pandas.api.typing.aliases"
284284

285285
def read(self, n: int = ..., /) -> AnyStr_co:
286286
# for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File
287287
...
288288

289289

290290
class WriteBuffer(BaseBuffer, Protocol[AnyStr_contra]):
291-
__module__ = "pandas.api.typing.aliases"
291+
__module__: str = "pandas.api.typing.aliases"
292292

293293
def write(self, b: AnyStr_contra, /) -> Any:
294294
# for gzip.GzipFile, bz2.BZ2File
@@ -300,19 +300,19 @@ def flush(self) -> Any:
300300

301301

302302
class ReadPickleBuffer(ReadBuffer[bytes], Protocol):
303-
__module__ = "pandas.api.typing.aliases"
303+
__module__: str = "pandas.api.typing.aliases"
304304

305305
def readline(self) -> bytes: ...
306306

307307

308308
class WriteExcelBuffer(WriteBuffer[bytes], Protocol):
309-
__module__ = "pandas.api.typing.aliases"
309+
__module__: str = "pandas.api.typing.aliases"
310310

311311
def truncate(self, size: int | None = ..., /) -> int: ...
312312

313313

314314
class ReadCsvBuffer(ReadBuffer[AnyStr_co], Protocol):
315-
__module__ = "pandas.api.typing.aliases"
315+
__module__: str = "pandas.api.typing.aliases"
316316

317317
def __iter__(self) -> Iterator[AnyStr_co]:
318318
# for engine=python

pandas/tests/api/test_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ def get_pandas_objects(
606606
if not recurse:
607607
return objs
608608

609+
# __file__ can, but shouldn't, be None
610+
assert isinstance(module.__file__, str)
609611
paths = [pathlib.Path(module.__file__).parent]
610612
for module_info in pkgutil.walk_packages(paths):
611613
name = module_info.name

pandas/tests/series/methods/test_astype.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,7 @@ def test_astype_categorical_invalid_conversions(self):
579579
ser = Series(np.random.default_rng(2).integers(0, 10000, 100)).sort_values()
580580
ser = cut(ser, range(0, 10500, 500), right=False, labels=cat)
581581

582-
msg = (
583-
"dtype '<class 'pandas.core.arrays.categorical.Categorical'>' "
584-
"not understood"
585-
)
582+
msg = "dtype '<class 'pandas.Categorical'>' not understood"
586583
with pytest.raises(TypeError, match=msg):
587584
ser.astype(Categorical)
588585
with pytest.raises(TypeError, match=msg):

0 commit comments

Comments
 (0)