@@ -1304,10 +1304,11 @@ join_append_lineterminator(WriterObj *self)
1304
1304
}
1305
1305
1306
1306
PyDoc_STRVAR (csv_writerow_doc ,
1307
- "writerow(iterable)\n"
1307
+ "writerow($self, row, /)\n"
1308
+ "--\n\n"
1309
+ "Construct and write a CSV record from an iterable of fields.\n"
1308
1310
"\n"
1309
- "Construct and write a CSV record from an iterable of fields. Non-string\n"
1310
- "elements will be converted to string." );
1311
+ "Non-string elements will be converted to string." );
1311
1312
1312
1313
static PyObject *
1313
1314
csv_writerow (PyObject * op , PyObject * seq )
@@ -1414,10 +1415,11 @@ csv_writerow(PyObject *op, PyObject *seq)
1414
1415
}
1415
1416
1416
1417
PyDoc_STRVAR (csv_writerows_doc ,
1417
- "writerows(iterable of iterables)\n"
1418
+ "writerows($self, rows, /)\n"
1419
+ "--\n\n"
1420
+ "Construct and write a series of iterables to a csv file.\n"
1418
1421
"\n"
1419
- "Construct and write a series of iterables to a csv file. Non-string\n"
1420
- "elements will be converted to string." );
1422
+ "Non-string elements will be converted to string." );
1421
1423
1422
1424
static PyObject *
1423
1425
csv_writerows (PyObject * self , PyObject * seqseq )
@@ -1574,13 +1576,11 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
1574
1576
_csv.list_dialects
1575
1577
1576
1578
Return a list of all known dialect names.
1577
-
1578
- names = csv.list_dialects()
1579
1579
[clinic start generated code]*/
1580
1580
1581
1581
static PyObject *
1582
1582
_csv_list_dialects_impl (PyObject * module )
1583
- /*[clinic end generated code: output=a5b92b215b006a6d input=8953943eb17d98ab ]*/
1583
+ /*[clinic end generated code: output=a5b92b215b006a6d input=ec58040aafd6a20a ]*/
1584
1584
{
1585
1585
return PyDict_Keys (get_csv_state (module )-> dialects );
1586
1586
}
@@ -1617,13 +1617,11 @@ _csv.unregister_dialect
1617
1617
name: object
1618
1618
1619
1619
Delete the name/dialect mapping associated with a string name.
1620
-
1621
- csv.unregister_dialect(name)
1622
1620
[clinic start generated code]*/
1623
1621
1624
1622
static PyObject *
1625
1623
_csv_unregister_dialect_impl (PyObject * module , PyObject * name )
1626
- /*[clinic end generated code: output=0813ebca6c058df4 input=6b5c1557bf60c7e7 ]*/
1624
+ /*[clinic end generated code: output=0813ebca6c058df4 input=e1cf81bfe3ba0f62 ]*/
1627
1625
{
1628
1626
_csvstate * module_state = get_csv_state (module );
1629
1627
int rc = PyDict_Pop (module_state -> dialects , name , NULL );
@@ -1643,13 +1641,11 @@ _csv.get_dialect
1643
1641
name: object
1644
1642
1645
1643
Return the dialect instance associated with name.
1646
-
1647
- dialect = csv.get_dialect(name)
1648
1644
[clinic start generated code]*/
1649
1645
1650
1646
static PyObject *
1651
1647
_csv_get_dialect_impl (PyObject * module , PyObject * name )
1652
- /*[clinic end generated code: output=aa988cd573bebebb input=edf9ddab32e448fb ]*/
1648
+ /*[clinic end generated code: output=aa988cd573bebebb input=74865c659dcb441f ]*/
1653
1649
{
1654
1650
return get_dialect_from_registry (name , get_csv_state (module ));
1655
1651
}
@@ -1661,15 +1657,13 @@ _csv.field_size_limit
1661
1657
1662
1658
Sets an upper limit on parsed fields.
1663
1659
1664
- csv.field_size_limit([limit])
1665
-
1666
1660
Returns old limit. If limit is not given, no new limit is set and
1667
1661
the old limit is returned
1668
1662
[clinic start generated code]*/
1669
1663
1670
1664
static PyObject *
1671
1665
_csv_field_size_limit_impl (PyObject * module , PyObject * new_limit )
1672
- /*[clinic end generated code: output=f2799ecd908e250b input=cec70e9226406435 ]*/
1666
+ /*[clinic end generated code: output=f2799ecd908e250b input=77db7485ee3ae90a ]*/
1673
1667
{
1674
1668
_csvstate * module_state = get_csv_state (module );
1675
1669
Py_ssize_t old_limit = FT_ATOMIC_LOAD_SSIZE_RELAXED (module_state -> field_limit );
@@ -1705,37 +1699,38 @@ PyType_Spec error_spec = {
1705
1699
PyDoc_STRVAR (csv_module_doc , "CSV parsing and writing.\n" );
1706
1700
1707
1701
PyDoc_STRVAR (csv_reader_doc ,
1708
- " csv_reader = reader(iterable [, dialect='excel']\n"
1709
- " [optional keyword args])\n"
1710
- " for row in csv_reader:\n"
1711
- " process(row)\n"
1702
+ "reader($module, iterable, /, dialect='excel', **fmtparams)\n"
1703
+ "--\n\n"
1704
+ "Return a reader object that will process lines from the given iterable.\n"
1712
1705
"\n"
1713
1706
"The \"iterable\" argument can be any object that returns a line\n"
1714
1707
"of input for each iteration, such as a file object or a list. The\n"
1715
- "optional \"dialect\" parameter is discussed below . The function\n"
1708
+ "optional \"dialect\" argument defines a CSV dialect . The function\n"
1716
1709
"also accepts optional keyword arguments which override settings\n"
1717
1710
"provided by the dialect.\n"
1718
1711
"\n"
1719
1712
"The returned object is an iterator. Each iteration returns a row\n"
1720
1713
"of the CSV file (which can span multiple input lines).\n" );
1721
1714
1722
1715
PyDoc_STRVAR (csv_writer_doc ,
1723
- " csv_writer = csv.writer(fileobj [, dialect='excel']\n"
1724
- " [optional keyword args])\n"
1725
- " for row in sequence:\n"
1726
- " csv_writer.writerow(row)\n"
1716
+ "writer($module, fileobj, /, dialect='excel', **fmtparams)\n"
1717
+ "--\n\n"
1718
+ "Return a writer object that will write user data on the given file object.\n"
1727
1719
"\n"
1728
- " [or]\n"
1729
- "\n"
1730
- " csv_writer = csv.writer(fileobj [, dialect='excel']\n"
1731
- " [optional keyword args])\n"
1732
- " csv_writer.writerows(rows)\n"
1733
- "\n"
1734
- "The \"fileobj\" argument can be any object that supports the file API.\n" );
1720
+ "The \"fileobj\" argument can be any object that supports the file API.\n"
1721
+ "The optional \"dialect\" argument defines a CSV dialect. The function\n"
1722
+ "also accepts optional keyword arguments which override settings\n"
1723
+ "provided by the dialect.\n" );
1735
1724
1736
1725
PyDoc_STRVAR (csv_register_dialect_doc ,
1737
- "Create a mapping from a string name to a dialect class.\n"
1738
- " dialect = csv.register_dialect(name[, dialect[, **fmtparams]])" );
1726
+ "register_dialect($module, name, /, dialect='excel', **fmtparams)\n"
1727
+ "--\n\n"
1728
+ "Create a mapping from a string name to a CVS dialect.\n"
1729
+ "\n"
1730
+ "The optional \"dialect\" argument specifies the base dialect instance\n"
1731
+ "or the name of the registered dialect. The function also accepts\n"
1732
+ "optional keyword arguments which override settings provided by the\n"
1733
+ "dialect.\n" );
1739
1734
1740
1735
static struct PyMethodDef csv_methods [] = {
1741
1736
{ "reader" , _PyCFunction_CAST (csv_reader ),
0 commit comments