Skip to content

Update stub for csv#1398

Merged
matthiaskramm merged 1 commit intopython:masterfrom
ymyzk:update-csv
Jun 15, 2017
Merged

Update stub for csv#1398
matthiaskramm merged 1 commit intopython:masterfrom
ymyzk:update-csv

Conversation

@ymyzk
Copy link
Copy Markdown
Contributor

@ymyzk ymyzk commented Jun 10, 2017

Update stub for csv. Fixes #1277 and #1381.

There are some imprecise type annotations, because I do not now how.

@matthiaskramm
Copy link
Copy Markdown
Contributor

Would it make sense to merge the Python 2 and Python 3 version of csv and _csv, while at it?

skipinitialspace = ... # type: bool
lineterminator = ... # type: str
quoting = ... # type: int
def __init__(self) -> None: ...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least in master, there's also strict: int.

stdlib/3/csv.pyi Outdated
QUOTE_MINIMAL = ... # type: int
QUOTE_NONE = ... # type: int
QUOTE_NONNUMERIC = ... # type: int
from _csv import _reader, _writer, reader, writer, register_dialect, unregister_dialect, get_dialect, list_dialects, field_size_limit, QUOTE_ALL, QUOTE_MINIMAL, QUOTE_NONE, QUOTE_NONNUMERIC
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To re-export these here, you need to write from _csv import reader as reader and similar.

stdlib/3/csv.pyi Outdated
dialect = ... # type: Any
line_num = ... # type: int
fieldnames = ... # type: Sequence[str]
def __init__(self, f: Iterator[str], fieldnames: Sequence[str] = ..., restkey: Optional[str] =..., restval: Optional[str] = ..., dialect: Any =..., *args: Any, **kwds: Any) -> None: ...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after each = (also on line 57 below)

@ymyzk
Copy link
Copy Markdown
Contributor Author

ymyzk commented Jun 15, 2017

Fixed errors pointed by @JelleZijlstra, and merged the Python 2 version and the Python 3 version.

@matthiaskramm matthiaskramm merged commit 1c84982 into python:master Jun 15, 2017
@ymyzk ymyzk deleted the update-csv branch June 16, 2017 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants