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

Function io_pack

numpy/core/src/multiarray/compiled_base.c:1976–2001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1974
1975
1976NPY_NO_EXPORT PyObject *
1977io_pack(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwds)
1978{
1979 PyObject *obj;
1980 int axis = NPY_MAXDIMS;
1981 static char *kwlist[] = {"in", "axis", "bitorder", NULL};
1982 char c = 'b';
1983 const char * order_str = NULL;
1984
1985 if (!PyArg_ParseTupleAndKeywords( args, kwds, "O|O&s:pack" , kwlist,
1986 &obj, PyArray_AxisConverter, &axis, &order_str)) {
1987 return NULL;
1988 }
1989 if (order_str != NULL) {
1990 if (strncmp(order_str, "little", 6) == 0)
1991 c = 'l';
1992 else if (strncmp(order_str, "big", 3) == 0)
1993 c = 'b';
1994 else {
1995 PyErr_SetString(PyExc_ValueError,
1996 "'order' must be either 'little' or 'big'");
1997 return NULL;
1998 }
1999 }
2000 return pack_bits(obj, axis, c);
2001}
2002
2003
2004NPY_NO_EXPORT PyObject *

Callers

nothing calls this directly

Calls 1

pack_bitsFunction · 0.85

Tested by

no test coverage detected