@@ -1291,10 +1291,11 @@ join_append_lineterminator(WriterObj *self)
1291
1291
}
1292
1292
1293
1293
PyDoc_STRVAR (csv_writerow_doc ,
1294
- "writerow(iterable)\n"
1294
+ "writerow($self, row, /)\n"
1295
+ "--\n\n"
1296
+ "Construct and write a CSV record from an iterable of fields.\n"
1295
1297
"\n"
1296
- "Construct and write a CSV record from an iterable of fields. Non-string\n"
1297
- "elements will be converted to string." );
1298
+ "Non-string elements will be converted to string." );
1298
1299
1299
1300
static PyObject *
1300
1301
csv_writerow (WriterObj * self , PyObject * seq )
@@ -1400,10 +1401,11 @@ csv_writerow(WriterObj *self, PyObject *seq)
1400
1401
}
1401
1402
1402
1403
PyDoc_STRVAR (csv_writerows_doc ,
1403
- "writerows(iterable of iterables)\n"
1404
+ "writerows($self, rows, /)\n"
1405
+ "--\n\n"
1406
+ "Construct and write a series of iterables to a csv file.\n"
1404
1407
"\n"
1405
- "Construct and write a series of iterables to a csv file. Non-string\n"
1406
- "elements will be converted to string." );
1408
+ "Non-string elements will be converted to string." );
1407
1409
1408
1410
static PyObject *
1409
1411
csv_writerows (WriterObj * self , PyObject * seqseq )
@@ -1555,13 +1557,11 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
1555
1557
_csv.list_dialects
1556
1558
1557
1559
Return a list of all known dialect names.
1558
-
1559
- names = csv.list_dialects()
1560
1560
[clinic start generated code]*/
1561
1561
1562
1562
static PyObject *
1563
1563
_csv_list_dialects_impl (PyObject * module )
1564
- /*[clinic end generated code: output=a5b92b215b006a6d input=8953943eb17d98ab ]*/
1564
+ /*[clinic end generated code: output=a5b92b215b006a6d input=ec58040aafd6a20a ]*/
1565
1565
{
1566
1566
return PyDict_Keys (get_csv_state (module )-> dialects );
1567
1567
}
@@ -1598,13 +1598,11 @@ _csv.unregister_dialect
1598
1598
name: object
1599
1599
1600
1600
Delete the name/dialect mapping associated with a string name.
1601
-
1602
- csv.unregister_dialect(name)
1603
1601
[clinic start generated code]*/
1604
1602
1605
1603
static PyObject *
1606
1604
_csv_unregister_dialect_impl (PyObject * module , PyObject * name )
1607
- /*[clinic end generated code: output=0813ebca6c058df4 input=6b5c1557bf60c7e7 ]*/
1605
+ /*[clinic end generated code: output=0813ebca6c058df4 input=e1cf81bfe3ba0f62 ]*/
1608
1606
{
1609
1607
_csvstate * module_state = get_csv_state (module );
1610
1608
int rc = PyDict_Pop (module_state -> dialects , name , NULL );
@@ -1624,13 +1622,11 @@ _csv.get_dialect
1624
1622
name: object
1625
1623
1626
1624
Return the dialect instance associated with name.
1627
-
1628
- dialect = csv.get_dialect(name)
1629
1625
[clinic start generated code]*/
1630
1626
1631
1627
static PyObject *
1632
1628
_csv_get_dialect_impl (PyObject * module , PyObject * name )
1633
- /*[clinic end generated code: output=aa988cd573bebebb input=edf9ddab32e448fb ]*/
1629
+ /*[clinic end generated code: output=aa988cd573bebebb input=74865c659dcb441f ]*/
1634
1630
{
1635
1631
return get_dialect_from_registry (name , get_csv_state (module ));
1636
1632
}
@@ -1642,15 +1638,13 @@ _csv.field_size_limit
1642
1638
1643
1639
Sets an upper limit on parsed fields.
1644
1640
1645
- csv.field_size_limit([limit])
1646
-
1647
1641
Returns old limit. If limit is not given, no new limit is set and
1648
1642
the old limit is returned
1649
1643
[clinic start generated code]*/
1650
1644
1651
1645
static PyObject *
1652
1646
_csv_field_size_limit_impl (PyObject * module , PyObject * new_limit )
1653
- /*[clinic end generated code: output=f2799ecd908e250b input=cec70e9226406435 ]*/
1647
+ /*[clinic end generated code: output=f2799ecd908e250b input=77db7485ee3ae90a ]*/
1654
1648
{
1655
1649
_csvstate * module_state = get_csv_state (module );
1656
1650
Py_ssize_t old_limit = FT_ATOMIC_LOAD_SSIZE_RELAXED (module_state -> field_limit );
@@ -1686,37 +1680,38 @@ PyType_Spec error_spec = {
1686
1680
PyDoc_STRVAR (csv_module_doc , "CSV parsing and writing.\n" );
1687
1681
1688
1682
PyDoc_STRVAR (csv_reader_doc ,
1689
- " csv_reader = reader(iterable [, dialect='excel']\n"
1690
- " [optional keyword args])\n"
1691
- " for row in csv_reader:\n"
1692
- " process(row)\n"
1683
+ "reader($module, iterable, /, dialect='excel', **fmtparams)\n"
1684
+ "--\n\n"
1685
+ "Return a reader object that will process lines from the given iterable.\n"
1693
1686
"\n"
1694
1687
"The \"iterable\" argument can be any object that returns a line\n"
1695
1688
"of input for each iteration, such as a file object or a list. The\n"
1696
- "optional \"dialect\" parameter is discussed below . The function\n"
1689
+ "optional \"dialect\" argument defines a CSV dialect . The function\n"
1697
1690
"also accepts optional keyword arguments which override settings\n"
1698
1691
"provided by the dialect.\n"
1699
1692
"\n"
1700
1693
"The returned object is an iterator. Each iteration returns a row\n"
1701
1694
"of the CSV file (which can span multiple input lines).\n" );
1702
1695
1703
1696
PyDoc_STRVAR (csv_writer_doc ,
1704
- " csv_writer = csv.writer(fileobj [, dialect='excel']\n"
1705
- " [optional keyword args])\n"
1706
- " for row in sequence:\n"
1707
- " csv_writer.writerow(row)\n"
1697
+ "writer($module, fileobj, /, dialect='excel', **fmtparams)\n"
1698
+ "--\n\n"
1699
+ "Return a writer object that will write user data on the given file object.\n"
1708
1700
"\n"
1709
- " [or]\n"
1710
- "\n"
1711
- " csv_writer = csv.writer(fileobj [, dialect='excel']\n"
1712
- " [optional keyword args])\n"
1713
- " csv_writer.writerows(rows)\n"
1714
- "\n"
1715
- "The \"fileobj\" argument can be any object that supports the file API.\n" );
1701
+ "The \"fileobj\" argument can be any object that supports the file API.\n"
1702
+ "The optional \"dialect\" argument defines a CSV dialect. The function\n"
1703
+ "also accepts optional keyword arguments which override settings\n"
1704
+ "provided by the dialect.\n" );
1716
1705
1717
1706
PyDoc_STRVAR (csv_register_dialect_doc ,
1718
- "Create a mapping from a string name to a dialect class.\n"
1719
- " dialect = csv.register_dialect(name[, dialect[, **fmtparams]])" );
1707
+ "register_dialect($module, name, /, dialect='excel', **fmtparams)\n"
1708
+ "--\n\n"
1709
+ "Create a mapping from a string name to a CVS dialect.\n"
1710
+ "\n"
1711
+ "The optional \"dialect\" argument specifies the base dialect instance\n"
1712
+ "or the name of the registered dialect. The function also accepts\n"
1713
+ "optional keyword arguments which override settings provided by the\n"
1714
+ "dialect.\n" );
1720
1715
1721
1716
static struct PyMethodDef csv_methods [] = {
1722
1717
{ "reader" , _PyCFunction_CAST (csv_reader ),
0 commit comments