8000 csv DictReader should only yield OrderedDicts in Py3.6 · python/typeshed@fe221f8 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fe221f8

Browse files
author
Thomas Grainger
committed
csv DictReader should only yield OrderedDicts in Py3.6
1 parent 47b3979 commit fe221f8

File tree

1 file changed

+21
-27
lines changed

1 file changed

+21
-27
lines changed

stdlib/2and3/csv.pyi

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,28 @@ 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+
def __next__(self) -> _DRMapping: ...
72+
if sys.version_info >= (3,):
73+
def __next__(self) -> _DRMapping: ...
74+
else:
75+
def next(self) -> _DRMapping: ...
76+
8377

8478
class DictWriter(object):
8579
fieldnames = ... # type: Sequence[str]

0 commit comments

Comments
 (0)
0