Skip to content

csv DictReader should only yield OrderedDicts in Py3.6 #1478

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
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
47 changes: 20 additions & 27 deletions stdlib/2and3/csv.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,27 @@ if sys.version_info >= (3,):
quoting = ... # type: int

if sys.version_info >= (3, 6):
class DictReader(Iterator[OrderedDict[str, str]]):
restkey = ... # type: Optional[str]
restval = ... # type: Optional[str]
reader = ... # type: _reader
dialect = ... # type: _Dialect
line_num = ... # type: int
fieldnames = ... # type: Sequence[str]
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
*args: Any, **kwds: Any) -> None: ...
def __iter__(self) -> 'DictReader': ...
def __next__(self) -> OrderedDict[str, str]: ...
_DRMapping = OrderedDict[str, str]
else:
class DictReader(Iterator[Dict[Any, str]]):
restkey = ... # type: Optional[str]
restval = ... # type: Optional[str]
reader = ... # type: _reader
dialect = ... # type: _Dialect
line_num = ... # type: int
fieldnames = ... # type: Sequence[str]
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
*args: Any, **kwds: Any) -> None: ...
def __iter__(self) -> 'DictReader': ...
if sys.version_info >= (3,):
def __next__(self) -> OrderedDict[Any, str]: ...
else:
def next(self) -> OrderedDict[Any, str]: ...
_DRMapping = Dict[str, str]


class DictReader(Iterator[_DRMapping]):
restkey = ... # type: Optional[str]
restval = ... # type: Optional[str]
reader = ... # type: _reader
dialect = ... # type: _Dialect
line_num = ... # type: int
fieldnames = ... # type: Sequence[str]
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
*args: Any, **kwds: Any) -> None: ...
def __iter__(self) -> 'DictReader': ...
if sys.version_info >= (3,):
def __next__(self) -> _DRMapping: ...
else:
def next(self) -> _DRMapping: ...


class DictWriter(object):
fieldnames = ... # type: Sequence[str]
Expand Down