mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
fix bugs in stdlib/2/csv.py (#932)
This commit is contained in:
committed by
Guido van Rossum
parent
52dd4903d1
commit
f869a5d351
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Dict, Iterable, List, Sequence, Union
|
||||
from typing import Any, Dict, Iterable, List, Sequence, Type, Union
|
||||
|
||||
# Public interface of _csv.reader's return type
|
||||
class _Reader(Iterable[List[str]]):
|
||||
@@ -11,7 +11,7 @@ class _Reader(Iterable[List[str]]):
|
||||
|
||||
def next(self) -> List[str]: ...
|
||||
|
||||
_Row = Sequence[Union[str, int]]
|
||||
_Row = Sequence[Any] # May contain anything: csv calls str() on the elements that are not None
|
||||
|
||||
# Public interface of _csv.writer's return type
|
||||
class _Writer:
|
||||
@@ -27,7 +27,7 @@ QUOTE_NONNUMERIC = ... # type: int
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
_Dialect = Union[str, Dialect]
|
||||
_Dialect = Union[str, Dialect, Type[Dialect]]
|
||||
|
||||
def writer(csvfile: Any, dialect: _Dialect = ..., **fmtparams) -> _Writer: ...
|
||||
def reader(csvfile: Iterable[str], dialect: _Dialect = ..., **fmtparams) -> _Reader: ...
|
||||
@@ -66,7 +66,7 @@ class DictReader(Iterable):
|
||||
def __init__(self, f: Iterable[str], fieldnames: Sequence[Any] = ..., restkey=...,
|
||||
restval=..., dialect: _Dialect = ..., *args, **kwds) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
def next(self): ...
|
||||
|
||||
_DictRow = Dict[Any, Union[str, int]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user