MCPcopy Create free account
hub / github.com/numpy/numpy / array_choose

Function array_choose

numpy/core/src/multiarray/methods.c:1309–1342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1307}
1308
1309static PyObject *
1310array_choose(PyArrayObject *self, PyObject *args, PyObject *kwds)
1311{
1312 static char *keywords[] = {"out", "mode", NULL};
1313 PyObject *choices;
1314 PyArrayObject *out = NULL;
1315 NPY_CLIPMODE clipmode = NPY_RAISE;
1316 Py_ssize_t n = PyTuple_Size(args);
1317
1318 if (n <= 1) {
1319 if (!PyArg_ParseTuple(args, "O:choose", &choices)) {
1320 return NULL;
1321 }
1322 }
1323 else {
1324 choices = args;
1325 }
1326
1327 if (!NpyArg_ParseKeywords(kwds, "|O&O&", keywords,
1328 PyArray_OutputConverter, &out,
1329 PyArray_ClipmodeConverter, &clipmode)) {
1330 return NULL;
1331 }
1332
1333 PyObject *ret = PyArray_Choose(self, choices, out, clipmode);
1334
1335 /* this matches the unpacking behavior of ufuncs */
1336 if (out == NULL) {
1337 return PyArray_Return((PyArrayObject *)ret);
1338 }
1339 else {
1340 return ret;
1341 }
1342}
1343
1344static PyObject *
1345array_sort(PyArrayObject *self,

Callers

nothing calls this directly

Calls 3

NpyArg_ParseKeywordsFunction · 0.85
PyArray_ChooseFunction · 0.85
PyArray_ReturnFunction · 0.85

Tested by

no test coverage detected