mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
fix DictReader definition (#1475)
* constructable with Iterable * __iter__ returns another DictReader * supports `__next__` on python 3 * supports `next` on python 2
This commit is contained in:
committed by
Jelle Zijlstra
parent
45f2d9d625
commit
7637549ced
@@ -59,11 +59,11 @@ if sys.version_info >= (3, 6):
|
||||
dialect = ... # type: _Dialect
|
||||
line_num = ... # type: int
|
||||
fieldnames = ... # type: Sequence[str]
|
||||
def __init__(self, f: Iterator[str], fieldnames: 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) -> Iterator[OrderedDict[str, str]]: ...
|
||||
def next(self) -> OrderedDict[str, str]: ...
|
||||
def __iter__(self) -> 'DictReader': ...
|
||||
def __next__(self) -> OrderedDict[str, str]: ...
|
||||
else:
|
||||
class DictReader(Iterator[Dict[Any, str]]):
|
||||
restkey = ... # type: Optional[str]
|
||||
@@ -72,11 +72,14 @@ else:
|
||||
dialect = ... # type: _Dialect
|
||||
line_num = ... # type: int
|
||||
fieldnames = ... # type: Sequence[str]
|
||||
def __init__(self, f: Iterator[str], fieldnames: 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) -> Iterator[OrderedDict[Any, str]]: ...
|
||||
def next(self) -> OrderedDict[Any, str]: ...
|
||||
def __iter__(self) -> 'DictReader': ...
|
||||
if sys.version_info >= (3,):
|
||||
def __next__(self) -> OrderedDict[Any, str]: ...
|
||||
else:
|
||||
def next(self) -> OrderedDict[Any, str]: ...
|
||||
|
||||
class DictWriter(object):
|
||||
fieldnames = ... # type: Sequence[str]
|
||||
|
||||
Reference in New Issue
Block a user