Jaromir Latal
daa738f70e
stdlib: csv.DictReader.fieldnames should be Optional[Sequence[str]] ( #3752 )
2020-02-21 20:50:02 -08:00
Shantanu
b4da2b694b
csv: re-export Dialect from _csv ( #3613 )
...
Resolves #3611
Tested with mypy on:
```
f = open("asdf.csv", "w")
csv.writer(f)
csv.writer(f, dialect=csv.excel)
csv.writer(f, dialect=csv.excel())
csv.DictReader(f)
csv.DictReader(f, dialect=csv.excel)
csv.DictReader(f, dialect=csv.excel())
class CustomDialect(csv.Dialect):
delimiter = "%"
csv.writer(f, dialect=CustomDialect)
csv.writer(f, dialect=CustomDialect())
```
2020-01-22 17:11:52 -08:00
Shantanu
055a907e75
csv: add a return type for things that return ( #3604 )
...
Technically, these return whatever the write object of the underlying
file object return. I'm not sure it's worth making everything generic
over this probably rarely used return type, but happy to do it (or drop
this change) if that seems better.
2020-01-10 14:14:44 -08:00
hauntsaninja
485b85e6b8
csv: update DictReader for py38 ( #3586 )
2020-01-07 21:40:19 -08:00
Alois Klink
a06abc5dff
Make fieldnames of csv.DictReader Optional ( #3534 )
...
Also run stdlib/2and3/csv.pyi through black and isort
2019-12-09 20:22:42 +01:00
Martin DeMello
d0beab9b8e
Fix an argument to csv.DictReader() ( #3339 )
...
From the Lib/csv.py source, 'f' is passed directly to _csv.reader, which
expects Iterable[Text]
2019-10-10 20:13:20 -07:00
Eric Traut
c879ff05aa
Changed type of fieldname parameter in DictWriter __init__ method from Sequence[str] to Iterable[str]. This allows it to work with the following code: ( #3253 )
2019-09-23 18:24:45 +02:00
秋葉
dd244d1200
fix Sniffer.sniff return type ( #3023 )
2019-05-31 07:22:36 -07:00
Michael Lee
efb67946f8
Use variable annotations everywhere ( #2909 )
2019-04-13 10:40:52 +02:00
Pascal Corpet
979534c764
Prefer Mapping to Dict for input of csv DictWriter methods. ( #2829 )
2019-03-07 15:04:56 +01:00
Ivan Levkivskyi
126b3e17fd
Revert #2347 ( #2377 )
2018-08-09 13:22:12 -07:00
Chelsea Voss
f6e2fb4401
Allow DictReader values to be None ( #2346 ) ( #2347 )
2018-08-09 08:04:44 -07:00
Yusuke Miyazaki
6192cce9d9
Avoid using string literals in type annotations ( #2294 )
2018-07-02 20:23:29 -07:00
Thomas Grainger
2bb7ea9595
csv DictReader should only yield OrderedDicts in Py3.6 ( #1478 )
2017-07-14 21:58:52 -07:00
Thomas Grainger
7637549ced
fix DictReader definition ( #1475 )
...
* constructable with Iterable
* __iter__ returns another DictReader
* supports `__next__` on python 3
* supports `next` on python 2
2017-07-10 21:02:59 -07:00
Roy Williams
5a95e19322
Allow csv module to support both str and unicode types in Python 2 ( #1437 )
...
* Replace keys in DictReader with Any
2017-06-27 14:24:22 -07:00
Guido van Rossum
86070643ac
Improve csv module and float() signature ( #1418 )
...
* DictReader should not be abstract. Reformat long lines.
* Make restval optional for DictWriter.__init__.
* The arg to reader() is *Iterable*, not *Iterator*.
* Improve signature of float() (use Union instead of overload).
2017-06-20 13:04:10 -07:00
Yusuke Miyazaki
1c8498228d
Update stub for csv ( #1398 )
2017-06-15 16:35:17 -07:00