@@ -24,7 +24,7 @@ \section{\module{bz2} ---
24
24
\item \class {BZ2File} class offers an optimized line iteration using
25
25
the readahead algorithm borrowed from file objects;
26
26
\item \class {BZ2File} class developed inheriting builtin file type
27
- (\code {isinstance (BZ2File() , file) == 1 });
27
+ (\code {issubclass (BZ2File, file)} is \code {True });
28
28
\item Sequential (de)compression supported by \class {BZ2Compressor} and
29
29
\class {BZ2Decompressor} classes;
30
30
\item One-shot (de)compression supported by \function {compress()} and
@@ -38,16 +38,18 @@ \subsection{(De)compression of files}
38
38
39
39
Handling of compressed files is offered by the \class {BZ2File} class.
40
40
41
- \begin {classdesc }{BZ2File}{filename \optional {, mode='r' \optional {,
42
- buffering=0 \optional {, compresslevel=9 }}}}
43
- Open a bz2 file. Mode can be either \code {'r'} or \code {'w'}, for reading
41
+ \begin {classdesc }{BZ2File}{filename\optional {, mode\optional {,
42
+ buffering\optional {, compresslevel}}}}
43
+ Open a bz2 file. Mode can be either \code {'r'} or \code {'w'}, for reading
44
44
(default) or writing. When opened for writing, the file will be created if
45
- it doesn't exist, and truncated otherwise. If the buffering argument is given,
46
- \code {0} means unbuffered, and larger numbers specify the buffer size. If
47
- compresslevel is given, must be a number between \code {1} and \code {9}.
45
+ it doesn't exist, and truncated otherwise. If \var {buffering} is given,
46
+ \code {0} means unbuffered, and larger numbers specify the buffer size;
47
+ the default is \code {0}. If
48
+ \var {compresslevel} is given, must be a number between \code {1} and
49
+ \code {9}; the default is \code {9}.
48
50
Add a \code {'U'} to mode to open the file for input with universal newline
49
51
support. Any line ending in the input file will be seen as a
50
- \code {' \textbackslash n' }
52
+ \character { \textbackslash n}
51
53
in Python. Also, a file so opened gains the attribute \member {newlines};
52
54
the value for this attribute is one of \code {None} (no newline read yet),
53
55
\code {'\textbackslash r'}, \code {'\textbackslash n'},
@@ -89,7 +91,7 @@ \subsection{(De)compression of files}
89
91
using the same readahead algorithm available in \class {file} objects.
90
92
\end {methoddesc }
91
93
92
- \begin {methoddesc }[BZ2File]{seek}{offset \optional {, whence}}
94
+ \begin {methoddesc }[BZ2File]{seek}{offset\optional {, whence}}
93
95
Move to new file position. Argument \var {offset} is a byte count. Optional
94
96
argument \var {whence} defaults to \code {0} (offset from start of file,
95
97
offset should be \code {>= 0}); other values are \code {1} (move relative to
@@ -122,11 +124,12 @@ \subsection{Sequential (de)compression}
122
124
Sequential compression and decompression is done using the classes
123
125
\class {BZ2Compressor} and \class {BZ2Decompressor}.
124
126
125
- \begin {classdesc }{BZ2Compressor}{\optional {compresslevel=9 }}
127
+ \begin {classdesc }{BZ2Compressor}{\optional {compresslevel}}
126
128
Create a new compressor object. This object may be used to compress
127
129
data sequentially. If you want to compress data in one shot, use the
128
130
\function {compress()} function instead. The \var {compresslevel} parameter,
129
- if given, must be a number between \code {1} and \code {9}.
131
+ if given, must be a number between \code {1} and \code {9}; the default
132
+ is \code {9}.
130
133
\end {classdesc }
131
134
132
135
\begin {methoddesc }[BZ2Compressor]{compress}{data}
@@ -161,14 +164,14 @@ \subsection{One-shot (de)compression}
161
164
One-shot compression and decompression is provided trough the
162
165
\function {compress()} and \function {decompress()} functions.
163
166
164
- \begin {funcdesc }{compress}{data\optional {, compresslevel=9 }}
167
+ \begin {funcdesc }{compress}{data\optional {, compresslevel}}
165
168
Compress \var {data} in one shot. If you want to compress data sequentially,
166
169
use an instance of \class {BZ2Compressor} instead. The \var {compresslevel}
167
- parameter, if given, must be a number between \code {1} and \code {9}.
170
+ parameter, if given, must be a number between \code {1} and \code {9};
171
+ the default is \code {9}.
168
172
\end {funcdesc }
169
173
170
- \begin {funcdesc }{decompress}{}
174
+ \begin {funcdesc }{decompress}{data }
171
175
Decompress \var {data} in one shot. If you want to decompress data
172
176
sequentially, use an instance of \class {BZ2Decompressor} instead.
173
177
\end {funcdesc }
174
-
0 commit comments