Skip to content

Commit 2bb7ea9

Browse files
graingertJelleZijlstra
authored andcommitted
csv DictReader should only yield OrderedDicts in Py3.6 (#1478)
1 parent d75ea88 commit 2bb7ea9

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

stdlib/2and3/csv.pyi

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,27 @@ if sys.version_info >= (3,):
5252
quoting = ... # type: int
5353

5454
if sys.version_info >= (3, 6):
55-
class DictReader(Iterator[OrderedDict[str, str]]):
56-
restkey = ... # type: Optional[str]
57-
restval = ... # type: Optional[str]
58-
reader = ... # type: _reader
59-
dialect = ... # type: _Dialect
60-
line_num = ... # type: int
61-
fieldnames = ... # type: Sequence[str]
62-
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
63-
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
64-
*args: Any, **kwds: Any) -> None: ...
65-
def __iter__(self) -> 'DictReader': ...
66-
def __next__(self) -> OrderedDict[str, str]: ...
55+
_DRMapping = OrderedDict[str, str]
6756
else:
68-
class DictReader(Iterator[Dict[Any, str]]):
69-
restkey = ... # type: Optional[str]
70-
restval = ... # type: Optional[str]
71-
reader = ... # type: _reader
72-
dialect = ... # type: _Dialect
73-
line_num = ... # type: int
74-
fieldnames = ... # type: Sequence[str]
75-
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
76-
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
77-
*args: Any, **kwds: Any) -> None: ...
78-
def __iter__(self) -> 'DictReader': ...
79-
if sys.version_info >= (3,):
80-
def __next__(self) -> OrderedDict[Any, str]: ...
81-
else:
82-
def next(self) -> OrderedDict[Any, str]: ...
57+
_DRMapping = Dict[str, str]
58+
59+
60+
class DictReader(Iterator[_DRMapping]):
61+
restkey = ... # type: Optional[str]
62+
restval = ... # type: Optional[str]
63+
reader = ... # type: _reader
64+
dialect = ... # type: _Dialect
65+
line_num = ... # type: int
66+
fieldnames = ... # type: Sequence[str]
67+
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
68+
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
69+
*args: Any, **kwds: Any) -> None: ...
70+
def __iter__(self) -> 'DictReader': ...
71+
if sys.version_info >= (3,):
72+
def __next__(self) -> _DRMapping: ...
73+
else:
74+
def next(self) -> _DRMapping: ...
75+
8376

8477
class DictWriter(object):
8578
fieldnames = ... # type: Sequence[str]

0 commit comments

Comments
 (0)