File: csv.pyi

package info (click to toggle)
mypy 0.470-complete-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,864 kB
  • ctags: 3,264
  • sloc: python: 21,838; makefile: 18
file content (88 lines) | stat: -rw-r--r-- 2,762 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Stubs for csv (Python 2.7)
#
# NOTE: Based on a dynamically typed stub automatically generated by stubgen.

from typing import Any, Dict, Iterable, List, Sequence, Union

# Public interface of _csv.reader's return type
class _Reader(Iterable[List[str]]):
    dialect = ...  # type: Dialect
    line_num = ...  # type: int

    def next(self) -> List[str]: ...

_Row = Sequence[Union[str, int]]

# Public interface of _csv.writer's return type
class _Writer:
    dialect = ...  # type: Dialect

    def writerow(self, row: _Row) -> None: ...
    def writerows(self, rows: Iterable[_Row]) -> None: ...

QUOTE_ALL = ...  # type: int
QUOTE_MINIMAL = ...  # type: int
QUOTE_NONE = ...  # type: int
QUOTE_NONNUMERIC = ...  # type: int

class Error(Exception): ...

_Dialect = Union[str, Dialect]

def writer(csvfile: Any, dialect: _Dialect = ..., **fmtparams) -> _Writer: ...
def reader(csvfile: Iterable[str], dialect: _Dialect = ..., **fmtparams) -> _Reader: ...
def register_dialect(name, dialect=..., **fmtparams): ...
def unregister_dialect(name): ...
def get_dialect(name: str) -> Dialect: ...
def list_dialects(): ...
def field_size_limit(new_limit: int = ...) -> int: ...

class Dialect:
    delimiter = ...  # type: str
    quotechar = ...  # type: str
    escapechar = ...  # type: str
    doublequote = ...  # type: bool
    skipinitialspace = ...  # type: bool
    lineterminator = ...  # type: str
    quoting = ...  # type: int
    def __init__(self) -> None: ...

class excel(Dialect):
    pass

class excel_tab(excel):
    pass

class unix_dialect(Dialect):
    pass

class DictReader(Iterable):
    restkey = ...  # type: Any
    restval = ...  # type: Any
    reader = ...  # type: Any
    dialect = ...  # type: _Dialect
    line_num = ...  # type: int
    fieldnames = ...  # type: Sequence[Any]
    def __init__(self, f: Iterable[str], fieldnames: Sequence[Any] = ..., restkey=...,
                 restval=..., dialect: _Dialect = ..., *args, **kwds) -> None: ...
    def __iter__(self): ...
    def __next__(self): ...

_DictRow = Dict[Any, Union[str, int]]

class DictWriter:
    fieldnames = ...  # type: Any
    restval = ...  # type: Any
    extrasaction = ...  # type: Any
    writer = ...  # type: Any
    def __init__(self, f: Any, fieldnames: Sequence[Any], restval=..., extrasaction: str = ...,
                 dialect: _Dialect = ..., *args, **kwds) -> None: ...
    def writeheader(self) -> None: ...
    def writerow(self, rowdict: _DictRow) -> None: ...
    def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ...

class Sniffer:
    preferred = ...  # type: Any
    def __init__(self) -> None: ...
    def sniff(self, sample: str, delimiters: str = ...) -> Dialect: ...
    def has_header(self, sample: str) -> bool: ...