Home
last modified time | relevance | path

Searched refs:keyfunc (Results 1 – 14 of 14) sorted by relevance

/external/python/cpython3/Objects/clinic/
Dlistobject.c.h173 list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse);
183 PyObject *keyfunc = Py_None; in list_sort() local
194 keyfunc = args[0]; in list_sort()
209 return_value = list_sort_impl(self, keyfunc, reverse); in list_sort()
/external/python/cpython3/Modules/clinic/
Ditertoolsmodule.c.h19 itertools_groupby_impl(PyTypeObject *type, PyObject *it, PyObject *keyfunc);
32 PyObject *keyfunc = Py_None; in itertools_groupby() local
42 keyfunc = fastargs[1]; in itertools_groupby()
44 return_value = itertools_groupby_impl(type, it, keyfunc); in itertools_groupby()
/external/python/cpython2/Python/
Dbltinmodule.c1360 PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; in min_max() local
1369 keyfunc = PyDict_GetItemString(kwds, "key"); in min_max()
1370 if (PyDict_Size(kwds)!=1 || keyfunc == NULL) { in min_max()
1375 Py_INCREF(keyfunc); in min_max()
1380 Py_XDECREF(keyfunc); in min_max()
1388 if (keyfunc != NULL) { in min_max()
1389 val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); in min_max()
1431 Py_XDECREF(keyfunc); in min_max()
1442 Py_XDECREF(keyfunc); in min_max()
2230 PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs; in builtin_sorted() local
[all …]
/external/python/cpython2/Lib/test/
Dtest_itertools.py527 def keyfunc(obj): function
528 if keyfunc.skip > 0:
529 keyfunc.skip -= 1
535 keyfunc.skip = 0
536 self.assertRaises(ExpectedError, gulp, [None], keyfunc)
537 keyfunc.skip = 1
538 self.assertRaises(ExpectedError, gulp, [None, None], keyfunc)
1181 keyfunc = lambda x: x function
1182 for i, j in groupby(xrange(n), key=keyfunc):
1183 keyfunc.__dict__.setdefault('x',[]).append(j)
/external/python/cpython2/Modules/
Ditertoolsmodule.c15 PyObject *keyfunc; member
29 PyObject *it, *keyfunc = Py_None; in groupby_new() local
32 &it, &keyfunc)) in groupby_new()
41 gbo->keyfunc = keyfunc; in groupby_new()
42 Py_INCREF(keyfunc); in groupby_new()
56 Py_XDECREF(gbo->keyfunc); in groupby_dealloc()
67 Py_VISIT(gbo->keyfunc); in groupby_traverse()
83 if (gbo->keyfunc == Py_None) { in groupby_step()
87 newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL); in groupby_step()
/external/python/cpython2/Objects/
Dlistobject.c2056 PyObject *keyfunc = NULL; in listsort() local
2065 kwlist, &compare, &keyfunc, &reverse)) in listsort()
2073 if (keyfunc == Py_None) in listsort()
2074 keyfunc = NULL; in listsort()
2075 if (compare != NULL && keyfunc != NULL) { in listsort()
2094 if (keyfunc != NULL) { in listsort()
2097 key = PyObject_CallFunctionObjArgs(keyfunc, value, in listsort()
2172 if (keyfunc != NULL) { in listsort()
/external/python/cpython3/Python/
Dbltinmodule.c1587 PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; in min_max() local
1609 kwlist, &keyfunc, &defaultval); in min_max()
1626 if (keyfunc == Py_None) { in min_max()
1627 keyfunc = NULL; in min_max()
1634 if (keyfunc != NULL) { in min_max()
1635 val = PyObject_CallOneArg(keyfunc, item); in min_max()
/external/python/cpython3/Modules/
Ditertoolsmodule.c56 PyObject *keyfunc; member
80 itertools_groupby_impl(PyTypeObject *type, PyObject *it, PyObject *keyfunc) in itertools_groupby_impl() argument
91 gbo->keyfunc = keyfunc; in itertools_groupby_impl()
92 Py_INCREF(keyfunc); in itertools_groupby_impl()
106 Py_XDECREF(gbo->keyfunc); in groupby_dealloc()
117 Py_VISIT(gbo->keyfunc); in groupby_traverse()
133 if (gbo->keyfunc == Py_None) { in groupby_step()
137 newkey = PyObject_CallOneArg(gbo->keyfunc, newvalue); in groupby_step()
197 lz->it, lz->keyfunc, lz->currkey, lz->currvalue, lz->tgtkey); in groupby_reduce()
200 lz->it, lz->keyfunc); in groupby_reduce()
/external/python/cpython2/Doc/library/
Ditertools.rst54 :func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v)
311 data = sorted(data, key=keyfunc)
312 for k, g in groupby(data, keyfunc):
324 self.keyfunc = key
332 self.currkey = self.keyfunc(self.currvalue)
339 self.currkey = self.keyfunc(self.currvalue)
/external/python/cpython3/Lib/test/
Dtest_itertools.py823 def keyfunc(obj): function
824 if keyfunc.skip > 0:
825 keyfunc.skip -= 1
831 keyfunc.skip = 0
832 self.assertRaises(ExpectedError, gulp, [None], keyfunc)
833 keyfunc.skip = 1
834 self.assertRaises(ExpectedError, gulp, [None, None], keyfunc)
1760 keyfunc = lambda x: x function
1761 for i, j in groupby(range(n), key=keyfunc):
1762 keyfunc.__dict__.setdefault('x',[]).append(j)
/external/python/cpython3/Doc/library/
Ditertools.rst402 data = sorted(data, key=keyfunc)
403 for k, g in groupby(data, keyfunc):
415 self.keyfunc = key
424 self.currkey = self.keyfunc(self.currvalue)
434 self.currkey = self.keyfunc(self.currvalue)
Dfunctions.rst948 such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and
949 ``heapq.nlargest(1, iterable, key=keyfunc)``.
985 such as ``sorted(iterable, key=keyfunc)[0]`` and ``heapq.nsmallest(1,
986 iterable, key=keyfunc)``.
/external/python/cpython3/Objects/
Dlistobject.c2180 list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse) in list_sort_impl() argument
2196 if (keyfunc == Py_None) in list_sort_impl()
2197 keyfunc = NULL; in list_sort_impl()
2211 if (keyfunc == NULL) { in list_sort_impl()
2229 keys[i] = PyObject_CallOneArg(keyfunc, saved_ob_item[i]); in list_sort_impl()
/external/python/cpython3/Lib/
Dpydoc.py313 keyfunc = lambda attr: (field_order.get(attr[0], 0), attr[0]) function
314 attrs.sort(key=keyfunc)