| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 94dd7cb commit 397e5c9
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -402,14 +402,33 @@ memory_ndim_get(PyMemoryViewObject *self) | |||
| 402 | 402 | return PyLong_FromLong(self->view.ndim); | |
| 403 | 403 | } | |
| 404 | 404 | ||
| 405 | - static PyGetSetDef memory_getsetlist[] ={ | ||
| 406 | - {"format", (getter)memory_format_get, NULL, NULL}, | ||
| 407 | - {"itemsize", (getter)memory_itemsize_get, NULL, NULL}, | ||
| 408 | - {"shape", (getter)memory_shape_get, NULL, NULL}, | ||
| 409 | - {"strides", (getter)memory_strides_get, NULL, NULL}, | ||
| 410 | - {"suboffsets", (getter)memory_suboffsets_get, NULL, NULL}, | ||
| 411 | - {"readonly", (getter)memory_readonly_get, NULL, NULL}, | ||
| 412 | - {"ndim", (getter)memory_ndim_get, NULL, NULL}, | ||
| 405 | + PyDoc_STRVAR(memory_format_doc, | ||
| 406 | + "A string containing the format (in struct module style)\n" | ||
| 407 | + " for each element in the view."); | ||
| 408 | + PyDoc_STRVAR(memory_itemsize_doc, | ||
| 409 | + "The size in bytes of each element of the memoryview."); | ||
| 410 | + PyDoc_STRVAR(memory_shape_doc, | ||
| 411 | + "A tuple of ndim integers giving the shape of the memory\n" | ||
| 412 | + " as an N-dimensional array."); | ||
| 413 | + PyDoc_STRVAR(memory_strides_doc, | ||
| 414 | + "A tuple of ndim integers giving the size in bytes to access\n" | ||
| 415 | + " each element for each dimension of the array."); | ||
| 416 | + PyDoc_STRVAR(memory_suboffsets_doc, | ||
| 417 | + "A tuple of integers used internally for PIL-style arrays."); | ||
| 418 | + PyDoc_STRVAR(memory_readonly_doc, | ||
| 419 | + "A bool indicating whether the memory is read only."); | ||
| 420 | + PyDoc_STRVAR(memory_ndim_doc, | ||
| 421 | + "An integer indicating how many dimensions of a multi-dimensional\n" | ||
| 422 | + " array the memory represents."); | ||
| 423 | + | ||
| 424 | + static PyGetSetDef memory_getsetlist[] = { | ||
| 425 | + {"format", (getter)memory_format_get, NULL, memory_format_doc}, | ||
| 426 | + {"itemsize", (getter)memory_itemsize_get, NULL, memory_itemsize_doc}, | ||
| 427 | + {"shape", (getter)memory_shape_get, NULL, memory_shape_doc}, | ||
| 428 | + {"strides", (getter)memory_strides_get, NULL, memory_strides_doc}, | ||
| 429 | + {"suboffsets", (getter)memory_suboffsets_get, NULL, memory_suboffsets_doc}, | ||
| 430 | + {"readonly", (getter)memory_readonly_get, NULL, memory_readonly_doc}, | ||
| 431 | + {"ndim", (getter)memory_ndim_get, NULL, memory_ndim_doc}, | ||
| 413 | 432 | {NULL, NULL, NULL, NULL}, | |
| 414 | 433 | }; | |
| 415 | 434 | ||
@@ -485,10 +504,23 @@ memory_exit(PyObject *self, PyObject *args) | |||
| 485 | 504 | Py_RETURN_NONE; | |
| 486 | 505 | } | |
| 487 | 506 | ||
| 507 | + PyDoc_STRVAR(memory_release_doc, | ||
| 508 | + "M.release() -> None\n\ | ||
| 509 | + \n\ | ||
| 510 | + Release the underlying buffer exposed by the memoryview object."); | ||
| 511 | + PyDoc_STRVAR(memory_tobytes_doc, | ||
| 512 | + "M.tobytes() -> bytes\n\ | ||
| 513 | + \n\ | ||
| 514 | + Return the data in the buffer as a byte string."); | ||
| 515 | + PyDoc_STRVAR(memory_tolist_doc, | ||
| 516 | + "M.tolist() -> list\n\ | ||
| 517 | + \n\ | ||
| 518 | + Return the data in the buffer as a list of elements."); | ||
| 519 | + | ||
| 488 | 520 | static PyMethodDef memory_methods[] = { | |
| 489 | - {"release", memory_exit, METH_NOARGS}, | ||
| 490 | - {"tobytes", (PyCFunction)memory_tobytes, METH_NOARGS, NULL}, | ||
| 491 | - {"tolist", (PyCFunction)memory_tolist, METH_NOARGS, NULL}, | ||
| 521 | + {"release", memory_exit, METH_NOARGS, memory_release_doc}, | ||
| 522 | + {"tobytes", (PyCFunction)memory_tobytes, METH_NOARGS, memory_tobytes_doc}, | ||
| 523 | + {"tolist", (PyCFunction)memory_tolist, METH_NOARGS, memory_tolist_doc}, | ||
| 492 | 524 | {"__enter__", memory_enter, METH_NOARGS}, | |
| 493 | 525 | {"__exit__", memory_exit, METH_VARARGS}, | |
| 494 | 526 | {NULL, NULL} /* sentinel */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments