Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
efc3a3af
Kaydet (Commit)
efc3a3af
authored
Eyl 20, 2001
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF bug [#463093] File methods need doc strings.
Now they don't.
üst
c88425e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
14 deletions
+94
-14
fileobject.c
Objects/fileobject.c
+94
-14
No files found.
Objects/fileobject.c
Dosyayı görüntüle @
efc3a3af
...
...
@@ -1281,23 +1281,103 @@ file_writelines(PyFileObject *f, PyObject *args)
return
result
;
}
static
char
readline_doc
[]
=
"readline([size]) -> next line from the file, as a string.
\n
"
"
\n
"
"Retain newline. A non-negative size argument limits the maximum
\n
"
"number of bytes to return (an incomplete line may be returned then).
\n
"
"Return an empty string at EOF."
;
static
char
read_doc
[]
=
"read([size]) -> read at most size bytes, returned as a string.
\n
"
"
\n
"
"If the size argument is negative or omitted, read until EOF is reached."
;
static
char
write_doc
[]
=
"write(str) -> None. Write string str to file.
\n
"
"
\n
"
"Note that due to buffering, flush() or close() may be needed before
\n
"
"the file on disk reflects the data written."
;
static
char
fileno_doc
[]
=
"fileno() -> integer
\"
file descriptor
\"
.
\n
"
"
\n
"
"This is needed for lower-level file interfaces, such os.read()."
;
static
char
seek_doc
[]
=
"seek(offset[, whence]) -> None. Move to new file position.
\n
"
"
\n
"
"Argument offset is a byte count. Optional argument whence defaults to
\n
"
"0 (offset from start of file, offset should be >= 0); other values are 1
\n
"
"(move relative to current position, positive or negative), and 2 (move
\n
"
"relative to end of file, usually negative, although many platforms allow
\n
"
"seeking beyond the end of a file).
\n
"
"
\n
"
"Note that not all file objects are seekable."
;
#ifdef HAVE_FTRUNCATE
static
char
truncate_doc
[]
=
"truncate([size]) -> None. Truncate the file to at most size bytes.
\n
"
"
\n
"
"Size defaults to the current file position, as returned by tell()."
;
#endif
static
char
tell_doc
[]
=
"tell() -> current file position, an integer (may be a long integer)."
;
static
char
readinto_doc
[]
=
"readinto() -> Undocumented. Don't use this; it may go away."
;
static
char
readlines_doc
[]
=
"readlines([size]) -> list of strings, each a line from the file.
\n
"
"
\n
"
"Call readline() repeatedly and return a list of the lines so read.
\n
"
"The optional size argument, if given, is an approximate bound on the
\n
"
"total number of bytes in the lines returned."
;
static
char
xreadlines_doc
[]
=
"xreadlines() -> next line from the file, as a string.
\n
"
"
\n
"
"Equivalent to xreadlines.xreadlines(file). This is like readline(), but
\n
"
"often quicker, due to reading ahead internally."
;
static
char
writelines_doc
[]
=
"writelines(list of strings) -> None. Write the strings to the file.
\n
"
"
\n
"
"Note that newlines are not added. This is equivalent to calling write()
\n
"
"for each string in the list."
;
static
char
flush_doc
[]
=
"flush() -> None. Flush the internal I/O buffer."
;
static
char
close_doc
[]
=
"close() -> None or (perhaps) an integer. Close the file.
\n
"
"
\n
"
"Sets data attribute .closed to true. A closed file cannot be used for
\n
"
"further I/O operations. close() may be called more than once without
\n
"
"error. Some kinds of file objects (for example, opened by popen())
\n
"
"may return an exit status upon closing."
;
static
char
isatty_doc
[]
=
"isatty() -> true or false. True if the file is connected to a tty device."
;
static
PyMethodDef
file_methods
[]
=
{
{
"readline"
,
(
PyCFunction
)
file_readline
,
METH_VARARGS
},
{
"read"
,
(
PyCFunction
)
file_read
,
METH_VARARGS
},
{
"write"
,
(
PyCFunction
)
file_write
,
METH_OLDARGS
},
{
"fileno"
,
(
PyCFunction
)
file_fileno
,
METH_NOARGS
},
{
"seek"
,
(
PyCFunction
)
file_seek
,
METH_VARARGS
},
{
"readline"
,
(
PyCFunction
)
file_readline
,
METH_VARARGS
,
readline_doc
},
{
"read"
,
(
PyCFunction
)
file_read
,
METH_VARARGS
,
read_doc
},
{
"write"
,
(
PyCFunction
)
file_write
,
METH_OLDARGS
,
write_doc
},
{
"fileno"
,
(
PyCFunction
)
file_fileno
,
METH_NOARGS
,
fileno_doc
},
{
"seek"
,
(
PyCFunction
)
file_seek
,
METH_VARARGS
,
seek_doc
},
#ifdef HAVE_FTRUNCATE
{
"truncate"
,
(
PyCFunction
)
file_truncate
,
METH_VARARGS
},
{
"truncate"
,
(
PyCFunction
)
file_truncate
,
METH_VARARGS
,
truncate_doc
},
#endif
{
"tell"
,
(
PyCFunction
)
file_tell
,
METH_NOARGS
},
{
"readinto"
,
(
PyCFunction
)
file_readinto
,
METH_OLDARGS
},
{
"readlines"
,
(
PyCFunction
)
file_readlines
,
METH_VARARGS
},
{
"xreadlines"
,
(
PyCFunction
)
file_xreadlines
,
METH_NOARGS
},
{
"writelines"
,
(
PyCFunction
)
file_writelines
,
METH_O
},
{
"flush"
,
(
PyCFunction
)
file_flush
,
METH_NOARGS
},
{
"close"
,
(
PyCFunction
)
file_close
,
METH_NOARGS
},
{
"isatty"
,
(
PyCFunction
)
file_isatty
,
METH_NOARGS
},
{
"tell"
,
(
PyCFunction
)
file_tell
,
METH_NOARGS
,
tell_doc
},
{
"readinto"
,
(
PyCFunction
)
file_readinto
,
METH_OLDARGS
,
readinto_doc
},
{
"readlines"
,
(
PyCFunction
)
file_readlines
,
METH_VARARGS
,
readlines_doc
},
{
"xreadlines"
,
(
PyCFunction
)
file_xreadlines
,
METH_NOARGS
,
xreadlines_doc
},
{
"writelines"
,
(
PyCFunction
)
file_writelines
,
METH_O
,
writelines_doc
},
{
"flush"
,
(
PyCFunction
)
file_flush
,
METH_NOARGS
,
flush_doc
},
{
"close"
,
(
PyCFunction
)
file_close
,
METH_NOARGS
,
close_doc
},
{
"isatty"
,
(
PyCFunction
)
file_isatty
,
METH_NOARGS
,
isatty_doc
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment