summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorTal Einat <taleinat+github@gmail.com>2018-09-10 18:33:08 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2018-09-10 18:33:08 (GMT)
commit3286ce4adee85c5ce8ab3ee3089f3cd44a017fd7 (patch)
tree991e08da85fe97ff456c90d9a984fa8cda11d869 /Modules/clinic
parent9430652535f88125d8003f342a8884d34885d876 (diff)
downloadcpython-3286ce4adee85c5ce8ab3ee3089f3cd44a017fd7.zip
cpython-3286ce4adee85c5ce8ab3ee3089f3cd44a017fd7.tar.gz
cpython-3286ce4adee85c5ce8ab3ee3089f3cd44a017fd7.tar.bz2
bpo-20180: itertools.groupby Argument Clinic conversion (GH-4170)
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/itertoolsmodule.c.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h
new file mode 100644
index 0000000..68e6749
--- /dev/null
+++ b/Modules/clinic/itertoolsmodule.c.h
@@ -0,0 +1,64 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(itertools_groupby__doc__,
+"groupby(iterable, key=None)\n"
+"--\n"
+"\n"
+"make an iterator that returns consecutive keys and groups from the iterable\n"
+"\n"
+" iterable\n"
+" Elements to divide into groups according to the key function.\n"
+" key\n"
+" A function for computing the group category for each element.\n"
+" If the key function is not specified or is None, the element itself\n"
+" is used for grouping.");
+
+static PyObject *
+itertools_groupby_impl(PyTypeObject *type, PyObject *it, PyObject *keyfunc);
+
+static PyObject *
+itertools_groupby(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"iterable", "key", NULL};
+ static _PyArg_Parser _parser = {"O|O:groupby", _keywords, 0};
+ PyObject *it;
+ PyObject *keyfunc = Py_None;
+
+ if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
+ &it, &keyfunc)) {
+ goto exit;
+ }
+ return_value = itertools_groupby_impl(type, it, keyfunc);
+
+exit:
+ return return_value;
+}
+
+static PyObject *
+itertools__grouper_impl(PyTypeObject *type, PyObject *parent,
+ PyObject *tgtkey);
+
+static PyObject *
+itertools__grouper(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *parent;
+ PyObject *tgtkey;
+
+ if ((type == &_grouper_type) &&
+ !_PyArg_NoKeywords("_grouper", kwargs)) {
+ goto exit;
+ }
+ if (!PyArg_ParseTuple(args, "O!O:_grouper",
+ &groupby_type, &parent, &tgtkey)) {
+ goto exit;
+ }
+ return_value = itertools__grouper_impl(type, parent, tgtkey);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=82e10c91569d2b95 input=a9049054013a1b77]*/