Skip to content

csv: more precise types, remove TODO #3581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions stdlib/2and3/_csv.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

from typing import Any, Iterable, Iterator, List, Optional, Sequence, Text
from typing import Any, Iterable, Iterator, List, Optional, Protocol, Sequence, Text, Union

QUOTE_ALL: int
QUOTE_MINIMAL: int
Expand Down Expand Up @@ -39,9 +39,10 @@ class _writer:
def writerows(self, rows: Iterable[Sequence[Any]]) -> None: ...


# TODO: precise type
def writer(csvfile: Any, dialect: Any = ..., **fmtparams: Any) -> _writer: ...
def reader(csvfile: Iterable[Text], dialect: Any = ..., **fmtparams: Any) -> _reader: ...
class _Writer(Protocol):
def write(self, s: str) -> Any: ...
def writer(csvfile: _Writer, dialect: Union[Dialect, str] = ..., **fmtparams: Any) -> _writer: ...
def reader(csvfile: Iterable[Text], dialect: Union[Dialect, str] = ..., **fmtparams: Any) -> _reader: ...
def register_dialect(name: str, dialect: Any = ..., **fmtparams: Any) -> None: ...
def unregister_dialect(name: str) -> None: ...
def get_dialect(name: str) -> Dialect: ...
Expand Down