Lines Matching defs:file

88 "   I/O classes. open() uses the file's blksize (as obtained by os.stat) if\n"

182 "Open file and return a stream. Raise IOError upon failure.\n"
184 "file is either a text or byte string giving the name (and the path\n"
185 "if the file isn't in the current working directory) of the file to\n"
186 "be opened or an integer file descriptor of the file to be\n"
187 "wrapped. (If a file descriptor is given, it is closed when the\n"
190 "mode is an optional string that specifies the mode in which the file\n"
192 "mode. Other common values are 'w' for writing (truncating the file if\n"
194 "means that all writes append to the end of the file regardless of the\n"
204 "'w' open for writing, truncating the file first\n"
205 "'a' open for writing, appending to the end of the file if it exists\n"
208 "'+' open a disk file for updating (reading and writing)\n"
214 "access, the mode 'w+b' opens and truncates the file to 0 bytes, while\n"
215 "'r+b' opens the file without truncation.\n"
221 "'t' is appended to the mode argument), the contents of the file are\n"
241 "file. This should only be used in text mode. The default encoding is\n"
271 "If closefd is False, the underlying file descriptor will be kept open\n"
272 "when the file is closed. This does not work when a file name is given\n"
275 "open() returns a file object whose type depends on the mode, and\n"
276 "through which the standard file operations such as reading and writing\n"
277 "are performed. When open() is used to open a file in a text mode ('w',\n"
279 "a file in a binary mode, the returned class varies: in read binary\n"
284 "It is also possible to use a string or bytearray as a file for both\n"
285 "reading and writing. For strings StringIO can be used like a file\n"
286 "opened in a text mode, and for bytes a BytesIO can be used like a file\n"
293 char *kwlist[] = {"file", "mode", "buffering",
296 PyObject *file;
312 &file, &mode, &buffering,
318 if (!PyUnicode_Check(file) &&
319 !PyBytes_Check(file) &&
320 !PyNumber_Check(file)) {
321 PyObject *repr = PyObject_Repr(file);
323 PyErr_Format(PyExc_TypeError, "invalid file: %s",
417 /* Create the Raw file stream */
419 "Osi", file, rawmode, closefd);
472 /* if not buffering, returns the raw file object */
484 /* wraps into a buffered file */
508 /* if binary, returns the buffered file */