#ifndef Py_BUILD_CORE_BUILTIN
#define Py_BUILD_CORE_MODULE …
#endif
#include "Python.h"
#include "pycore_pyatomic_ft_wrappers.h"
#include <stddef.h>
#include <stdbool.h>
#include "clinic/_csv.c.h"
#define NOT_SET …
#define EOL …
_csvstate;
static struct PyModuleDef _csvmodule;
static inline _csvstate*
get_csv_state(PyObject *module)
{ … }
static int
_csv_clear(PyObject *module)
{ … }
static int
_csv_traverse(PyObject *module, visitproc visit, void *arg)
{ … }
static void
_csv_free(void *module)
{ … }
ParserState;
QuoteStyle;
StyleDesc;
static const StyleDesc quote_styles[] = …;
DialectObj;
ReaderObj;
WriterObj;
static PyObject *
get_dialect_from_registry(PyObject *name_obj, _csvstate *module_state)
{ … }
static PyObject *
get_char_or_None(Py_UCS4 c)
{ … }
static PyObject *
Dialect_get_lineterminator(DialectObj *self, void *Py_UNUSED(ignored))
{ … }
static PyObject *
Dialect_get_delimiter(DialectObj *self, void *Py_UNUSED(ignored))
{ … }
static PyObject *
Dialect_get_escapechar(DialectObj *self, void *Py_UNUSED(ignored))
{ … }
static PyObject *
Dialect_get_quotechar(DialectObj *self, void *Py_UNUSED(ignored))
{ … }
static PyObject *
Dialect_get_quoting(DialectObj *self, void *Py_UNUSED(ignored))
{ … }
static int
_set_bool(const char *name, char *target, PyObject *src, bool dflt)
{ … }
static int
_set_int(const char *name, int *target, PyObject *src, int dflt)
{ … }
static int
_set_char_or_none(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
{ … }
static int
_set_char(const char *name, Py_UCS4 *target, PyObject *src, Py_UCS4 dflt)
{ … }
static int
_set_str(const char *name, PyObject **target, PyObject *src, const char *dflt)
{ … }
static int
dialect_check_quoting(int quoting)
{ … }
static int
dialect_check_char(const char *name, Py_UCS4 c, DialectObj *dialect, bool allowspace)
{ … }
static int
dialect_check_chars(const char *name1, const char *name2, Py_UCS4 c1, Py_UCS4 c2)
{ … }
#define D_OFF …
static struct PyMemberDef Dialect_memberlist[] = …;
#undef D_OFF
static PyGetSetDef Dialect_getsetlist[] = …;
static void
Dialect_dealloc(DialectObj *self)
{ … }
static char *dialect_kws[] = …;
static _csvstate *
_csv_state_from_type(PyTypeObject *type, const char *name)
{ … }
static PyObject *
dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{ … }
PyDoc_STRVAR(dialect_reduce_doc, "raises an exception to avoid pickling");
static PyObject *
Dialect_reduce(PyObject *self, PyObject *args) { … }
static struct PyMethodDef dialect_methods[] = …;
PyDoc_STRVAR(Dialect_Type_doc,
"CSV dialect\n"
"\n"
"The Dialect type records CSV parsing and generation options.\n");
static int
Dialect_clear(DialectObj *self)
{ … }
static int
Dialect_traverse(DialectObj *self, visitproc visit, void *arg)
{ … }
static PyType_Slot Dialect_Type_slots[] = …;
PyType_Spec Dialect_Type_spec = …;
static PyObject *
_call_dialect(_csvstate *module_state, PyObject *dialect_inst, PyObject *kwargs)
{ … }
static int
parse_save_field(ReaderObj *self)
{ … }
static int
parse_grow_buff(ReaderObj *self)
{ … }
static int
parse_add_char(ReaderObj *self, _csvstate *module_state, Py_UCS4 c)
{ … }
static int
parse_process_char(ReaderObj *self, _csvstate *module_state, Py_UCS4 c)
{ … }
static int
parse_reset(ReaderObj *self)
{ … }
static PyObject *
Reader_iternext(ReaderObj *self)
{ … }
static void
Reader_dealloc(ReaderObj *self)
{ … }
static int
Reader_traverse(ReaderObj *self, visitproc visit, void *arg)
{ … }
static int
Reader_clear(ReaderObj *self)
{ … }
PyDoc_STRVAR(Reader_Type_doc,
"CSV reader\n"
"\n"
"Reader objects are responsible for reading and parsing tabular data\n"
"in CSV format.\n"
);
static struct PyMethodDef Reader_methods[] = …;
#define R_OFF …
static struct PyMemberDef Reader_memberlist[] = …;
#undef R_OFF
static PyType_Slot Reader_Type_slots[] = …;
PyType_Spec Reader_Type_spec = …;
static PyObject *
csv_reader(PyObject *module, PyObject *args, PyObject *keyword_args)
{ … }
static void
join_reset(WriterObj *self)
{ … }
#define MEM_INCR …
static Py_ssize_t
join_append_data(WriterObj *self, int field_kind, const void *field_data,
Py_ssize_t field_len, int *quoted,
int copy_phase)
{ … }
static int
join_check_rec_size(WriterObj *self, Py_ssize_t rec_len)
{ … }
static int
join_append(WriterObj *self, PyObject *field, int quoted)
{ … }
static int
join_append_lineterminator(WriterObj *self)
{ … }
PyDoc_STRVAR(csv_writerow_doc,
"writerow(iterable)\n"
"\n"
"Construct and write a CSV record from an iterable of fields. Non-string\n"
"elements will be converted to string.");
static PyObject *
csv_writerow(WriterObj *self, PyObject *seq)
{ … }
PyDoc_STRVAR(csv_writerows_doc,
"writerows(iterable of iterables)\n"
"\n"
"Construct and write a series of iterables to a csv file. Non-string\n"
"elements will be converted to string.");
static PyObject *
csv_writerows(WriterObj *self, PyObject *seqseq)
{ … }
static struct PyMethodDef Writer_methods[] = …;
#define W_OFF …
static struct PyMemberDef Writer_memberlist[] = …;
#undef W_OFF
static int
Writer_traverse(WriterObj *self, visitproc visit, void *arg)
{ … }
static int
Writer_clear(WriterObj *self)
{ … }
static void
Writer_dealloc(WriterObj *self)
{ … }
PyDoc_STRVAR(Writer_Type_doc,
"CSV writer\n"
"\n"
"Writer objects are responsible for generating tabular data\n"
"in CSV format from sequence input.\n"
);
static PyType_Slot Writer_Type_slots[] = …;
PyType_Spec Writer_Type_spec = …;
static PyObject *
csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
{ … }
static PyObject *
_csv_list_dialects_impl(PyObject *module)
{ … }
static PyObject *
csv_register_dialect(PyObject *module, PyObject *args, PyObject *kwargs)
{ … }
static PyObject *
_csv_unregister_dialect_impl(PyObject *module, PyObject *name)
{ … }
static PyObject *
_csv_get_dialect_impl(PyObject *module, PyObject *name)
{ … }
static PyObject *
_csv_field_size_limit_impl(PyObject *module, PyObject *new_limit)
{ … }
static PyType_Slot error_slots[] = …;
PyType_Spec error_spec = …;
PyDoc_STRVAR(csv_module_doc, "CSV parsing and writing.\n");
PyDoc_STRVAR(csv_reader_doc,
" csv_reader = reader(iterable [, dialect='excel']\n"
" [optional keyword args])\n"
" for row in csv_reader:\n"
" process(row)\n"
"\n"
"The \"iterable\" argument can be any object that returns a line\n"
"of input for each iteration, such as a file object or a list. The\n"
"optional \"dialect\" parameter is discussed below. The function\n"
"also accepts optional keyword arguments which override settings\n"
"provided by the dialect.\n"
"\n"
"The returned object is an iterator. Each iteration returns a row\n"
"of the CSV file (which can span multiple input lines).\n");
PyDoc_STRVAR(csv_writer_doc,
" csv_writer = csv.writer(fileobj [, dialect='excel']\n"
" [optional keyword args])\n"
" for row in sequence:\n"
" csv_writer.writerow(row)\n"
"\n"
" [or]\n"
"\n"
" csv_writer = csv.writer(fileobj [, dialect='excel']\n"
" [optional keyword args])\n"
" csv_writer.writerows(rows)\n"
"\n"
"The \"fileobj\" argument can be any object that supports the file API.\n");
PyDoc_STRVAR(csv_register_dialect_doc,
"Create a mapping from a string name to a dialect class.\n"
" dialect = csv.register_dialect(name[, dialect[, **fmtparams]])");
static struct PyMethodDef csv_methods[] = …;
static int
csv_exec(PyObject *module) { … }
static PyModuleDef_Slot csv_slots[] = …;
static struct PyModuleDef _csvmodule = …;
PyMODINIT_FUNC
PyInit__csv(void)
{ … }