Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7096760

Browse files
committed
Get rid of xreadlines() (methods).
1 parent 7c30724 commit 7096760

11 files changed

Lines changed: 9 additions & 47 deletions

File tree

Doc/lib/libbz2.tex

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,6 @@ \subsection{(De)compression of files}
7979
is an approximate bound on the total number of bytes in the lines returned.
8080
\end{methoddesc}
8181

82-
\begin{methoddesc}[BZ2File]{xreadlines}{}
83-
For backward compatibility. \class{BZ2File} objects now include the
84-
performance optimizations previously implemented in the
85-
\module{xreadlines} module.
86-
\deprecated{2.3}{This exists only for compatibility with the method by
87-
this name on \class{file} objects, which is
88-
deprecated. Use \code{for line in file} instead.}
89-
\end{methoddesc}
90-
9182
\begin{methoddesc}[BZ2File]{seek}{offset\optional{, whence}}
9283
Move to new file position. Argument \var{offset} is a byte count. Optional
9384
argument \var{whence} defaults to \code{0} (offset from start of file,

Doc/lib/libstdtypes.tex

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,12 +1583,6 @@ \subsection{File Objects
15831583
implemented, or cannot be implemented efficiently.
15841584
\end{methoddesc}
15851585

1586-
\begin{methoddesc}[file]{xreadlines}{}
1587-
This method returns the same thing as \code{iter(f)}.
1588-
\versionadded{2.1}
1589-
\deprecated{2.3}{Use \samp{for \var{line} in \var{file}} instead.}
1590-
\end{methoddesc}
1591-
15921586
\begin{methoddesc}[file]{seek}{offset\optional{, whence}}
15931587
Set the file's current position, like \code{stdio}'s \cfunction{fseek()}.
15941588
The \var{whence} argument is optional and defaults to \code{0}

Doc/tools/undoc_symbols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
def findnames(file, prefixes=()):
5252
names = {}
53-
for line in file.xreadlines():
53+
for line in file:
5454
if line[0] == '!':
5555
continue
5656
fields = line.split()

Lib/rexec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
class FileBase:
3030

3131
ok_file_methods = ('fileno', 'flush', 'isatty', 'read', 'readline',
32-
'readlines', 'seek', 'tell', 'write', 'writelines', 'xreadlines',
32+
'readlines', 'seek', 'tell', 'write', 'writelines',
3333
'__iter__')
3434

3535

Lib/test/test_bz2.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,6 @@ def testIterator(self):
110110
self.assertEqual(list(iter(bz2f)), sio.readlines())
111111
bz2f.close()
112112

113-
def testXReadLines(self):
114-
# "Test BZ2File.xreadlines()"
115-
self.createTempFile()
116-
bz2f = BZ2File(self.filename)
117-
sio = StringIO(self.TEXT)
118-
self.assertEqual(list(bz2f.xreadlines()), sio.readlines())
119-
bz2f.close()
120-
121113
def testUniversalNewlinesLF(self):
122114
# "Test BZ2File.read() with universal newlines (\\n)"
123115
self.createTempFile()
@@ -256,7 +248,7 @@ def testBug1191043(self):
256248
bz2f.close()
257249
self.assertEqual(lines, ['Test'])
258250
bz2f = BZ2File(self.filename)
259-
xlines = list(bz2f.xreadlines())
251+
xlines = list(bz2f.readlines())
260252
bz2f.close()
261253
self.assertEqual(lines, ['Test'])
262254

Lib/test/test_decimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def eval_file(self, file):
132132
if skip_expected:
133133
raise TestSkipped
134134
return
135-
for line in open(file).xreadlines():
135+
for line in open(file):
136136
line = line.replace('\r\n', '').replace('\n', '')
137137
#print line
138138
try:

Lib/test/test_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class NonString: pass
179179

180180
methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readinto',
181181
'readline', 'readlines', 'seek', 'tell', 'truncate', 'write',
182-
'xreadlines', '__iter__']
182+
'__iter__']
183183
if sys.platform.startswith('atheos'):
184184
methods.remove('truncate')
185185

Misc/python.man

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ expressed in spaces. Issue an error when the option is given twice.
152152
.B \-u
153153
Force stdin, stdout and stderr to be totally unbuffered. On systems
154154
where it matters, also put stdin, stdout and stderr in binary mode.
155-
Note that there is internal buffering in xreadlines(), readlines() and
155+
Note that there is internal buffering in readlines() and
156156
file-object iterators ("for line in sys.stdin") which is not
157157
influenced by this option. To work around this, you will want to use
158158
"sys.stdin.readline()" inside a "while 1:" loop.

Modules/bz2module.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,6 @@ BZ2File_readlines(BZ2FileObject *self, PyObject *args)
778778
return list;
779779
}
780780

781-
PyDoc_STRVAR(BZ2File_xreadlines__doc__,
782-
"xreadlines() -> self\n\
783-
\n\
784-
For backward compatibility. BZ2File objects now include the performance\n\
785-
optimizations previously implemented in the xreadlines module.\n\
786-
");
787-
788781
PyDoc_STRVAR(BZ2File_write__doc__,
789782
"write(data) -> None\n\
790783
\n\
@@ -1183,7 +1176,6 @@ static PyMethodDef BZ2File_methods[] = {
11831176
{"read", (PyCFunction)BZ2File_read, METH_VARARGS, BZ2File_read__doc__},
11841177
{"readline", (PyCFunction)BZ2File_readline, METH_VARARGS, BZ2File_readline__doc__},
11851178
{"readlines", (PyCFunction)BZ2File_readlines, METH_VARARGS, BZ2File_readlines__doc__},
1186-
{"xreadlines", (PyCFunction)BZ2File_getiter, METH_VARARGS, BZ2File_xreadlines__doc__},
11871179
{"write", (PyCFunction)BZ2File_write, METH_VARARGS, BZ2File_write__doc__},
11881180
{"writelines", (PyCFunction)BZ2File_writelines, METH_O, BZ2File_writelines__doc__},
11891181
{"seek", (PyCFunction)BZ2File_seek, METH_VARARGS, BZ2File_seek__doc__},

Objects/fileobject.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,12 +1675,6 @@ PyDoc_STRVAR(readlines_doc,
16751675
"The optional size argument, if given, is an approximate bound on the\n"
16761676
"total number of bytes in the lines returned.");
16771677

1678-
PyDoc_STRVAR(xreadlines_doc,
1679-
"xreadlines() -> returns self.\n"
1680-
"\n"
1681-
"For backward compatibility. File objects now include the performance\n"
1682-
"optimizations previously implemented in the xreadlines module.");
1683-
16841678
PyDoc_STRVAR(writelines_doc,
16851679
"writelines(sequence_of_strings) -> None. Write the strings to the file.\n"
16861680
"\n"
@@ -1719,7 +1713,6 @@ static PyMethodDef file_methods[] = {
17191713
{"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc},
17201714
{"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc},
17211715
{"readlines", (PyCFunction)file_readlines,METH_VARARGS, readlines_doc},
1722-
{"xreadlines",(PyCFunction)file_self, METH_NOARGS, xreadlines_doc},
17231716
{"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc},
17241717
{"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc},
17251718
{"close", (PyCFunction)file_close, METH_NOARGS, close_doc},

0 commit comments

Comments
 (0)