basedpyright 1.12.6 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright-langserver.js.map +1 -1
  3. package/dist/pyright.js +1 -1
  4. package/dist/pyright.js.map +1 -1
  5. package/dist/typeshed-fallback/stdlib/_ast.pyi +279 -42
  6. package/dist/typeshed-fallback/stdlib/_bisect.pyi +149 -12
  7. package/dist/typeshed-fallback/stdlib/_codecs.pyi +125 -14
  8. package/dist/typeshed-fallback/stdlib/_csv.pyi +130 -7
  9. package/dist/typeshed-fallback/stdlib/_ctypes.pyi +72 -17
  10. package/dist/typeshed-fallback/stdlib/_curses.pyi +626 -78
  11. package/dist/typeshed-fallback/stdlib/_decimal.pyi +775 -153
  12. package/dist/typeshed-fallback/stdlib/_heapq.pyi +61 -5
  13. package/dist/typeshed-fallback/stdlib/_imp.pyi +70 -15
  14. package/dist/typeshed-fallback/stdlib/_json.pyi +55 -12
  15. package/dist/typeshed-fallback/stdlib/_locale.pyi +63 -12
  16. package/dist/typeshed-fallback/stdlib/_lsprof.pyi +61 -4
  17. package/dist/typeshed-fallback/stdlib/_operator.pyi +238 -62
  18. package/dist/typeshed-fallback/stdlib/_posixsubprocess.pyi +25 -1
  19. package/dist/typeshed-fallback/stdlib/_random.pyi +23 -5
  20. package/dist/typeshed-fallback/stdlib/_socket.pyi +618 -63
  21. package/dist/typeshed-fallback/stdlib/_stat.pyi +140 -13
  22. package/dist/typeshed-fallback/stdlib/_thread.pyi +215 -22
  23. package/dist/typeshed-fallback/stdlib/_tkinter.pyi +44 -11
  24. package/dist/typeshed-fallback/stdlib/_tracemalloc.pyi +71 -10
  25. package/dist/typeshed-fallback/stdlib/_warnings.pyi +53 -6
  26. package/dist/typeshed-fallback/stdlib/_weakref.pyi +43 -10
  27. package/dist/typeshed-fallback/stdlib/_winapi.pyi +255 -255
  28. package/dist/typeshed-fallback/stdlib/array.pyi +233 -44
  29. package/dist/typeshed-fallback/stdlib/atexit.pyi +50 -5
  30. package/dist/typeshed-fallback/stdlib/audioop.pyi +78 -26
  31. package/dist/typeshed-fallback/stdlib/binascii.pyi +105 -18
  32. package/dist/typeshed-fallback/stdlib/builtins.pyi +5254 -829
  33. package/dist/typeshed-fallback/stdlib/cmath.pyi +99 -23
  34. package/dist/typeshed-fallback/stdlib/errno.pyi +15 -0
  35. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +33 -8
  36. package/dist/typeshed-fallback/stdlib/fcntl.pyi +199 -8
  37. package/dist/typeshed-fallback/stdlib/gc.pyi +130 -18
  38. package/dist/typeshed-fallback/stdlib/grp.pyi +58 -7
  39. package/dist/typeshed-fallback/stdlib/itertools.pyi +281 -42
  40. package/dist/typeshed-fallback/stdlib/marshal.pyi +82 -4
  41. package/dist/typeshed-fallback/stdlib/math.pyi +357 -61
  42. package/dist/typeshed-fallback/stdlib/mmap.pyi +47 -8
  43. package/dist/typeshed-fallback/stdlib/msvcrt.pyi +32 -32
  44. package/dist/typeshed-fallback/stdlib/nt.pyi +118 -111
  45. package/dist/typeshed-fallback/stdlib/parser.pyi +55 -24
  46. package/dist/typeshed-fallback/stdlib/posix.pyi +7 -0
  47. package/dist/typeshed-fallback/stdlib/pwd.pyi +60 -10
  48. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +61 -12
  49. package/dist/typeshed-fallback/stdlib/readline.pyi +184 -27
  50. package/dist/typeshed-fallback/stdlib/resource.pyi +56 -16
  51. package/dist/typeshed-fallback/stdlib/select.pyi +97 -5
  52. package/dist/typeshed-fallback/stdlib/spwd.pyi +60 -11
  53. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +386 -48
  54. package/dist/typeshed-fallback/stdlib/syslog.pyi +27 -7
  55. package/dist/typeshed-fallback/stdlib/termios.pyi +88 -8
  56. package/dist/typeshed-fallback/stdlib/time.pyi +314 -37
  57. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +264 -34
  58. package/dist/typeshed-fallback/stdlib/winreg.pyi +172 -132
  59. package/dist/typeshed-fallback/stdlib/zlib.pyi +108 -7
  60. package/package.json +1 -1
@@ -1,3 +1,12 @@
1
+ """
2
+ Bisection algorithms.
3
+
4
+ This module provides support for maintaining a list in sorted order without
5
+ having to sort the list after each insertion. For long lists of items with
6
+ expensive comparison operations, this can be an improvement over the more
7
+ common approach.
8
+ """
9
+
1
10
  import sys
2
11
  from _typeshed import SupportsLenAndGetItem, SupportsRichComparisonT
3
12
  from collections.abc import Callable, MutableSequence
@@ -14,7 +23,18 @@ if sys.version_info >= (3, 10):
14
23
  hi: int | None = None,
15
24
  *,
16
25
  key: None = None,
17
- ) -> int: ...
26
+ ) -> int:
27
+ """
28
+ Return the index where to insert item x in list a, assuming a is sorted.
29
+
30
+ The return value i is such that all e in a[:i] have e < x, and all e in
31
+ a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
32
+ insert just before the leftmost x already there.
33
+
34
+ Optional args lo (default 0) and hi (default len(a)) bound the
35
+ slice of a to be searched.
36
+ """
37
+ ...
18
38
  @overload
19
39
  def bisect_left(
20
40
  a: SupportsLenAndGetItem[_T],
@@ -23,7 +43,18 @@ if sys.version_info >= (3, 10):
23
43
  hi: int | None = None,
24
44
  *,
25
45
  key: Callable[[_T], SupportsRichComparisonT],
26
- ) -> int: ...
46
+ ) -> int:
47
+ """
48
+ Return the index where to insert item x in list a, assuming a is sorted.
49
+
50
+ The return value i is such that all e in a[:i] have e < x, and all e in
51
+ a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
52
+ insert just before the leftmost x already there.
53
+
54
+ Optional args lo (default 0) and hi (default len(a)) bound the
55
+ slice of a to be searched.
56
+ """
57
+ ...
27
58
  @overload
28
59
  def bisect_right(
29
60
  a: SupportsLenAndGetItem[SupportsRichComparisonT],
@@ -32,7 +63,18 @@ if sys.version_info >= (3, 10):
32
63
  hi: int | None = None,
33
64
  *,
34
65
  key: None = None,
35
- ) -> int: ...
66
+ ) -> int:
67
+ """
68
+ Return the index where to insert item x in list a, assuming a is sorted.
69
+
70
+ The return value i is such that all e in a[:i] have e <= x, and all e in
71
+ a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
72
+ insert just after the rightmost x already there.
73
+
74
+ Optional args lo (default 0) and hi (default len(a)) bound the
75
+ slice of a to be searched.
76
+ """
77
+ ...
36
78
  @overload
37
79
  def bisect_right(
38
80
  a: SupportsLenAndGetItem[_T],
@@ -41,7 +83,18 @@ if sys.version_info >= (3, 10):
41
83
  hi: int | None = None,
42
84
  *,
43
85
  key: Callable[[_T], SupportsRichComparisonT],
44
- ) -> int: ...
86
+ ) -> int:
87
+ """
88
+ Return the index where to insert item x in list a, assuming a is sorted.
89
+
90
+ The return value i is such that all e in a[:i] have e <= x, and all e in
91
+ a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
92
+ insert just after the rightmost x already there.
93
+
94
+ Optional args lo (default 0) and hi (default len(a)) bound the
95
+ slice of a to be searched.
96
+ """
97
+ ...
45
98
  @overload
46
99
  def insort_left(
47
100
  a: MutableSequence[SupportsRichComparisonT],
@@ -50,11 +103,29 @@ if sys.version_info >= (3, 10):
50
103
  hi: int | None = None,
51
104
  *,
52
105
  key: None = None,
53
- ) -> None: ...
106
+ ) -> None:
107
+ """
108
+ Insert item x in list a, and keep it sorted assuming a is sorted.
109
+
110
+ If x is already in a, insert it to the left of the leftmost x.
111
+
112
+ Optional args lo (default 0) and hi (default len(a)) bound the
113
+ slice of a to be searched.
114
+ """
115
+ ...
54
116
  @overload
55
117
  def insort_left(
56
118
  a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
57
- ) -> None: ...
119
+ ) -> None:
120
+ """
121
+ Insert item x in list a, and keep it sorted assuming a is sorted.
122
+
123
+ If x is already in a, insert it to the left of the leftmost x.
124
+
125
+ Optional args lo (default 0) and hi (default len(a)) bound the
126
+ slice of a to be searched.
127
+ """
128
+ ...
58
129
  @overload
59
130
  def insort_right(
60
131
  a: MutableSequence[SupportsRichComparisonT],
@@ -63,22 +134,88 @@ if sys.version_info >= (3, 10):
63
134
  hi: int | None = None,
64
135
  *,
65
136
  key: None = None,
66
- ) -> None: ...
137
+ ) -> None:
138
+ """
139
+ Insert item x in list a, and keep it sorted assuming a is sorted.
140
+
141
+ If x is already in a, insert it to the right of the rightmost x.
142
+
143
+ Optional args lo (default 0) and hi (default len(a)) bound the
144
+ slice of a to be searched.
145
+ """
146
+ ...
67
147
  @overload
68
148
  def insort_right(
69
149
  a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
70
- ) -> None: ...
150
+ ) -> None:
151
+ """
152
+ Insert item x in list a, and keep it sorted assuming a is sorted.
153
+
154
+ If x is already in a, insert it to the right of the rightmost x.
155
+
156
+ Optional args lo (default 0) and hi (default len(a)) bound the
157
+ slice of a to be searched.
158
+ """
159
+ ...
71
160
 
72
161
  else:
73
162
  def bisect_left(
74
163
  a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
75
- ) -> int: ...
164
+ ) -> int:
165
+ """
166
+ bisect_left(a, x[, lo[, hi]]) -> index
167
+
168
+ Return the index where to insert item x in list a, assuming a is sorted.
169
+
170
+ The return value i is such that all e in a[:i] have e < x, and all e in
171
+ a[i:] have e >= x. So if x already appears in the list, i points just
172
+ before the leftmost x already there.
173
+
174
+ Optional args lo (default 0) and hi (default len(a)) bound the
175
+ slice of a to be searched.
176
+ """
177
+ ...
76
178
  def bisect_right(
77
179
  a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
78
- ) -> int: ...
180
+ ) -> int:
181
+ """
182
+ bisect_right(a, x[, lo[, hi]]) -> index
183
+
184
+ Return the index where to insert item x in list a, assuming a is sorted.
185
+
186
+ The return value i is such that all e in a[:i] have e <= x, and all e in
187
+ a[i:] have e > x. So if x already appears in the list, i points just
188
+ beyond the rightmost x already there
189
+
190
+ Optional args lo (default 0) and hi (default len(a)) bound the
191
+ slice of a to be searched.
192
+ """
193
+ ...
79
194
  def insort_left(
80
195
  a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
81
- ) -> None: ...
196
+ ) -> None:
197
+ """
198
+ insort_left(a, x[, lo[, hi]])
199
+
200
+ Insert item x in list a, and keep it sorted assuming a is sorted.
201
+
202
+ If x is already in a, insert it to the left of the leftmost x.
203
+
204
+ Optional args lo (default 0) and hi (default len(a)) bound the
205
+ slice of a to be searched.
206
+ """
207
+ ...
82
208
  def insort_right(
83
209
  a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
84
- ) -> None: ...
210
+ ) -> None:
211
+ """
212
+ insort_right(a, x[, lo[, hi]])
213
+
214
+ Insert item x in list a, and keep it sorted assuming a is sorted.
215
+
216
+ If x is already in a, insert it to the right of the rightmost x.
217
+
218
+ Optional args lo (default 0) and hi (default len(a)) bound the
219
+ slice of a to be searched.
220
+ """
221
+ ...
@@ -13,13 +13,42 @@ _CharMap: TypeAlias = dict[int, int] | _EncodingMap
13
13
  _Handler: TypeAlias = Callable[[UnicodeError], tuple[str | bytes, int]]
14
14
  _SearchFunction: TypeAlias = Callable[[str], codecs.CodecInfo | None]
15
15
 
16
- def register(search_function: _SearchFunction, /) -> None: ...
16
+ def register(search_function: _SearchFunction, /) -> None:
17
+ """
18
+ Register a codec search function.
17
19
 
18
- if sys.version_info >= (3, 10):
19
- def unregister(search_function: _SearchFunction, /) -> None: ...
20
+ Search functions are expected to take one argument, the encoding name in
21
+ all lower case letters, and either return None, or a tuple of functions
22
+ (encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).
23
+ """
24
+ ...
20
25
 
21
- def register_error(errors: str, handler: _Handler, /) -> None: ...
22
- def lookup_error(name: str, /) -> _Handler: ...
26
+ if sys.version_info >= (3, 10):
27
+ def unregister(search_function: _SearchFunction, /) -> None:
28
+ """
29
+ Unregister a codec search function and clear the registry's cache.
30
+
31
+ If the search function is not registered, do nothing.
32
+ """
33
+ ...
34
+
35
+ def register_error(errors: str, handler: _Handler, /) -> None:
36
+ """
37
+ Register the specified error handler under the name errors.
38
+
39
+ handler must be a callable object, that will be called with an exception
40
+ instance containing information about the location of the encoding/decoding
41
+ error and must return a (replacement, new position) tuple.
42
+ """
43
+ ...
44
+ def lookup_error(name: str, /) -> _Handler:
45
+ """
46
+ lookup_error(errors) -> handler
47
+
48
+ Return the error handler for the specified error handling name or raise a
49
+ LookupError, if no handler exists under this name.
50
+ """
51
+ ...
23
52
 
24
53
  # The type ignore on `encode` and `decode` is to avoid issues with overlapping overloads, for more details, see #300
25
54
  # https://docs.python.org/3/library/codecs.html#binary-transforms
@@ -45,15 +74,65 @@ _BytesToBytesEncoding: TypeAlias = Literal[
45
74
  _StrToStrEncoding: TypeAlias = Literal["rot13", "rot_13"]
46
75
 
47
76
  @overload
48
- def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ...
77
+ def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes:
78
+ """
79
+ Encodes obj using the codec registered for encoding.
80
+
81
+ The default encoding is 'utf-8'. errors may be given to set a
82
+ different error handling scheme. Default is 'strict' meaning that encoding
83
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
84
+ and 'backslashreplace' as well as any other name registered with
85
+ codecs.register_error that can handle ValueErrors.
86
+ """
87
+ ...
49
88
  @overload
50
- def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[overload-overlap]
89
+ def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str:
90
+ """
91
+ Encodes obj using the codec registered for encoding.
92
+
93
+ The default encoding is 'utf-8'. errors may be given to set a
94
+ different error handling scheme. Default is 'strict' meaning that encoding
95
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
96
+ and 'backslashreplace' as well as any other name registered with
97
+ codecs.register_error that can handle ValueErrors.
98
+ """
99
+ ...
51
100
  @overload
52
- def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
101
+ def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes:
102
+ """
103
+ Encodes obj using the codec registered for encoding.
104
+
105
+ The default encoding is 'utf-8'. errors may be given to set a
106
+ different error handling scheme. Default is 'strict' meaning that encoding
107
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
108
+ and 'backslashreplace' as well as any other name registered with
109
+ codecs.register_error that can handle ValueErrors.
110
+ """
111
+ ...
53
112
  @overload
54
- def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[overload-overlap]
113
+ def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes:
114
+ """
115
+ Decodes obj using the codec registered for encoding.
116
+
117
+ Default encoding is 'utf-8'. errors may be given to set a
118
+ different error handling scheme. Default is 'strict' meaning that encoding
119
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
120
+ and 'backslashreplace' as well as any other name registered with
121
+ codecs.register_error that can handle ValueErrors.
122
+ """
123
+ ...
55
124
  @overload
56
- def decode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ...
125
+ def decode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str:
126
+ """
127
+ Decodes obj using the codec registered for encoding.
128
+
129
+ Default encoding is 'utf-8'. errors may be given to set a
130
+ different error handling scheme. Default is 'strict' meaning that encoding
131
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
132
+ and 'backslashreplace' as well as any other name registered with
133
+ codecs.register_error that can handle ValueErrors.
134
+ """
135
+ ...
57
136
 
58
137
  # these are documented as text encodings but in practice they also accept str as input
59
138
  @overload
@@ -61,14 +140,46 @@ def decode(
61
140
  obj: str,
62
141
  encoding: Literal["unicode_escape", "unicode-escape", "raw_unicode_escape", "raw-unicode-escape"],
63
142
  errors: str = "strict",
64
- ) -> str: ...
143
+ ) -> str:
144
+ """
145
+ Decodes obj using the codec registered for encoding.
146
+
147
+ Default encoding is 'utf-8'. errors may be given to set a
148
+ different error handling scheme. Default is 'strict' meaning that encoding
149
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
150
+ and 'backslashreplace' as well as any other name registered with
151
+ codecs.register_error that can handle ValueErrors.
152
+ """
153
+ ...
65
154
 
66
155
  # hex is officially documented as a bytes to bytes encoding, but it appears to also work with str
67
156
  @overload
68
- def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ...
157
+ def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes:
158
+ """
159
+ Decodes obj using the codec registered for encoding.
160
+
161
+ Default encoding is 'utf-8'. errors may be given to set a
162
+ different error handling scheme. Default is 'strict' meaning that encoding
163
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
164
+ and 'backslashreplace' as well as any other name registered with
165
+ codecs.register_error that can handle ValueErrors.
166
+ """
167
+ ...
69
168
  @overload
70
- def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...
71
- def lookup(encoding: str, /) -> codecs.CodecInfo: ...
169
+ def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str:
170
+ """
171
+ Decodes obj using the codec registered for encoding.
172
+
173
+ Default encoding is 'utf-8'. errors may be given to set a
174
+ different error handling scheme. Default is 'strict' meaning that encoding
175
+ errors raise a ValueError. Other possible values are 'ignore', 'replace'
176
+ and 'backslashreplace' as well as any other name registered with
177
+ codecs.register_error that can handle ValueErrors.
178
+ """
179
+ ...
180
+ def lookup(encoding: str, /) -> codecs.CodecInfo:
181
+ """Looks up a codec tuple in the Python codec registry and returns a CodecInfo object."""
182
+ ...
72
183
  def charmap_build(map: str, /) -> _CharMap: ...
73
184
  def ascii_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
74
185
  def ascii_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
@@ -1,3 +1,62 @@
1
+ r"""
2
+ CSV parsing and writing.
3
+
4
+ This module provides classes that assist in the reading and writing
5
+ of Comma Separated Value (CSV) files, and implements the interface
6
+ described by PEP 305. Although many CSV files are simple to parse,
7
+ the format is not formally defined by a stable specification and
8
+ is subtle enough that parsing lines of a CSV file with something
9
+ like line.split(",") is bound to fail. The module supports three
10
+ basic APIs: reading, writing, and registration of dialects.
11
+
12
+
13
+ DIALECT REGISTRATION:
14
+
15
+ Readers and writers support a dialect argument, which is a convenient
16
+ handle on a group of settings. When the dialect argument is a string,
17
+ it identifies one of the dialects previously registered with the module.
18
+ If it is a class or instance, the attributes of the argument are used as
19
+ the settings for the reader or writer:
20
+
21
+ class excel:
22
+ delimiter = ','
23
+ quotechar = '"'
24
+ escapechar = None
25
+ doublequote = True
26
+ skipinitialspace = False
27
+ lineterminator = '\r\n'
28
+ quoting = QUOTE_MINIMAL
29
+
30
+ SETTINGS:
31
+
32
+ * quotechar - specifies a one-character string to use as the
33
+ quoting character. It defaults to '"'.
34
+ * delimiter - specifies a one-character string to use as the
35
+ field separator. It defaults to ','.
36
+ * skipinitialspace - specifies how to interpret whitespace which
37
+ immediately follows a delimiter. It defaults to False, which
38
+ means that whitespace immediately following a delimiter is part
39
+ of the following field.
40
+ * lineterminator - specifies the character sequence which should
41
+ terminate rows.
42
+ * quoting - controls when quotes should be generated by the writer.
43
+ It can take on any of the following module constants:
44
+
45
+ csv.QUOTE_MINIMAL means only when required, for example, when a
46
+ field contains either the quotechar or the delimiter
47
+ csv.QUOTE_ALL means that quotes are always placed around fields.
48
+ csv.QUOTE_NONNUMERIC means that quotes are always placed around
49
+ fields which do not parse as integers or floating point
50
+ numbers.
51
+ csv.QUOTE_NONE means that quotes are never placed around fields.
52
+ * escapechar - specifies a one-character string used to escape
53
+ the delimiter when quoting is set to QUOTE_NONE.
54
+ * doublequote - controls the handling of quotes inside fields. When
55
+ True, two consecutive quotes are interpreted as one during read,
56
+ and when writing, each quote character embedded in the data is
57
+ written as two quotes
58
+ """
59
+
1
60
  import sys
2
61
  from _typeshed import SupportsWrite
3
62
  from collections.abc import Iterable, Iterator
@@ -21,6 +80,11 @@ _QuotingType: TypeAlias = int
21
80
  class Error(Exception): ...
22
81
 
23
82
  class Dialect:
83
+ """
84
+ CSV dialect
85
+
86
+ The Dialect type records CSV parsing and generation options.
87
+ """
24
88
  delimiter: str
25
89
  quotechar: str | None
26
90
  escapechar: str | None
@@ -57,7 +121,22 @@ def writer(
57
121
  lineterminator: str = "\r\n",
58
122
  quoting: _QuotingType = 0,
59
123
  strict: bool = False,
60
- ) -> _writer: ...
124
+ ) -> _writer:
125
+ """
126
+ csv_writer = csv.writer(fileobj [, dialect='excel']
127
+ [optional keyword args])
128
+ for row in sequence:
129
+ csv_writer.writerow(row)
130
+
131
+ [or]
132
+
133
+ csv_writer = csv.writer(fileobj [, dialect='excel']
134
+ [optional keyword args])
135
+ csv_writer.writerows(rows)
136
+
137
+ The "fileobj" argument can be any object that supports the file API.
138
+ """
139
+ ...
61
140
  def reader(
62
141
  csvfile: Iterable[str],
63
142
  dialect: _DialectLike = "excel",
@@ -70,7 +149,23 @@ def reader(
70
149
  lineterminator: str = "\r\n",
71
150
  quoting: _QuotingType = 0,
72
151
  strict: bool = False,
73
- ) -> _reader: ...
152
+ ) -> _reader:
153
+ """
154
+ csv_reader = reader(iterable [, dialect='excel']
155
+ [optional keyword args])
156
+ for row in csv_reader:
157
+ process(row)
158
+
159
+ The "iterable" argument can be any object that returns a line
160
+ of input for each iteration, such as a file object or a list. The
161
+ optional "dialect" parameter is discussed below. The function
162
+ also accepts optional keyword arguments which override settings
163
+ provided by the dialect.
164
+
165
+ The returned object is an iterator. Each iteration returns a row
166
+ of the CSV file (which can span multiple input lines).
167
+ """
168
+ ...
74
169
  def register_dialect(
75
170
  name: str,
76
171
  dialect: type[Dialect] = ...,
@@ -83,8 +178,36 @@ def register_dialect(
83
178
  lineterminator: str = "\r\n",
84
179
  quoting: _QuotingType = 0,
85
180
  strict: bool = False,
86
- ) -> None: ...
87
- def unregister_dialect(name: str) -> None: ...
88
- def get_dialect(name: str) -> Dialect: ...
89
- def list_dialects() -> list[str]: ...
90
- def field_size_limit(new_limit: int = ...) -> int: ...
181
+ ) -> None:
182
+ """
183
+ Create a mapping from a string name to a dialect class.
184
+ dialect = csv.register_dialect(name[, dialect[, **fmtparams]])
185
+ """
186
+ ...
187
+ def unregister_dialect(name: str) -> None:
188
+ """
189
+ Delete the name/dialect mapping associated with a string name.
190
+ csv.unregister_dialect(name)
191
+ """
192
+ ...
193
+ def get_dialect(name: str) -> Dialect:
194
+ """
195
+ Return the dialect instance associated with name.
196
+ dialect = csv.get_dialect(name)
197
+ """
198
+ ...
199
+ def list_dialects() -> list[str]:
200
+ """
201
+ Return a list of all know dialect names.
202
+ names = csv.list_dialects()
203
+ """
204
+ ...
205
+ def field_size_limit(new_limit: int = ...) -> int:
206
+ """
207
+ Sets an upper limit on parsed fields.
208
+ csv.field_size_limit([limit])
209
+
210
+ Returns old limit. If limit is not given, no new limit is set and
211
+ the old limit is returned
212
+ """
213
+ ...