Commit 3fb1c1ce authored by Fred Drake's avatar Fred Drake

Fix a few minor nits. Still need to actually proofread this.

parent 0a222b78
...@@ -24,7 +24,7 @@ Here is a resume of the features offered by the bz2 module: ...@@ -24,7 +24,7 @@ Here is a resume of the features offered by the bz2 module:
\item \class{BZ2File} class offers an optimized line iteration using \item \class{BZ2File} class offers an optimized line iteration using
the readahead algorithm borrowed from file objects; the readahead algorithm borrowed from file objects;
\item \class{BZ2File} class developed inheriting builtin file type \item \class{BZ2File} class developed inheriting builtin file type
(\code{isinstance(BZ2File(), file) == 1}); (\code{issubclass(BZ2File, file)} is \code{True});
\item Sequential (de)compression supported by \class{BZ2Compressor} and \item Sequential (de)compression supported by \class{BZ2Compressor} and
\class{BZ2Decompressor} classes; \class{BZ2Decompressor} classes;
\item One-shot (de)compression supported by \function{compress()} and \item One-shot (de)compression supported by \function{compress()} and
...@@ -38,16 +38,18 @@ Here is a resume of the features offered by the bz2 module: ...@@ -38,16 +38,18 @@ Here is a resume of the features offered by the bz2 module:
Handling of compressed files is offered by the \class{BZ2File} class. Handling of compressed files is offered by the \class{BZ2File} class.
\begin{classdesc}{BZ2File}{filename \optional{, mode='r'\optional{, \begin{classdesc}{BZ2File}{filename\optional{, mode\optional{,
buffering=0\optional{, compresslevel=9}}}} buffering\optional{, compresslevel}}}}
Open a bz2 file. Mode can be either \code{'r'} or \code{'w'}, for reading Open a bz2 file. Mode can be either \code{'r'} or \code{'w'}, for reading
(default) or writing. When opened for writing, the file will be created if (default) or writing. When opened for writing, the file will be created if
it doesn't exist, and truncated otherwise. If the buffering argument is given, it doesn't exist, and truncated otherwise. If \var{buffering} is given,
\code{0} means unbuffered, and larger numbers specify the buffer size. If \code{0} means unbuffered, and larger numbers specify the buffer size;
compresslevel is given, must be a number between \code{1} and \code{9}. the default is \code{0}. If
\var{compresslevel} is given, must be a number between \code{1} and
\code{9}; the default is \code{9}.
Add a \code{'U'} to mode to open the file for input with universal newline Add a \code{'U'} to mode to open the file for input with universal newline
support. Any line ending in the input file will be seen as a support. Any line ending in the input file will be seen as a
\code{'\textbackslash n'} \character{\textbackslash n}
in Python. Also, a file so opened gains the attribute \member{newlines}; in Python. Also, a file so opened gains the attribute \member{newlines};
the value for this attribute is one of \code{None} (no newline read yet), the value for this attribute is one of \code{None} (no newline read yet),
\code{'\textbackslash r'}, \code{'\textbackslash n'}, \code{'\textbackslash r'}, \code{'\textbackslash n'},
...@@ -89,7 +91,7 @@ Iterate trough the file lines. Iteration optimization is implemented ...@@ -89,7 +91,7 @@ Iterate trough the file lines. Iteration optimization is implemented
using the same readahead algorithm available in \class{file} objects. using the same readahead algorithm available in \class{file} objects.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[BZ2File]{seek}{offset \optional{, whence}} \begin{methoddesc}[BZ2File]{seek}{offset\optional{, whence}}
Move to new file position. Argument \var{offset} is a byte count. Optional Move to new file position. Argument \var{offset} is a byte count. Optional
argument \var{whence} defaults to \code{0} (offset from start of file, argument \var{whence} defaults to \code{0} (offset from start of file,
offset should be \code{>= 0}); other values are \code{1} (move relative to offset should be \code{>= 0}); other values are \code{1} (move relative to
...@@ -122,11 +124,12 @@ to calling write() for each string. ...@@ -122,11 +124,12 @@ to calling write() for each string.
Sequential compression and decompression is done using the classes Sequential compression and decompression is done using the classes
\class{BZ2Compressor} and \class{BZ2Decompressor}. \class{BZ2Compressor} and \class{BZ2Decompressor}.
\begin{classdesc}{BZ2Compressor}{\optional{compresslevel=9}} \begin{classdesc}{BZ2Compressor}{\optional{compresslevel}}
Create a new compressor object. This object may be used to compress Create a new compressor object. This object may be used to compress
data sequentially. If you want to compress data in one shot, use the data sequentially. If you want to compress data in one shot, use the
\function{compress()} function instead. The \var{compresslevel} parameter, \function{compress()} function instead. The \var{compresslevel} parameter,
if given, must be a number between \code{1} and \code{9}. if given, must be a number between \code{1} and \code{9}; the default
is \code{9}.
\end{classdesc} \end{classdesc}
\begin{methoddesc}[BZ2Compressor]{compress}{data} \begin{methoddesc}[BZ2Compressor]{compress}{data}
...@@ -161,14 +164,14 @@ found after the end of stream, it'll be ignored and saved in ...@@ -161,14 +164,14 @@ found after the end of stream, it'll be ignored and saved in
One-shot compression and decompression is provided trough the One-shot compression and decompression is provided trough the
\function{compress()} and \function{decompress()} functions. \function{compress()} and \function{decompress()} functions.
\begin{funcdesc}{compress}{data\optional{, compresslevel=9}} \begin{funcdesc}{compress}{data\optional{, compresslevel}}
Compress \var{data} in one shot. If you want to compress data sequentially, Compress \var{data} in one shot. If you want to compress data sequentially,
use an instance of \class{BZ2Compressor} instead. The \var{compresslevel} use an instance of \class{BZ2Compressor} instead. The \var{compresslevel}
parameter, if given, must be a number between \code{1} and \code{9}. parameter, if given, must be a number between \code{1} and \code{9};
the default is \code{9}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{decompress}{} \begin{funcdesc}{decompress}{data}
Decompress \var{data} in one shot. If you want to decompress data Decompress \var{data} in one shot. If you want to decompress data
sequentially, use an instance of \class{BZ2Decompressor} instead. sequentially, use an instance of \class{BZ2Decompressor} instead.
\end{funcdesc} \end{funcdesc}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment