-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't working
Description
From pandas-dev/pandas-stubs#729:
from typing import overload, Protocol, TypeVar, Any
AnyStr_contra = TypeVar("AnyStr_contra", str, bytes, contravariant=True)
class Buffer(Protocol):
def __bytes__(self) -> bytes:
...
class BytesIO:
def write(self, __b: Buffer) -> None:
pass
class WriteBuffer(Protocol[AnyStr_contra]):
def write(self, __b: AnyStr_contra) -> Any:
...
class NDFrame:
@overload
def to_csv(self, path_or_buf: WriteBuffer[bytes]) -> None:
...
@overload
def to_csv(self, path_or_buf: None = ...) -> str:
...
def to_csv(self, path_or_buf: Any = None) -> Any:
...
def test_types_to_csv() -> None:
df = NDFrame()
df.to_csv(BytesIO())
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't working