|
| 1 | +from collections import OrderedDict |
| 2 | +import sys |
| 3 | +from typing import Any, Dict, Iterable, Iterator, List, Optional, Sequence, Union |
| 4 | + |
| 5 | +from _csv import _reader, _writer, reader as reader, writer as writer, register_dialect as register_dialect, unregister_dialect as unregister_dialect, get_dialect as get_dialect, list_dialects as list_dialects, field_size_limit as field_size_limit, QUOTE_ALL as QUOTE_ALL, QUOTE_MINIMAL as QUOTE_MINIMAL, QUOTE_NONE as QUOTE_NONE, QUOTE_NONNUMERIC as QUOTE_NONNUMERIC, Error as Error |
| 6 | + |
| 7 | +_Dialect = Union[str, Dialect] |
| 8 | +_DictRow = Dict[str, Any] |
| 9 | + |
| 10 | +class Dialect: |
| 11 | + delimiter = ... # type: str |
| 12 | + quotechar = ... # type: Optional[str] |
| 13 | + escapechar = ... # type: Optional[str] |
| 14 | + doublequote = ... # type: bool |
| 15 | + skipinitialspace = ... # type: bool |
| 16 | + lineterminator = ... # type: str |
| 17 | + quoting = ... # type: int |
| 18 | + def __init__(self) -> None: ... |
| 19 | + |
| 20 | +class excel(Dialect): |
| 21 | + delimiter = ... # type: str |
| 22 | + quotechar = ... # type: str |
| 23 | + doublequote = ... # type: bool |
| 24 | + skipinitialspace = ... # type: bool |
| 25 | + lineterminator = ... # type: str |
| 26 | + quoting = ... # type: int |
| 27 | + |
| 28 | +class excel_tab(excel): |
| 29 | + delimiter = ... # type: str |
| 30 | + |
| 31 | +if sys.version_info >= (3,): |
| 32 | + class unix_dialect(Dialect): |
| 33 | + delimiter = ... # type: str |
| 34 | + quotechar = ... # type: str |
| 35 | + doublequote = ... # type: bool |
| 36 | + skipinitialspace = ... # type: bool |
| 37 | + lineterminator = ... # type: str |
| 38 | + quoting = ... # type: int |
| 39 | + |
| 40 | +if sys.version_info >= (3, 6): |
| 41 | + class DictReader(Iterator[OrderedDict[str, str]]): |
| 42 | + restkey = ... # type: Optional[str] |
| 43 | + restval = ... # type: Optional[str] |
| 44 | + reader = ... # type: _reader |
| 45 | + dialect = ... # type: _Dialect |
| 46 | + line_num = ... # type: int |
| 47 | + fieldnames = ... # type: Sequence[str] |
| 48 | + def __init__(self, f: Iterator[str], fieldnames: Sequence[str] = ..., restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ..., *args: Any, **kwds: Any) -> None: ... |
| 49 | +else: |
| 50 | + class DictReader(Iterator[Dict[str, str]]): |
| 51 | + restkey = ... # type: Optional[str] |
| 52 | + restval = ... # type: Optional[str] |
| 53 | + reader = ... # type: _reader |
| 54 | + dialect = ... # type: _Dialect |
| 55 | + line_num = ... # type: int |
| 56 | + fieldnames = ... # type: Sequence[str] |
| 57 | + def __init__(self, f: Iterator[str], fieldnames: Sequence[str] = ..., restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ..., *args: Any, **kwds: Any) -> None: ... |
| 58 | + |
| 59 | +class DictWriter: |
| 60 | + fieldnames = ... # type: Sequence[str] |
| 61 | + restval = ... # type: Optional[Any] |
| 62 | + extrasaction = ... # type: str |
| 63 | + writer = ... # type: _writer |
| 64 | + def __init__(self, f: Any, fieldnames: Sequence[str], restval: Optional[Any], extrasaction: str = ..., dialect: _Dialect = ..., *args: Any, **kwds: Any) -> None: ... |
| 65 | + def writeheader(self) -> None: ... |
| 66 | + def writerow(self, rowdict: _DictRow) -> None: ... |
| 67 | + def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ... |
| 68 | + |
| 69 | +class Sniffer: |
| 70 | + preferred = ... # type: List[str] |
| 71 | + def __init__(self) -> None: ... |
| 72 | + def sniff(self, sample: str, delimiters: Optional[str] = ...) -> Dialect: ... |
| 73 | + def has_header(self, sample: str) -> bool: ... |
0 commit comments