1 /*[clinic input] 2 preserve 3 [clinic start generated code]*/ 4 5 PyDoc_STRVAR(_io_IncrementalNewlineDecoder___init____doc__, 6 "IncrementalNewlineDecoder(decoder, translate, errors=\'strict\')\n" 7 "--\n" 8 "\n" 9 "Codec used when reading a file in universal newlines mode.\n" 10 "\n" 11 "It wraps another incremental decoder, translating \\r\\n and \\r into \\n.\n" 12 "It also records the types of newlines encountered. When used with\n" 13 "translate=False, it ensures that the newline sequence is returned in\n" 14 "one piece. When used with decoder=None, it expects unicode strings as\n" 15 "decode input and translates newlines without first invoking an external\n" 16 "decoder."); 17 18 static int 19 _io_IncrementalNewlineDecoder___init___impl(nldecoder_object *self, 20 PyObject *decoder, int translate, 21 PyObject *errors); 22 23 static int 24 _io_IncrementalNewlineDecoder___init__(PyObject *self, PyObject *args, PyObject *kwargs) 25 { 26 int return_value = -1; 27 static const char * const _keywords[] = {"decoder", "translate", "errors", NULL}; 28 static _PyArg_Parser _parser = {"Oi|O:IncrementalNewlineDecoder", _keywords, 0}; 29 PyObject *decoder; 30 int translate; 31 PyObject *errors = NULL; 32 33 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, 34 &decoder, &translate, &errors)) { 35 goto exit; 36 } 37 return_value = _io_IncrementalNewlineDecoder___init___impl((nldecoder_object *)self, decoder, translate, errors); 38 39 exit: 40 return return_value; 41 } 42 43 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_decode__doc__, 44 "decode($self, /, input, final=False)\n" 45 "--\n" 46 "\n"); 47 48 #define _IO_INCREMENTALNEWLINEDECODER_DECODE_METHODDEF \ 49 {"decode", (PyCFunction)_io_IncrementalNewlineDecoder_decode, METH_FASTCALL, _io_IncrementalNewlineDecoder_decode__doc__}, 50 51 static PyObject * 52 _io_IncrementalNewlineDecoder_decode_impl(nldecoder_object *self, 53 PyObject *input, int final); 54 55 static PyObject * 56 _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) 57 { 58 PyObject *return_value = NULL; 59 static const char * const _keywords[] = {"input", "final", NULL}; 60 static _PyArg_Parser _parser = {"O|i:decode", _keywords, 0}; 61 PyObject *input; 62 int final = 0; 63 64 if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, 65 &input, &final)) { 66 goto exit; 67 } 68 return_value = _io_IncrementalNewlineDecoder_decode_impl(self, input, final); 69 70 exit: 71 return return_value; 72 } 73 74 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_getstate__doc__, 75 "getstate($self, /)\n" 76 "--\n" 77 "\n"); 78 79 #define _IO_INCREMENTALNEWLINEDECODER_GETSTATE_METHODDEF \ 80 {"getstate", (PyCFunction)_io_IncrementalNewlineDecoder_getstate, METH_NOARGS, _io_IncrementalNewlineDecoder_getstate__doc__}, 81 82 static PyObject * 83 _io_IncrementalNewlineDecoder_getstate_impl(nldecoder_object *self); 84 85 static PyObject * 86 _io_IncrementalNewlineDecoder_getstate(nldecoder_object *self, PyObject *Py_UNUSED(ignored)) 87 { 88 return _io_IncrementalNewlineDecoder_getstate_impl(self); 89 } 90 91 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_setstate__doc__, 92 "setstate($self, state, /)\n" 93 "--\n" 94 "\n"); 95 96 #define _IO_INCREMENTALNEWLINEDECODER_SETSTATE_METHODDEF \ 97 {"setstate", (PyCFunction)_io_IncrementalNewlineDecoder_setstate, METH_O, _io_IncrementalNewlineDecoder_setstate__doc__}, 98 99 PyDoc_STRVAR(_io_IncrementalNewlineDecoder_reset__doc__, 100 "reset($self, /)\n" 101 "--\n" 102 "\n"); 103 104 #define _IO_INCREMENTALNEWLINEDECODER_RESET_METHODDEF \ 105 {"reset", (PyCFunction)_io_IncrementalNewlineDecoder_reset, METH_NOARGS, _io_IncrementalNewlineDecoder_reset__doc__}, 106 107 static PyObject * 108 _io_IncrementalNewlineDecoder_reset_impl(nldecoder_object *self); 109 110 static PyObject * 111 _io_IncrementalNewlineDecoder_reset(nldecoder_object *self, PyObject *Py_UNUSED(ignored)) 112 { 113 return _io_IncrementalNewlineDecoder_reset_impl(self); 114 } 115 116 PyDoc_STRVAR(_io_TextIOWrapper___init____doc__, 117 "TextIOWrapper(buffer, encoding=None, errors=None, newline=None,\n" 118 " line_buffering=False, write_through=False)\n" 119 "--\n" 120 "\n" 121 "Character and line based layer over a BufferedIOBase object, buffer.\n" 122 "\n" 123 "encoding gives the name of the encoding that the stream will be\n" 124 "decoded or encoded with. It defaults to locale.getpreferredencoding(False).\n" 125 "\n" 126 "errors determines the strictness of encoding and decoding (see\n" 127 "help(codecs.Codec) or the documentation for codecs.register) and\n" 128 "defaults to \"strict\".\n" 129 "\n" 130 "newline controls how line endings are handled. It can be None, \'\',\n" 131 "\'\\n\', \'\\r\', and \'\\r\\n\'. It works as follows:\n" 132 "\n" 133 "* On input, if newline is None, universal newlines mode is\n" 134 " enabled. Lines in the input can end in \'\\n\', \'\\r\', or \'\\r\\n\', and\n" 135 " these are translated into \'\\n\' before being returned to the\n" 136 " caller. If it is \'\', universal newline mode is enabled, but line\n" 137 " endings are returned to the caller untranslated. If it has any of\n" 138 " the other legal values, input lines are only terminated by the given\n" 139 " string, and the line ending is returned to the caller untranslated.\n" 140 "\n" 141 "* On output, if newline is None, any \'\\n\' characters written are\n" 142 " translated to the system default line separator, os.linesep. If\n" 143 " newline is \'\' or \'\\n\', no translation takes place. If newline is any\n" 144 " of the other legal values, any \'\\n\' characters written are translated\n" 145 " to the given string.\n" 146 "\n" 147 "If line_buffering is True, a call to flush is implied when a call to\n" 148 "write contains a newline character."); 149 150 static int 151 _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, 152 const char *encoding, const char *errors, 153 const char *newline, int line_buffering, 154 int write_through); 155 156 static int 157 _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs) 158 { 159 int return_value = -1; 160 static const char * const _keywords[] = {"buffer", "encoding", "errors", "newline", "line_buffering", "write_through", NULL}; 161 static _PyArg_Parser _parser = {"O|zzzii:TextIOWrapper", _keywords, 0}; 162 PyObject *buffer; 163 const char *encoding = NULL; 164 const char *errors = NULL; 165 const char *newline = NULL; 166 int line_buffering = 0; 167 int write_through = 0; 168 169 if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, 170 &buffer, &encoding, &errors, &newline, &line_buffering, &write_through)) { 171 goto exit; 172 } 173 return_value = _io_TextIOWrapper___init___impl((textio *)self, buffer, encoding, errors, newline, line_buffering, write_through); 174 175 exit: 176 return return_value; 177 } 178 179 PyDoc_STRVAR(_io_TextIOWrapper_detach__doc__, 180 "detach($self, /)\n" 181 "--\n" 182 "\n"); 183 184 #define _IO_TEXTIOWRAPPER_DETACH_METHODDEF \ 185 {"detach", (PyCFunction)_io_TextIOWrapper_detach, METH_NOARGS, _io_TextIOWrapper_detach__doc__}, 186 187 static PyObject * 188 _io_TextIOWrapper_detach_impl(textio *self); 189 190 static PyObject * 191 _io_TextIOWrapper_detach(textio *self, PyObject *Py_UNUSED(ignored)) 192 { 193 return _io_TextIOWrapper_detach_impl(self); 194 } 195 196 PyDoc_STRVAR(_io_TextIOWrapper_write__doc__, 197 "write($self, text, /)\n" 198 "--\n" 199 "\n"); 200 201 #define _IO_TEXTIOWRAPPER_WRITE_METHODDEF \ 202 {"write", (PyCFunction)_io_TextIOWrapper_write, METH_O, _io_TextIOWrapper_write__doc__}, 203 204 static PyObject * 205 _io_TextIOWrapper_write_impl(textio *self, PyObject *text); 206 207 static PyObject * 208 _io_TextIOWrapper_write(textio *self, PyObject *arg) 209 { 210 PyObject *return_value = NULL; 211 PyObject *text; 212 213 if (!PyArg_Parse(arg, "U:write", &text)) { 214 goto exit; 215 } 216 return_value = _io_TextIOWrapper_write_impl(self, text); 217 218 exit: 219 return return_value; 220 } 221 222 PyDoc_STRVAR(_io_TextIOWrapper_read__doc__, 223 "read($self, size=-1, /)\n" 224 "--\n" 225 "\n"); 226 227 #define _IO_TEXTIOWRAPPER_READ_METHODDEF \ 228 {"read", (PyCFunction)_io_TextIOWrapper_read, METH_VARARGS, _io_TextIOWrapper_read__doc__}, 229 230 static PyObject * 231 _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n); 232 233 static PyObject * 234 _io_TextIOWrapper_read(textio *self, PyObject *args) 235 { 236 PyObject *return_value = NULL; 237 Py_ssize_t n = -1; 238 239 if (!PyArg_ParseTuple(args, "|O&:read", 240 _PyIO_ConvertSsize_t, &n)) { 241 goto exit; 242 } 243 return_value = _io_TextIOWrapper_read_impl(self, n); 244 245 exit: 246 return return_value; 247 } 248 249 PyDoc_STRVAR(_io_TextIOWrapper_readline__doc__, 250 "readline($self, size=-1, /)\n" 251 "--\n" 252 "\n"); 253 254 #define _IO_TEXTIOWRAPPER_READLINE_METHODDEF \ 255 {"readline", (PyCFunction)_io_TextIOWrapper_readline, METH_VARARGS, _io_TextIOWrapper_readline__doc__}, 256 257 static PyObject * 258 _io_TextIOWrapper_readline_impl(textio *self, Py_ssize_t size); 259 260 static PyObject * 261 _io_TextIOWrapper_readline(textio *self, PyObject *args) 262 { 263 PyObject *return_value = NULL; 264 Py_ssize_t size = -1; 265 266 if (!PyArg_ParseTuple(args, "|n:readline", 267 &size)) { 268 goto exit; 269 } 270 return_value = _io_TextIOWrapper_readline_impl(self, size); 271 272 exit: 273 return return_value; 274 } 275 276 PyDoc_STRVAR(_io_TextIOWrapper_seek__doc__, 277 "seek($self, cookie, whence=0, /)\n" 278 "--\n" 279 "\n"); 280 281 #define _IO_TEXTIOWRAPPER_SEEK_METHODDEF \ 282 {"seek", (PyCFunction)_io_TextIOWrapper_seek, METH_VARARGS, _io_TextIOWrapper_seek__doc__}, 283 284 static PyObject * 285 _io_TextIOWrapper_seek_impl(textio *self, PyObject *cookieObj, int whence); 286 287 static PyObject * 288 _io_TextIOWrapper_seek(textio *self, PyObject *args) 289 { 290 PyObject *return_value = NULL; 291 PyObject *cookieObj; 292 int whence = 0; 293 294 if (!PyArg_ParseTuple(args, "O|i:seek", 295 &cookieObj, &whence)) { 296 goto exit; 297 } 298 return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence); 299 300 exit: 301 return return_value; 302 } 303 304 PyDoc_STRVAR(_io_TextIOWrapper_tell__doc__, 305 "tell($self, /)\n" 306 "--\n" 307 "\n"); 308 309 #define _IO_TEXTIOWRAPPER_TELL_METHODDEF \ 310 {"tell", (PyCFunction)_io_TextIOWrapper_tell, METH_NOARGS, _io_TextIOWrapper_tell__doc__}, 311 312 static PyObject * 313 _io_TextIOWrapper_tell_impl(textio *self); 314 315 static PyObject * 316 _io_TextIOWrapper_tell(textio *self, PyObject *Py_UNUSED(ignored)) 317 { 318 return _io_TextIOWrapper_tell_impl(self); 319 } 320 321 PyDoc_STRVAR(_io_TextIOWrapper_truncate__doc__, 322 "truncate($self, pos=None, /)\n" 323 "--\n" 324 "\n"); 325 326 #define _IO_TEXTIOWRAPPER_TRUNCATE_METHODDEF \ 327 {"truncate", (PyCFunction)_io_TextIOWrapper_truncate, METH_VARARGS, _io_TextIOWrapper_truncate__doc__}, 328 329 static PyObject * 330 _io_TextIOWrapper_truncate_impl(textio *self, PyObject *pos); 331 332 static PyObject * 333 _io_TextIOWrapper_truncate(textio *self, PyObject *args) 334 { 335 PyObject *return_value = NULL; 336 PyObject *pos = Py_None; 337 338 if (!PyArg_UnpackTuple(args, "truncate", 339 0, 1, 340 &pos)) { 341 goto exit; 342 } 343 return_value = _io_TextIOWrapper_truncate_impl(self, pos); 344 345 exit: 346 return return_value; 347 } 348 349 PyDoc_STRVAR(_io_TextIOWrapper_fileno__doc__, 350 "fileno($self, /)\n" 351 "--\n" 352 "\n"); 353 354 #define _IO_TEXTIOWRAPPER_FILENO_METHODDEF \ 355 {"fileno", (PyCFunction)_io_TextIOWrapper_fileno, METH_NOARGS, _io_TextIOWrapper_fileno__doc__}, 356 357 static PyObject * 358 _io_TextIOWrapper_fileno_impl(textio *self); 359 360 static PyObject * 361 _io_TextIOWrapper_fileno(textio *self, PyObject *Py_UNUSED(ignored)) 362 { 363 return _io_TextIOWrapper_fileno_impl(self); 364 } 365 366 PyDoc_STRVAR(_io_TextIOWrapper_seekable__doc__, 367 "seekable($self, /)\n" 368 "--\n" 369 "\n"); 370 371 #define _IO_TEXTIOWRAPPER_SEEKABLE_METHODDEF \ 372 {"seekable", (PyCFunction)_io_TextIOWrapper_seekable, METH_NOARGS, _io_TextIOWrapper_seekable__doc__}, 373 374 static PyObject * 375 _io_TextIOWrapper_seekable_impl(textio *self); 376 377 static PyObject * 378 _io_TextIOWrapper_seekable(textio *self, PyObject *Py_UNUSED(ignored)) 379 { 380 return _io_TextIOWrapper_seekable_impl(self); 381 } 382 383 PyDoc_STRVAR(_io_TextIOWrapper_readable__doc__, 384 "readable($self, /)\n" 385 "--\n" 386 "\n"); 387 388 #define _IO_TEXTIOWRAPPER_READABLE_METHODDEF \ 389 {"readable", (PyCFunction)_io_TextIOWrapper_readable, METH_NOARGS, _io_TextIOWrapper_readable__doc__}, 390 391 static PyObject * 392 _io_TextIOWrapper_readable_impl(textio *self); 393 394 static PyObject * 395 _io_TextIOWrapper_readable(textio *self, PyObject *Py_UNUSED(ignored)) 396 { 397 return _io_TextIOWrapper_readable_impl(self); 398 } 399 400 PyDoc_STRVAR(_io_TextIOWrapper_writable__doc__, 401 "writable($self, /)\n" 402 "--\n" 403 "\n"); 404 405 #define _IO_TEXTIOWRAPPER_WRITABLE_METHODDEF \ 406 {"writable", (PyCFunction)_io_TextIOWrapper_writable, METH_NOARGS, _io_TextIOWrapper_writable__doc__}, 407 408 static PyObject * 409 _io_TextIOWrapper_writable_impl(textio *self); 410 411 static PyObject * 412 _io_TextIOWrapper_writable(textio *self, PyObject *Py_UNUSED(ignored)) 413 { 414 return _io_TextIOWrapper_writable_impl(self); 415 } 416 417 PyDoc_STRVAR(_io_TextIOWrapper_isatty__doc__, 418 "isatty($self, /)\n" 419 "--\n" 420 "\n"); 421 422 #define _IO_TEXTIOWRAPPER_ISATTY_METHODDEF \ 423 {"isatty", (PyCFunction)_io_TextIOWrapper_isatty, METH_NOARGS, _io_TextIOWrapper_isatty__doc__}, 424 425 static PyObject * 426 _io_TextIOWrapper_isatty_impl(textio *self); 427 428 static PyObject * 429 _io_TextIOWrapper_isatty(textio *self, PyObject *Py_UNUSED(ignored)) 430 { 431 return _io_TextIOWrapper_isatty_impl(self); 432 } 433 434 PyDoc_STRVAR(_io_TextIOWrapper_flush__doc__, 435 "flush($self, /)\n" 436 "--\n" 437 "\n"); 438 439 #define _IO_TEXTIOWRAPPER_FLUSH_METHODDEF \ 440 {"flush", (PyCFunction)_io_TextIOWrapper_flush, METH_NOARGS, _io_TextIOWrapper_flush__doc__}, 441 442 static PyObject * 443 _io_TextIOWrapper_flush_impl(textio *self); 444 445 static PyObject * 446 _io_TextIOWrapper_flush(textio *self, PyObject *Py_UNUSED(ignored)) 447 { 448 return _io_TextIOWrapper_flush_impl(self); 449 } 450 451 PyDoc_STRVAR(_io_TextIOWrapper_close__doc__, 452 "close($self, /)\n" 453 "--\n" 454 "\n"); 455 456 #define _IO_TEXTIOWRAPPER_CLOSE_METHODDEF \ 457 {"close", (PyCFunction)_io_TextIOWrapper_close, METH_NOARGS, _io_TextIOWrapper_close__doc__}, 458 459 static PyObject * 460 _io_TextIOWrapper_close_impl(textio *self); 461 462 static PyObject * 463 _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored)) 464 { 465 return _io_TextIOWrapper_close_impl(self); 466 } 467 /*[clinic end generated code: output=78ad14eba1667254 input=a9049054013a1b77]*/ 468