Debian Codegraph @

Modules/clinic/_csv.c.h

raw
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6 # include "pycore_gc.h" // PyGC_Head
7 # include "pycore_runtime.h" // _Py_ID()
8 #endif
9 #include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
10
11 PyDoc_STRVAR(_csv_list_dialects__doc__,
12 "list_dialects($module, /)\n"
13 "--\n"
14 "\n"
15 "Return a list of all known dialect names.");
16
17 #define _CSV_LIST_DIALECTS_METHODDEF \
18 {"list_dialects", (PyCFunction)_csv_list_dialects, METH_NOARGS, _csv_list_dialects__doc__},
19
20 static PyObject *
21 _csv_list_dialects_impl(PyObject *module);
22
23 static PyObject *
24 _csv_list_dialects(PyObject *module, PyObject *Py_UNUSED(ignored))
25 {
26 return _csv_list_dialects_impl(module);
27 }
28
29 PyDoc_STRVAR(_csv_unregister_dialect__doc__,
30 "unregister_dialect($module, /, name)\n"
31 "--\n"
32 "\n"
33 "Delete the name/dialect mapping associated with a string name.");
34
35 #define _CSV_UNREGISTER_DIALECT_METHODDEF \
36 {"unregister_dialect", _PyCFunction_CAST(_csv_unregister_dialect), METH_FASTCALL|METH_KEYWORDS, _csv_unregister_dialect__doc__},
37
38 static PyObject *
39 _csv_unregister_dialect_impl(PyObject *module, PyObject *name);
40
41 static PyObject *
42 _csv_unregister_dialect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
43 {
44 PyObject *return_value = NULL;
45 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
46
47 #define NUM_KEYWORDS 1
48 static struct {
49 PyGC_Head _this_is_not_used;
50 PyObject_VAR_HEAD
51 PyObject *ob_item[NUM_KEYWORDS];
52 } _kwtuple = {
53 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
54 .ob_item = { &_Py_ID(name), },
55 };
56 #undef NUM_KEYWORDS
57 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
58
59 #else // !Py_BUILD_CORE
60 # define KWTUPLE NULL
61 #endif // !Py_BUILD_CORE
62
63 static const char * const _keywords[] = {"name", NULL};
64 static _PyArg_Parser _parser = {
65 .keywords = _keywords,
66 .fname = "unregister_dialect",
67 .kwtuple = KWTUPLE,
68 };
69 #undef KWTUPLE
70 PyObject *argsbuf[1];
71 PyObject *name;
72
73 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
74 if (!args) {
75 goto exit;
76 }
77 name = args[0];
78 return_value = _csv_unregister_dialect_impl(module, name);
79
80 exit:
81 return return_value;
82 }
83
84 PyDoc_STRVAR(_csv_get_dialect__doc__,
85 "get_dialect($module, /, name)\n"
86 "--\n"
87 "\n"
88 "Return the dialect instance associated with name.");
89
90 #define _CSV_GET_DIALECT_METHODDEF \
91 {"get_dialect", _PyCFunction_CAST(_csv_get_dialect), METH_FASTCALL|METH_KEYWORDS, _csv_get_dialect__doc__},
92
93 static PyObject *
94 _csv_get_dialect_impl(PyObject *module, PyObject *name);
95
96 static PyObject *
97 _csv_get_dialect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
98 {
99 PyObject *return_value = NULL;
100 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
101
102 #define NUM_KEYWORDS 1
103 static struct {
104 PyGC_Head _this_is_not_used;
105 PyObject_VAR_HEAD
106 PyObject *ob_item[NUM_KEYWORDS];
107 } _kwtuple = {
108 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
109 .ob_item = { &_Py_ID(name), },
110 };
111 #undef NUM_KEYWORDS
112 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
113
114 #else // !Py_BUILD_CORE
115 # define KWTUPLE NULL
116 #endif // !Py_BUILD_CORE
117
118 static const char * const _keywords[] = {"name", NULL};
119 static _PyArg_Parser _parser = {
120 .keywords = _keywords,
121 .fname = "get_dialect",
122 .kwtuple = KWTUPLE,
123 };
124 #undef KWTUPLE
125 PyObject *argsbuf[1];
126 PyObject *name;
127
128 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
129 if (!args) {
130 goto exit;
131 }
132 name = args[0];
133 return_value = _csv_get_dialect_impl(module, name);
134
135 exit:
136 return return_value;
137 }
138
139 PyDoc_STRVAR(_csv_field_size_limit__doc__,
140 "field_size_limit($module, /, new_limit=<unrepresentable>)\n"
141 "--\n"
142 "\n"
143 "Sets an upper limit on parsed fields.\n"
144 "\n"
145 "Returns old limit. If limit is not given, no new limit is set and\n"
146 "the old limit is returned");
147
148 #define _CSV_FIELD_SIZE_LIMIT_METHODDEF \
149 {"field_size_limit", _PyCFunction_CAST(_csv_field_size_limit), METH_FASTCALL|METH_KEYWORDS, _csv_field_size_limit__doc__},
150
151 static PyObject *
152 _csv_field_size_limit_impl(PyObject *module, PyObject *new_limit);
153
154 static PyObject *
155 _csv_field_size_limit(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
156 {
157 PyObject *return_value = NULL;
158 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
159
160 #define NUM_KEYWORDS 1
161 static struct {
162 PyGC_Head _this_is_not_used;
163 PyObject_VAR_HEAD
164 PyObject *ob_item[NUM_KEYWORDS];
165 } _kwtuple = {
166 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
167 .ob_item = { &_Py_ID(new_limit), },
168 };
169 #undef NUM_KEYWORDS
170 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
171
172 #else // !Py_BUILD_CORE
173 # define KWTUPLE NULL
174 #endif // !Py_BUILD_CORE
175
176 static const char * const _keywords[] = {"new_limit", NULL};
177 static _PyArg_Parser _parser = {
178 .keywords = _keywords,
179 .fname = "field_size_limit",
180 .kwtuple = KWTUPLE,
181 };
182 #undef KWTUPLE
183 PyObject *argsbuf[1];
184 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
185 PyObject *new_limit = NULL;
186
187 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
188 if (!args) {
189 goto exit;
190 }
191 if (!noptargs) {
192 goto skip_optional_pos;
193 }
194 new_limit = args[0];
195 skip_optional_pos:
196 return_value = _csv_field_size_limit_impl(module, new_limit);
197
198 exit:
199 return return_value;
200 }
201 /*[clinic end generated code: output=e6c0cd889fbf6e9f input=a9049054013a1b77]*/