@@ -91,7 +91,7 @@ The :mod:`bz2` module contains:
91
91
and :meth: `~io.IOBase.truncate `.
92
92
Iteration and the :keyword: `with ` statement are supported.
93
93
94
- :class: `BZ2File ` also provides the following method :
94
+ :class: `BZ2File ` also provides the following methods :
95
95
96
96
.. method :: peek([n])
97
97
@@ -106,14 +106,52 @@ The :mod:`bz2` module contains:
106
106
107
107
.. versionadded :: 3.3
108
108
109
+ .. method :: fileno()
110
+
111
+ Return the file descriptor for the underlying file.
112
+
113
+ .. versionadded :: 3.3
114
+
115
+ .. method :: readable()
116
+
117
+ Return whether the file was opened for reading.
118
+
119
+ .. versionadded :: 3.3
120
+
121
+ .. method :: seekable()
122
+
123
+ Return whether the file supports seeking.
124
+
125
+ .. versionadded :: 3.3
126
+
127
+ .. method :: writable()
128
+
129
+ Return whether the file was opened for writing.
130
+
131
+ .. versionadded :: 3.3
132
+
133
+ .. method :: read1(size=-1)
134
+
135
+ Read up to *size * uncompressed bytes, while trying to avoid
136
+ making multiple reads from the underlying stream. Reads up to a
137
+ buffer's worth of data if size is negative.
138
+
139
+ Returns ``b'' `` if the file is at EOF.
140
+
141
+ .. versionadded :: 3.3
142
+
143
+ .. method :: readinto(b)
144
+
145
+ Read bytes into *b *.
146
+
147
+ Returns the number of bytes read (0 for EOF).
148
+
149
+ .. versionadded :: 3.3
150
+
109
151
110
152
.. versionchanged :: 3.1
111
153
Support for the :keyword: `with ` statement was added.
112
154
113
- .. versionchanged :: 3.3
114
- The :meth: `fileno `, :meth: `readable `, :meth: `seekable `, :meth: `writable `,
115
- :meth: `read1 ` and :meth: `readinto ` methods were added.
116
-
117
155
.. versionchanged :: 3.3
118
156
Support was added for *filename * being a :term: `file object ` instead of an
119
157
actual filename.
0 commit comments