Home | History | Annotate | Download | only in clinic
      1 /*[clinic input]
      2 preserve
      3 [clinic start generated code]*/
      4 
      5 PyDoc_STRVAR(array_array___copy____doc__,
      6 "__copy__($self, /)\n"
      7 "--\n"
      8 "\n"
      9 "Return a copy of the array.");
     10 
     11 #define ARRAY_ARRAY___COPY___METHODDEF    \
     12     {"__copy__", (PyCFunction)array_array___copy__, METH_NOARGS, array_array___copy____doc__},
     13 
     14 static PyObject *
     15 array_array___copy___impl(arrayobject *self);
     16 
     17 static PyObject *
     18 array_array___copy__(arrayobject *self, PyObject *Py_UNUSED(ignored))
     19 {
     20     return array_array___copy___impl(self);
     21 }
     22 
     23 PyDoc_STRVAR(array_array___deepcopy____doc__,
     24 "__deepcopy__($self, unused, /)\n"
     25 "--\n"
     26 "\n"
     27 "Return a copy of the array.");
     28 
     29 #define ARRAY_ARRAY___DEEPCOPY___METHODDEF    \
     30     {"__deepcopy__", (PyCFunction)array_array___deepcopy__, METH_O, array_array___deepcopy____doc__},
     31 
     32 PyDoc_STRVAR(array_array_count__doc__,
     33 "count($self, v, /)\n"
     34 "--\n"
     35 "\n"
     36 "Return number of occurrences of v in the array.");
     37 
     38 #define ARRAY_ARRAY_COUNT_METHODDEF    \
     39     {"count", (PyCFunction)array_array_count, METH_O, array_array_count__doc__},
     40 
     41 PyDoc_STRVAR(array_array_index__doc__,
     42 "index($self, v, /)\n"
     43 "--\n"
     44 "\n"
     45 "Return index of first occurrence of v in the array.");
     46 
     47 #define ARRAY_ARRAY_INDEX_METHODDEF    \
     48     {"index", (PyCFunction)array_array_index, METH_O, array_array_index__doc__},
     49 
     50 PyDoc_STRVAR(array_array_remove__doc__,
     51 "remove($self, v, /)\n"
     52 "--\n"
     53 "\n"
     54 "Remove the first occurrence of v in the array.");
     55 
     56 #define ARRAY_ARRAY_REMOVE_METHODDEF    \
     57     {"remove", (PyCFunction)array_array_remove, METH_O, array_array_remove__doc__},
     58 
     59 PyDoc_STRVAR(array_array_pop__doc__,
     60 "pop($self, i=-1, /)\n"
     61 "--\n"
     62 "\n"
     63 "Return the i-th element and delete it from the array.\n"
     64 "\n"
     65 "i defaults to -1.");
     66 
     67 #define ARRAY_ARRAY_POP_METHODDEF    \
     68     {"pop", (PyCFunction)array_array_pop, METH_VARARGS, array_array_pop__doc__},
     69 
     70 static PyObject *
     71 array_array_pop_impl(arrayobject *self, Py_ssize_t i);
     72 
     73 static PyObject *
     74 array_array_pop(arrayobject *self, PyObject *args)
     75 {
     76     PyObject *return_value = NULL;
     77     Py_ssize_t i = -1;
     78 
     79     if (!PyArg_ParseTuple(args, "|n:pop",
     80         &i)) {
     81         goto exit;
     82     }
     83     return_value = array_array_pop_impl(self, i);
     84 
     85 exit:
     86     return return_value;
     87 }
     88 
     89 PyDoc_STRVAR(array_array_extend__doc__,
     90 "extend($self, bb, /)\n"
     91 "--\n"
     92 "\n"
     93 "Append items to the end of the array.");
     94 
     95 #define ARRAY_ARRAY_EXTEND_METHODDEF    \
     96     {"extend", (PyCFunction)array_array_extend, METH_O, array_array_extend__doc__},
     97 
     98 PyDoc_STRVAR(array_array_insert__doc__,
     99 "insert($self, i, v, /)\n"
    100 "--\n"
    101 "\n"
    102 "Insert a new item v into the array before position i.");
    103 
    104 #define ARRAY_ARRAY_INSERT_METHODDEF    \
    105     {"insert", (PyCFunction)array_array_insert, METH_VARARGS, array_array_insert__doc__},
    106 
    107 static PyObject *
    108 array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v);
    109 
    110 static PyObject *
    111 array_array_insert(arrayobject *self, PyObject *args)
    112 {
    113     PyObject *return_value = NULL;
    114     Py_ssize_t i;
    115     PyObject *v;
    116 
    117     if (!PyArg_ParseTuple(args, "nO:insert",
    118         &i, &v)) {
    119         goto exit;
    120     }
    121     return_value = array_array_insert_impl(self, i, v);
    122 
    123 exit:
    124     return return_value;
    125 }
    126 
    127 PyDoc_STRVAR(array_array_buffer_info__doc__,
    128 "buffer_info($self, /)\n"
    129 "--\n"
    130 "\n"
    131 "Return a tuple (address, length) giving the current memory address and the length in items of the buffer used to hold array\'s contents.\n"
    132 "\n"
    133 "The length should be multiplied by the itemsize attribute to calculate\n"
    134 "the buffer length in bytes.");
    135 
    136 #define ARRAY_ARRAY_BUFFER_INFO_METHODDEF    \
    137     {"buffer_info", (PyCFunction)array_array_buffer_info, METH_NOARGS, array_array_buffer_info__doc__},
    138 
    139 static PyObject *
    140 array_array_buffer_info_impl(arrayobject *self);
    141 
    142 static PyObject *
    143 array_array_buffer_info(arrayobject *self, PyObject *Py_UNUSED(ignored))
    144 {
    145     return array_array_buffer_info_impl(self);
    146 }
    147 
    148 PyDoc_STRVAR(array_array_append__doc__,
    149 "append($self, v, /)\n"
    150 "--\n"
    151 "\n"
    152 "Append new value v to the end of the array.");
    153 
    154 #define ARRAY_ARRAY_APPEND_METHODDEF    \
    155     {"append", (PyCFunction)array_array_append, METH_O, array_array_append__doc__},
    156 
    157 PyDoc_STRVAR(array_array_byteswap__doc__,
    158 "byteswap($self, /)\n"
    159 "--\n"
    160 "\n"
    161 "Byteswap all items of the array.\n"
    162 "\n"
    163 "If the items in the array are not 1, 2, 4, or 8 bytes in size, RuntimeError is\n"
    164 "raised.");
    165 
    166 #define ARRAY_ARRAY_BYTESWAP_METHODDEF    \
    167     {"byteswap", (PyCFunction)array_array_byteswap, METH_NOARGS, array_array_byteswap__doc__},
    168 
    169 static PyObject *
    170 array_array_byteswap_impl(arrayobject *self);
    171 
    172 static PyObject *
    173 array_array_byteswap(arrayobject *self, PyObject *Py_UNUSED(ignored))
    174 {
    175     return array_array_byteswap_impl(self);
    176 }
    177 
    178 PyDoc_STRVAR(array_array_reverse__doc__,
    179 "reverse($self, /)\n"
    180 "--\n"
    181 "\n"
    182 "Reverse the order of the items in the array.");
    183 
    184 #define ARRAY_ARRAY_REVERSE_METHODDEF    \
    185     {"reverse", (PyCFunction)array_array_reverse, METH_NOARGS, array_array_reverse__doc__},
    186 
    187 static PyObject *
    188 array_array_reverse_impl(arrayobject *self);
    189 
    190 static PyObject *
    191 array_array_reverse(arrayobject *self, PyObject *Py_UNUSED(ignored))
    192 {
    193     return array_array_reverse_impl(self);
    194 }
    195 
    196 PyDoc_STRVAR(array_array_fromfile__doc__,
    197 "fromfile($self, f, n, /)\n"
    198 "--\n"
    199 "\n"
    200 "Read n objects from the file object f and append them to the end of the array.");
    201 
    202 #define ARRAY_ARRAY_FROMFILE_METHODDEF    \
    203     {"fromfile", (PyCFunction)array_array_fromfile, METH_VARARGS, array_array_fromfile__doc__},
    204 
    205 static PyObject *
    206 array_array_fromfile_impl(arrayobject *self, PyObject *f, Py_ssize_t n);
    207 
    208 static PyObject *
    209 array_array_fromfile(arrayobject *self, PyObject *args)
    210 {
    211     PyObject *return_value = NULL;
    212     PyObject *f;
    213     Py_ssize_t n;
    214 
    215     if (!PyArg_ParseTuple(args, "On:fromfile",
    216         &f, &n)) {
    217         goto exit;
    218     }
    219     return_value = array_array_fromfile_impl(self, f, n);
    220 
    221 exit:
    222     return return_value;
    223 }
    224 
    225 PyDoc_STRVAR(array_array_tofile__doc__,
    226 "tofile($self, f, /)\n"
    227 "--\n"
    228 "\n"
    229 "Write all items (as machine values) to the file object f.");
    230 
    231 #define ARRAY_ARRAY_TOFILE_METHODDEF    \
    232     {"tofile", (PyCFunction)array_array_tofile, METH_O, array_array_tofile__doc__},
    233 
    234 PyDoc_STRVAR(array_array_fromlist__doc__,
    235 "fromlist($self, list, /)\n"
    236 "--\n"
    237 "\n"
    238 "Append items to array from list.");
    239 
    240 #define ARRAY_ARRAY_FROMLIST_METHODDEF    \
    241     {"fromlist", (PyCFunction)array_array_fromlist, METH_O, array_array_fromlist__doc__},
    242 
    243 PyDoc_STRVAR(array_array_tolist__doc__,
    244 "tolist($self, /)\n"
    245 "--\n"
    246 "\n"
    247 "Convert array to an ordinary list with the same items.");
    248 
    249 #define ARRAY_ARRAY_TOLIST_METHODDEF    \
    250     {"tolist", (PyCFunction)array_array_tolist, METH_NOARGS, array_array_tolist__doc__},
    251 
    252 static PyObject *
    253 array_array_tolist_impl(arrayobject *self);
    254 
    255 static PyObject *
    256 array_array_tolist(arrayobject *self, PyObject *Py_UNUSED(ignored))
    257 {
    258     return array_array_tolist_impl(self);
    259 }
    260 
    261 PyDoc_STRVAR(array_array_fromstring__doc__,
    262 "fromstring($self, buffer, /)\n"
    263 "--\n"
    264 "\n"
    265 "Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).\n"
    266 "\n"
    267 "This method is deprecated. Use frombytes instead.");
    268 
    269 #define ARRAY_ARRAY_FROMSTRING_METHODDEF    \
    270     {"fromstring", (PyCFunction)array_array_fromstring, METH_O, array_array_fromstring__doc__},
    271 
    272 static PyObject *
    273 array_array_fromstring_impl(arrayobject *self, Py_buffer *buffer);
    274 
    275 static PyObject *
    276 array_array_fromstring(arrayobject *self, PyObject *arg)
    277 {
    278     PyObject *return_value = NULL;
    279     Py_buffer buffer = {NULL, NULL};
    280 
    281     if (!PyArg_Parse(arg, "s*:fromstring", &buffer)) {
    282         goto exit;
    283     }
    284     return_value = array_array_fromstring_impl(self, &buffer);
    285 
    286 exit:
    287     /* Cleanup for buffer */
    288     if (buffer.obj) {
    289        PyBuffer_Release(&buffer);
    290     }
    291 
    292     return return_value;
    293 }
    294 
    295 PyDoc_STRVAR(array_array_frombytes__doc__,
    296 "frombytes($self, buffer, /)\n"
    297 "--\n"
    298 "\n"
    299 "Appends items from the string, interpreting it as an array of machine values, as if it had been read from a file using the fromfile() method).");
    300 
    301 #define ARRAY_ARRAY_FROMBYTES_METHODDEF    \
    302     {"frombytes", (PyCFunction)array_array_frombytes, METH_O, array_array_frombytes__doc__},
    303 
    304 static PyObject *
    305 array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer);
    306 
    307 static PyObject *
    308 array_array_frombytes(arrayobject *self, PyObject *arg)
    309 {
    310     PyObject *return_value = NULL;
    311     Py_buffer buffer = {NULL, NULL};
    312 
    313     if (!PyArg_Parse(arg, "y*:frombytes", &buffer)) {
    314         goto exit;
    315     }
    316     return_value = array_array_frombytes_impl(self, &buffer);
    317 
    318 exit:
    319     /* Cleanup for buffer */
    320     if (buffer.obj) {
    321        PyBuffer_Release(&buffer);
    322     }
    323 
    324     return return_value;
    325 }
    326 
    327 PyDoc_STRVAR(array_array_tobytes__doc__,
    328 "tobytes($self, /)\n"
    329 "--\n"
    330 "\n"
    331 "Convert the array to an array of machine values and return the bytes representation.");
    332 
    333 #define ARRAY_ARRAY_TOBYTES_METHODDEF    \
    334     {"tobytes", (PyCFunction)array_array_tobytes, METH_NOARGS, array_array_tobytes__doc__},
    335 
    336 static PyObject *
    337 array_array_tobytes_impl(arrayobject *self);
    338 
    339 static PyObject *
    340 array_array_tobytes(arrayobject *self, PyObject *Py_UNUSED(ignored))
    341 {
    342     return array_array_tobytes_impl(self);
    343 }
    344 
    345 PyDoc_STRVAR(array_array_tostring__doc__,
    346 "tostring($self, /)\n"
    347 "--\n"
    348 "\n"
    349 "Convert the array to an array of machine values and return the bytes representation.\n"
    350 "\n"
    351 "This method is deprecated. Use tobytes instead.");
    352 
    353 #define ARRAY_ARRAY_TOSTRING_METHODDEF    \
    354     {"tostring", (PyCFunction)array_array_tostring, METH_NOARGS, array_array_tostring__doc__},
    355 
    356 static PyObject *
    357 array_array_tostring_impl(arrayobject *self);
    358 
    359 static PyObject *
    360 array_array_tostring(arrayobject *self, PyObject *Py_UNUSED(ignored))
    361 {
    362     return array_array_tostring_impl(self);
    363 }
    364 
    365 PyDoc_STRVAR(array_array_fromunicode__doc__,
    366 "fromunicode($self, ustr, /)\n"
    367 "--\n"
    368 "\n"
    369 "Extends this array with data from the unicode string ustr.\n"
    370 "\n"
    371 "The array must be a unicode type array; otherwise a ValueError is raised.\n"
    372 "Use array.frombytes(ustr.encode(...)) to append Unicode data to an array of\n"
    373 "some other type.");
    374 
    375 #define ARRAY_ARRAY_FROMUNICODE_METHODDEF    \
    376     {"fromunicode", (PyCFunction)array_array_fromunicode, METH_O, array_array_fromunicode__doc__},
    377 
    378 static PyObject *
    379 array_array_fromunicode_impl(arrayobject *self, Py_UNICODE *ustr,
    380                              Py_ssize_clean_t ustr_length);
    381 
    382 static PyObject *
    383 array_array_fromunicode(arrayobject *self, PyObject *arg)
    384 {
    385     PyObject *return_value = NULL;
    386     Py_UNICODE *ustr;
    387     Py_ssize_clean_t ustr_length;
    388 
    389     if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) {
    390         goto exit;
    391     }
    392     return_value = array_array_fromunicode_impl(self, ustr, ustr_length);
    393 
    394 exit:
    395     return return_value;
    396 }
    397 
    398 PyDoc_STRVAR(array_array_tounicode__doc__,
    399 "tounicode($self, /)\n"
    400 "--\n"
    401 "\n"
    402 "Extends this array with data from the unicode string ustr.\n"
    403 "\n"
    404 "Convert the array to a unicode string.  The array must be a unicode type array;\n"
    405 "otherwise a ValueError is raised.  Use array.tobytes().decode() to obtain a\n"
    406 "unicode string from an array of some other type.");
    407 
    408 #define ARRAY_ARRAY_TOUNICODE_METHODDEF    \
    409     {"tounicode", (PyCFunction)array_array_tounicode, METH_NOARGS, array_array_tounicode__doc__},
    410 
    411 static PyObject *
    412 array_array_tounicode_impl(arrayobject *self);
    413 
    414 static PyObject *
    415 array_array_tounicode(arrayobject *self, PyObject *Py_UNUSED(ignored))
    416 {
    417     return array_array_tounicode_impl(self);
    418 }
    419 
    420 PyDoc_STRVAR(array_array___sizeof____doc__,
    421 "__sizeof__($self, /)\n"
    422 "--\n"
    423 "\n"
    424 "Size of the array in memory, in bytes.");
    425 
    426 #define ARRAY_ARRAY___SIZEOF___METHODDEF    \
    427     {"__sizeof__", (PyCFunction)array_array___sizeof__, METH_NOARGS, array_array___sizeof____doc__},
    428 
    429 static PyObject *
    430 array_array___sizeof___impl(arrayobject *self);
    431 
    432 static PyObject *
    433 array_array___sizeof__(arrayobject *self, PyObject *Py_UNUSED(ignored))
    434 {
    435     return array_array___sizeof___impl(self);
    436 }
    437 
    438 PyDoc_STRVAR(array__array_reconstructor__doc__,
    439 "_array_reconstructor($module, arraytype, typecode, mformat_code, items,\n"
    440 "                     /)\n"
    441 "--\n"
    442 "\n"
    443 "Internal. Used for pickling support.");
    444 
    445 #define ARRAY__ARRAY_RECONSTRUCTOR_METHODDEF    \
    446     {"_array_reconstructor", (PyCFunction)array__array_reconstructor, METH_VARARGS, array__array_reconstructor__doc__},
    447 
    448 static PyObject *
    449 array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
    450                                 int typecode,
    451                                 enum machine_format_code mformat_code,
    452                                 PyObject *items);
    453 
    454 static PyObject *
    455 array__array_reconstructor(PyObject *module, PyObject *args)
    456 {
    457     PyObject *return_value = NULL;
    458     PyTypeObject *arraytype;
    459     int typecode;
    460     enum machine_format_code mformat_code;
    461     PyObject *items;
    462 
    463     if (!PyArg_ParseTuple(args, "OCiO:_array_reconstructor",
    464         &arraytype, &typecode, &mformat_code, &items)) {
    465         goto exit;
    466     }
    467     return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items);
    468 
    469 exit:
    470     return return_value;
    471 }
    472 
    473 PyDoc_STRVAR(array_array___reduce_ex____doc__,
    474 "__reduce_ex__($self, value, /)\n"
    475 "--\n"
    476 "\n"
    477 "Return state information for pickling.");
    478 
    479 #define ARRAY_ARRAY___REDUCE_EX___METHODDEF    \
    480     {"__reduce_ex__", (PyCFunction)array_array___reduce_ex__, METH_O, array_array___reduce_ex____doc__},
    481 
    482 PyDoc_STRVAR(array_arrayiterator___reduce____doc__,
    483 "__reduce__($self, /)\n"
    484 "--\n"
    485 "\n"
    486 "Return state information for pickling.");
    487 
    488 #define ARRAY_ARRAYITERATOR___REDUCE___METHODDEF    \
    489     {"__reduce__", (PyCFunction)array_arrayiterator___reduce__, METH_NOARGS, array_arrayiterator___reduce____doc__},
    490 
    491 static PyObject *
    492 array_arrayiterator___reduce___impl(arrayiterobject *self);
    493 
    494 static PyObject *
    495 array_arrayiterator___reduce__(arrayiterobject *self, PyObject *Py_UNUSED(ignored))
    496 {
    497     return array_arrayiterator___reduce___impl(self);
    498 }
    499 
    500 PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
    501 "__setstate__($self, state, /)\n"
    502 "--\n"
    503 "\n"
    504 "Set state information for unpickling.");
    505 
    506 #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF    \
    507     {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
    508 /*[clinic end generated code: output=b2054fb764c8cc64 input=a9049054013a1b77]*/
    509