Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(_io_StringIO_getvalue__doc__, |
| 6 | "getvalue($self, /)\n" |
| 7 | "--\n" |
| 8 | "\n" |
| 9 | "Retrieve the entire contents of the object."); |
| 10 | |
| 11 | #define _IO_STRINGIO_GETVALUE_METHODDEF \ |
| 12 | {"getvalue", (PyCFunction)_io_StringIO_getvalue, METH_NOARGS, _io_StringIO_getvalue__doc__}, |
| 13 | |
| 14 | static PyObject * |
| 15 | _io_StringIO_getvalue_impl(stringio *self); |
| 16 | |
| 17 | static PyObject * |
| 18 | _io_StringIO_getvalue(stringio *self, PyObject *Py_UNUSED(ignored)) |
| 19 | { |
| 20 | return _io_StringIO_getvalue_impl(self); |
| 21 | } |
| 22 | |
| 23 | PyDoc_STRVAR(_io_StringIO_tell__doc__, |
| 24 | "tell($self, /)\n" |
| 25 | "--\n" |
| 26 | "\n" |
| 27 | "Tell the current file position."); |
| 28 | |
| 29 | #define _IO_STRINGIO_TELL_METHODDEF \ |
| 30 | {"tell", (PyCFunction)_io_StringIO_tell, METH_NOARGS, _io_StringIO_tell__doc__}, |
| 31 | |
| 32 | static PyObject * |
| 33 | _io_StringIO_tell_impl(stringio *self); |
| 34 | |
| 35 | static PyObject * |
| 36 | _io_StringIO_tell(stringio *self, PyObject *Py_UNUSED(ignored)) |
| 37 | { |
| 38 | return _io_StringIO_tell_impl(self); |
| 39 | } |
| 40 | |
| 41 | PyDoc_STRVAR(_io_StringIO_read__doc__, |
| 42 | "read($self, size=None, /)\n" |
| 43 | "--\n" |
| 44 | "\n" |
| 45 | "Read at most size characters, returned as a string.\n" |
| 46 | "\n" |
| 47 | "If the argument is negative or omitted, read until EOF\n" |
| 48 | "is reached. Return an empty string at EOF."); |
| 49 | |
| 50 | #define _IO_STRINGIO_READ_METHODDEF \ |
| 51 | {"read", (PyCFunction)_io_StringIO_read, METH_VARARGS, _io_StringIO_read__doc__}, |
| 52 | |
| 53 | static PyObject * |
| 54 | _io_StringIO_read_impl(stringio *self, PyObject *arg); |
| 55 | |
| 56 | static PyObject * |
| 57 | _io_StringIO_read(stringio *self, PyObject *args) |
| 58 | { |
| 59 | PyObject *return_value = NULL; |
| 60 | PyObject *arg = Py_None; |
| 61 | |
| 62 | if (!PyArg_UnpackTuple(args, "read", |
| 63 | 0, 1, |
| 64 | &arg)) |
| 65 | goto exit; |
| 66 | return_value = _io_StringIO_read_impl(self, arg); |
| 67 | |
| 68 | exit: |
| 69 | return return_value; |
| 70 | } |
| 71 | |
| 72 | PyDoc_STRVAR(_io_StringIO_readline__doc__, |
| 73 | "readline($self, size=None, /)\n" |
| 74 | "--\n" |
| 75 | "\n" |
| 76 | "Read until newline or EOF.\n" |
| 77 | "\n" |
| 78 | "Returns an empty string if EOF is hit immediately."); |
| 79 | |
| 80 | #define _IO_STRINGIO_READLINE_METHODDEF \ |
| 81 | {"readline", (PyCFunction)_io_StringIO_readline, METH_VARARGS, _io_StringIO_readline__doc__}, |
| 82 | |
| 83 | static PyObject * |
| 84 | _io_StringIO_readline_impl(stringio *self, PyObject *arg); |
| 85 | |
| 86 | static PyObject * |
| 87 | _io_StringIO_readline(stringio *self, PyObject *args) |
| 88 | { |
| 89 | PyObject *return_value = NULL; |
| 90 | PyObject *arg = Py_None; |
| 91 | |
| 92 | if (!PyArg_UnpackTuple(args, "readline", |
| 93 | 0, 1, |
| 94 | &arg)) |
| 95 | goto exit; |
| 96 | return_value = _io_StringIO_readline_impl(self, arg); |
| 97 | |
| 98 | exit: |
| 99 | return return_value; |
| 100 | } |
| 101 | |
| 102 | PyDoc_STRVAR(_io_StringIO_truncate__doc__, |
| 103 | "truncate($self, pos=None, /)\n" |
| 104 | "--\n" |
| 105 | "\n" |
| 106 | "Truncate size to pos.\n" |
| 107 | "\n" |
| 108 | "The pos argument defaults to the current file position, as\n" |
| 109 | "returned by tell(). The current file position is unchanged.\n" |
| 110 | "Returns the new absolute position."); |
| 111 | |
| 112 | #define _IO_STRINGIO_TRUNCATE_METHODDEF \ |
| 113 | {"truncate", (PyCFunction)_io_StringIO_truncate, METH_VARARGS, _io_StringIO_truncate__doc__}, |
| 114 | |
| 115 | static PyObject * |
| 116 | _io_StringIO_truncate_impl(stringio *self, PyObject *arg); |
| 117 | |
| 118 | static PyObject * |
| 119 | _io_StringIO_truncate(stringio *self, PyObject *args) |
| 120 | { |
| 121 | PyObject *return_value = NULL; |
| 122 | PyObject *arg = Py_None; |
| 123 | |
| 124 | if (!PyArg_UnpackTuple(args, "truncate", |
| 125 | 0, 1, |
| 126 | &arg)) |
| 127 | goto exit; |
| 128 | return_value = _io_StringIO_truncate_impl(self, arg); |
| 129 | |
| 130 | exit: |
| 131 | return return_value; |
| 132 | } |
| 133 | |
| 134 | PyDoc_STRVAR(_io_StringIO_seek__doc__, |
| 135 | "seek($self, pos, whence=0, /)\n" |
| 136 | "--\n" |
| 137 | "\n" |
| 138 | "Change stream position.\n" |
| 139 | "\n" |
| 140 | "Seek to character offset pos relative to position indicated by whence:\n" |
| 141 | " 0 Start of stream (the default). pos should be >= 0;\n" |
| 142 | " 1 Current position - pos must be 0;\n" |
| 143 | " 2 End of stream - pos must be 0.\n" |
| 144 | "Returns the new absolute position."); |
| 145 | |
| 146 | #define _IO_STRINGIO_SEEK_METHODDEF \ |
| 147 | {"seek", (PyCFunction)_io_StringIO_seek, METH_VARARGS, _io_StringIO_seek__doc__}, |
| 148 | |
| 149 | static PyObject * |
| 150 | _io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence); |
| 151 | |
| 152 | static PyObject * |
| 153 | _io_StringIO_seek(stringio *self, PyObject *args) |
| 154 | { |
| 155 | PyObject *return_value = NULL; |
| 156 | Py_ssize_t pos; |
| 157 | int whence = 0; |
| 158 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 159 | if (!PyArg_ParseTuple(args, "n|i:seek", |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 160 | &pos, &whence)) |
| 161 | goto exit; |
| 162 | return_value = _io_StringIO_seek_impl(self, pos, whence); |
| 163 | |
| 164 | exit: |
| 165 | return return_value; |
| 166 | } |
| 167 | |
| 168 | PyDoc_STRVAR(_io_StringIO_write__doc__, |
| 169 | "write($self, s, /)\n" |
| 170 | "--\n" |
| 171 | "\n" |
| 172 | "Write string to file.\n" |
| 173 | "\n" |
| 174 | "Returns the number of characters written, which is always equal to\n" |
| 175 | "the length of the string."); |
| 176 | |
| 177 | #define _IO_STRINGIO_WRITE_METHODDEF \ |
| 178 | {"write", (PyCFunction)_io_StringIO_write, METH_O, _io_StringIO_write__doc__}, |
| 179 | |
| 180 | PyDoc_STRVAR(_io_StringIO_close__doc__, |
| 181 | "close($self, /)\n" |
| 182 | "--\n" |
| 183 | "\n" |
| 184 | "Close the IO object.\n" |
| 185 | "\n" |
| 186 | "Attempting any further operation after the object is closed\n" |
| 187 | "will raise a ValueError.\n" |
| 188 | "\n" |
| 189 | "This method has no effect if the file is already closed."); |
| 190 | |
| 191 | #define _IO_STRINGIO_CLOSE_METHODDEF \ |
| 192 | {"close", (PyCFunction)_io_StringIO_close, METH_NOARGS, _io_StringIO_close__doc__}, |
| 193 | |
| 194 | static PyObject * |
| 195 | _io_StringIO_close_impl(stringio *self); |
| 196 | |
| 197 | static PyObject * |
| 198 | _io_StringIO_close(stringio *self, PyObject *Py_UNUSED(ignored)) |
| 199 | { |
| 200 | return _io_StringIO_close_impl(self); |
| 201 | } |
| 202 | |
| 203 | PyDoc_STRVAR(_io_StringIO___init____doc__, |
| 204 | "StringIO(initial_value=\'\', newline=\'\\n\')\n" |
| 205 | "--\n" |
| 206 | "\n" |
| 207 | "Text I/O implementation using an in-memory buffer.\n" |
| 208 | "\n" |
| 209 | "The initial_value argument sets the value of object. The newline\n" |
| 210 | "argument is like the one of TextIOWrapper\'s constructor."); |
| 211 | |
| 212 | static int |
| 213 | _io_StringIO___init___impl(stringio *self, PyObject *value, |
| 214 | PyObject *newline_obj); |
| 215 | |
| 216 | static int |
| 217 | _io_StringIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
| 218 | { |
| 219 | int return_value = -1; |
| 220 | static char *_keywords[] = {"initial_value", "newline", NULL}; |
| 221 | PyObject *value = NULL; |
| 222 | PyObject *newline_obj = NULL; |
| 223 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 224 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:StringIO", _keywords, |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 225 | &value, &newline_obj)) |
| 226 | goto exit; |
| 227 | return_value = _io_StringIO___init___impl((stringio *)self, value, newline_obj); |
| 228 | |
| 229 | exit: |
| 230 | return return_value; |
| 231 | } |
| 232 | |
| 233 | PyDoc_STRVAR(_io_StringIO_readable__doc__, |
| 234 | "readable($self, /)\n" |
| 235 | "--\n" |
| 236 | "\n" |
| 237 | "Returns True if the IO object can be read."); |
| 238 | |
| 239 | #define _IO_STRINGIO_READABLE_METHODDEF \ |
| 240 | {"readable", (PyCFunction)_io_StringIO_readable, METH_NOARGS, _io_StringIO_readable__doc__}, |
| 241 | |
| 242 | static PyObject * |
| 243 | _io_StringIO_readable_impl(stringio *self); |
| 244 | |
| 245 | static PyObject * |
| 246 | _io_StringIO_readable(stringio *self, PyObject *Py_UNUSED(ignored)) |
| 247 | { |
| 248 | return _io_StringIO_readable_impl(self); |
| 249 | } |
| 250 | |
| 251 | PyDoc_STRVAR(_io_StringIO_writable__doc__, |
| 252 | "writable($self, /)\n" |
| 253 | "--\n" |
| 254 | "\n" |
| 255 | "Returns True if the IO object can be written."); |
| 256 | |
| 257 | #define _IO_STRINGIO_WRITABLE_METHODDEF \ |
| 258 | {"writable", (PyCFunction)_io_StringIO_writable, METH_NOARGS, _io_StringIO_writable__doc__}, |
| 259 | |
| 260 | static PyObject * |
| 261 | _io_StringIO_writable_impl(stringio *self); |
| 262 | |
| 263 | static PyObject * |
| 264 | _io_StringIO_writable(stringio *self, PyObject *Py_UNUSED(ignored)) |
| 265 | { |
| 266 | return _io_StringIO_writable_impl(self); |
| 267 | } |
| 268 | |
| 269 | PyDoc_STRVAR(_io_StringIO_seekable__doc__, |
| 270 | "seekable($self, /)\n" |
| 271 | "--\n" |
| 272 | "\n" |
| 273 | "Returns True if the IO object can be seeked."); |
| 274 | |
| 275 | #define _IO_STRINGIO_SEEKABLE_METHODDEF \ |
| 276 | {"seekable", (PyCFunction)_io_StringIO_seekable, METH_NOARGS, _io_StringIO_seekable__doc__}, |
| 277 | |
| 278 | static PyObject * |
| 279 | _io_StringIO_seekable_impl(stringio *self); |
| 280 | |
| 281 | static PyObject * |
| 282 | _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored)) |
| 283 | { |
| 284 | return _io_StringIO_seekable_impl(self); |
| 285 | } |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 286 | /*[clinic end generated code: output=f061cf3a20cd14ed input=a9049054013a1b77]*/ |