Commit a9dc8ba
authored
Broaden read csv param types (#630)
* gh-623: broaden 'names' param of read_csv
Broaden the type hint for the 'names' param of read_csv (and read_table,
which behaves similarly) from previous list[str], so that other valid
types are accepted by mypy.
* allow None as names param of read_clipboard
Noticed as I found clipboard after the changes to read_csv and
read_table, and it calls it, so should match - but it was missing None
as an option.
* broaden 'names' param of read_clipboard
Match prior change to read_csv, since read_clipboard calls read_csv.
* broaden 'names' param of read_excel
Match prior change to read_csv, read_table, read_clipboard.
* gh-605: broader usecols param type hint
This fixes the pycharm tooltip problem in gh-605, as well as allowing
more list-like types of strings (tuples of strings, as well as mutable
sequences of strings other than list), and callables that accept
hashables, not just strings.
* test that read_excel accepts string for usecols
* test names and usecols correctly exclude strings
Strings aren't valid arguments here (except for read_excel, where we
have a test now to check that this is accepted). Adding tests to make
sure the type hints aren't overly wide and accept string arguments by
mistake.1 parent 5945ada commit a9dc8ba
File tree
5 files changed
+325
-100
lines changed- pandas-stubs
- io
- excel
- parsers
- tests
5 files changed
+325
-100
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
| |||
295 | 298 | | |
296 | 299 | | |
297 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
298 | 311 | | |
299 | 312 | | |
300 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
| 20 | + | |
22 | 21 | | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 35 | + | |
43 | 36 | | |
44 | 37 | | |
45 | 38 | | |
| |||
94 | 87 | | |
95 | 88 | | |
96 | 89 | | |
97 | | - | |
| 90 | + | |
98 | 91 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 92 | + | |
106 | 93 | | |
107 | 94 | | |
108 | 95 | | |
| |||
157 | 144 | | |
158 | 145 | | |
159 | 146 | | |
160 | | - | |
| 147 | + | |
161 | 148 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 149 | + | |
169 | 150 | | |
170 | 151 | | |
171 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
44 | 46 | | |
45 | | - | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | | - | |
| 83 | + | |
82 | 84 | | |
83 | | - | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
158 | | - | |
| 160 | + | |
159 | 161 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 162 | + | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
| |||
185 | 183 | | |
186 | 184 | | |
187 | 185 | | |
188 | | - | |
| 186 | + | |
189 | 187 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 188 | + | |
195 | 189 | | |
196 | 190 | | |
197 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| 27 | + | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 44 | + | |
53 | 45 | | |
54 | 46 | | |
55 | 47 | | |
| |||
106 | 98 | | |
107 | 99 | | |
108 | 100 | | |
109 | | - | |
| 101 | + | |
110 | 102 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 103 | + | |
119 | 104 | | |
120 | 105 | | |
121 | 106 | | |
| |||
172 | 157 | | |
173 | 158 | | |
174 | 159 | | |
175 | | - | |
| 160 | + | |
176 | 161 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 162 | + | |
185 | 163 | | |
186 | 164 | | |
187 | 165 | | |
| |||
238 | 216 | | |
239 | 217 | | |
240 | 218 | | |
241 | | - | |
| 219 | + | |
242 | 220 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 221 | + | |
251 | 222 | | |
252 | 223 | | |
253 | 224 | | |
| |||
304 | 275 | | |
305 | 276 | | |
306 | 277 | | |
307 | | - | |
| 278 | + | |
308 | 279 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 280 | + | |
317 | 281 | | |
318 | 282 | | |
319 | 283 | | |
| |||
370 | 334 | | |
371 | 335 | | |
372 | 336 | | |
373 | | - | |
| 337 | + | |
374 | 338 | | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
| 339 | + | |
383 | 340 | | |
384 | 341 | | |
385 | 342 | | |
| |||
0 commit comments