Kaydet (Commit) e76b7a8f authored tarafından Guido van Rossum's avatar Guido van Rossum

Added fnmatch, base64 and quopri, received from Andrew Kuchling.

üst 8be9a116
......@@ -114,7 +114,8 @@ LIBFILES = lib.tex \
librestricted.tex librexec.tex libbastion.tex \
libformatter.tex liboperator.tex libsoundex.tex libresource.tex \
libstat.tex libstrio.tex libundoc.tex libmailcap.tex libglob.tex \
libuser.tex libanydbm.tex librandom.tex libsite.tex libwhichdb.tex
libuser.tex libanydbm.tex librandom.tex libsite.tex libwhichdb.tex \
libbase64.tex libfnmatch.tex libquopri.tex
# Library document
lib.dvi: $(LIBFILES)
......
......@@ -112,6 +112,7 @@ to Python and how to embed it in other applications.
\input{libtempfile}
\input{liberrno}
\input{libglob}
\input{libfnmatch}
\input{libsomeos} % Optional Operating System Services
\input{libsignal}
......@@ -156,6 +157,8 @@ to Python and how to embed it in other applications.
\input{libbinascii}
\input{libxdrlib}
\input{libmailcap}
\input{libbase64}
\input{libquopri}
\input{librestricted}
\input{librexec}
......
......@@ -112,6 +112,7 @@ to Python and how to embed it in other applications.
\input{libtempfile}
\input{liberrno}
\input{libglob}
\input{libfnmatch}
\input{libsomeos} % Optional Operating System Services
\input{libsignal}
......@@ -156,6 +157,8 @@ to Python and how to embed it in other applications.
\input{libbinascii}
\input{libxdrlib}
\input{libmailcap}
\input{libbase64}
\input{libquopri}
\input{librestricted}
\input{librexec}
......
......@@ -26,4 +26,7 @@ systems as well. Here's an overview:
\item[glob]
--- Unix shell style pathname pattern expansion.
\item[fnmatch]
--- Unix shell style pathname pattern matching.
\end{description}
\section{Standard Module \sectcode{base64}}
\stmodindex{base64}
This module perform base-64 encoding and decoding of arbitrary binary
strings into text strings that can be safely emailed or posted. The
encoding scheme is defined in RFC 1421 and is used for MIME email and
various other Internet-related applications; it is not the same as the
output produced by the \file{uuencode} program. For example, the
string \code{'www.python.org'} is encoded as the string
\code{'d3d3LnB5dGhvbi5vcmc=\e n'}.
\indexii{base-64}{encoding}
\indexii{RFC}{1421}
\index{MIME, base 64 encoding}
\begin{funcdesc}{decode}{input\, output}
Decode the contents of the \var{input} file and write the resulting
binary data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
\begin{funcdesc}{decodestring}{s}
Decode the string \var{s}, which must contain one or more lines of
base-64 encoded data, and return a string containing the resulting
binary data.
\end{funcdesc}
\begin{funcdesc}{encode}{input\, output}
Encode the contents of the \var{input} file and write the resulting
base-64 encoded data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
\begin{funcdesc}{encodestring}{s}
Encode the string \var{s}, which can contain arbitrary binary data,
and return a string containing one or more lines of
base-64 encoded data.
\end{funcdesc}
\section{Standard Module \sectcode{fnmatch}}
\stmodindex{fnmatch}
This module provides support for Unix shell-style wildcards, which are
\emph{not} the same as Python's regular expressions (which are
documented in the \code{regex} module). The special characters used
in shell-style wildcards are:
\begin{itemize}
\item[\code{*}] matches everything
\item[\code{?}] matches any single character
\item[\code{[}\var{seq}\code{]}] matches any character in \var{seq}
\item[\code{[!}\var{seq}\code{]}] matches any character not in \var{seq}
\end{itemize}
Note that the filename separator (\code{'/'} on Unix) is \emph{not}
special to this module. See module \code{glob} for pathname expansion
(\code{glob} uses \code{fnmatch} to match filename segments).
\begin{funcdesc}{fnmatch}{filename\, pattern}
Test whether the \var{filename} string matches the \var{pattern}
string, returning true or false. If the operating system is
case-insensitive, then both parameters will be normalized to all
lower- or upper-case before the comparision is performed. If you
require a case-sensitive comparision regardless of whether that's
standard for your operating system, use \code{fnmatchcase()} instead.
\end{funcdesc}
\begin{funcdesc}{fnmatchcase}{}
Test whether \var{filename} matches \var{pattern}, returning true or
false; the comparision is case-sensitive.
\end{funcdesc}
\begin{funcdesc}{translate}{pattern}
Translate a shell pattern into a corresponding regular expression,
returning a string describing the pattern. It does not compile the
expression.
\end{funcdesc}
\section{Standard Module \sectcode{quopri}}
\stmodindex{quopri}
This module performs quoted-printable transport encoding and decoding,
as defined in RFC 1521: ``MIME (Multipurpose Internet Mail Extensions)
Part One''. The quoted-printable encoding is designed for data where
there are relatively few nonprintable characters; the base-64 encoding
scheme available via the \code{base64} module is more compact if there
are many such characters, as when sending a graphics file.
\indexii{quoted printable}{encoding}
\indexii{RFC}{1521}
\index{MIME!quoted-printable encoding}
\begin{funcdesc}{decode}{input\, output}
Decode the contents of the \var{input} file and write the resulting
decoded binary data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
\begin{funcdesc}{encode}{input\, output\, quotetabs}
Encode the contents of the \var{input} file and write the resulting
quoted-printable data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
......@@ -68,4 +68,10 @@ written by Sun Microsystems, Inc. June 1987.
\item[mailcap]
--- Mailcap file handling. See RFC 1524.
\item[base64]
--- Encode/decode binary files using the MIME base64 encoding.
\item[quopri]
--- Encode/decode binary files using the MIME quoted-printable encoding.
\end{description}
......@@ -26,4 +26,7 @@ systems as well. Here's an overview:
\item[glob]
--- Unix shell style pathname pattern expansion.
\item[fnmatch]
--- Unix shell style pathname pattern matching.
\end{description}
\section{Standard Module \sectcode{base64}}
\stmodindex{base64}
This module perform base-64 encoding and decoding of arbitrary binary
strings into text strings that can be safely emailed or posted. The
encoding scheme is defined in RFC 1421 and is used for MIME email and
various other Internet-related applications; it is not the same as the
output produced by the \file{uuencode} program. For example, the
string \code{'www.python.org'} is encoded as the string
\code{'d3d3LnB5dGhvbi5vcmc=\e n'}.
\indexii{base-64}{encoding}
\indexii{RFC}{1421}
\index{MIME, base 64 encoding}
\begin{funcdesc}{decode}{input\, output}
Decode the contents of the \var{input} file and write the resulting
binary data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
\begin{funcdesc}{decodestring}{s}
Decode the string \var{s}, which must contain one or more lines of
base-64 encoded data, and return a string containing the resulting
binary data.
\end{funcdesc}
\begin{funcdesc}{encode}{input\, output}
Encode the contents of the \var{input} file and write the resulting
base-64 encoded data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
\begin{funcdesc}{encodestring}{s}
Encode the string \var{s}, which can contain arbitrary binary data,
and return a string containing one or more lines of
base-64 encoded data.
\end{funcdesc}
\section{Standard Module \sectcode{fnmatch}}
\stmodindex{fnmatch}
This module provides support for Unix shell-style wildcards, which are
\emph{not} the same as Python's regular expressions (which are
documented in the \code{regex} module). The special characters used
in shell-style wildcards are:
\begin{itemize}
\item[\code{*}] matches everything
\item[\code{?}] matches any single character
\item[\code{[}\var{seq}\code{]}] matches any character in \var{seq}
\item[\code{[!}\var{seq}\code{]}] matches any character not in \var{seq}
\end{itemize}
Note that the filename separator (\code{'/'} on Unix) is \emph{not}
special to this module. See module \code{glob} for pathname expansion
(\code{glob} uses \code{fnmatch} to match filename segments).
\begin{funcdesc}{fnmatch}{filename\, pattern}
Test whether the \var{filename} string matches the \var{pattern}
string, returning true or false. If the operating system is
case-insensitive, then both parameters will be normalized to all
lower- or upper-case before the comparision is performed. If you
require a case-sensitive comparision regardless of whether that's
standard for your operating system, use \code{fnmatchcase()} instead.
\end{funcdesc}
\begin{funcdesc}{fnmatchcase}{}
Test whether \var{filename} matches \var{pattern}, returning true or
false; the comparision is case-sensitive.
\end{funcdesc}
\begin{funcdesc}{translate}{pattern}
Translate a shell pattern into a corresponding regular expression,
returning a string describing the pattern. It does not compile the
expression.
\end{funcdesc}
\section{Standard Module \sectcode{quopri}}
\stmodindex{quopri}
This module performs quoted-printable transport encoding and decoding,
as defined in RFC 1521: ``MIME (Multipurpose Internet Mail Extensions)
Part One''. The quoted-printable encoding is designed for data where
there are relatively few nonprintable characters; the base-64 encoding
scheme available via the \code{base64} module is more compact if there
are many such characters, as when sending a graphics file.
\indexii{quoted printable}{encoding}
\indexii{RFC}{1521}
\index{MIME!quoted-printable encoding}
\begin{funcdesc}{decode}{input\, output}
Decode the contents of the \var{input} file and write the resulting
decoded binary data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
\begin{funcdesc}{encode}{input\, output\, quotetabs}
Encode the contents of the \var{input} file and write the resulting
quoted-printable data to the \var{output} file.
\var{input} and \var{output} must either be file objects or objects that
mimic the file object interface. \var{input} will be read until
\code{\var{input}.read()} returns an empty string.
\end{funcdesc}
......@@ -68,4 +68,10 @@ written by Sun Microsystems, Inc. June 1987.
\item[mailcap]
--- Mailcap file handling. See RFC 1524.
\item[base64]
--- Encode/decode binary files using the MIME base64 encoding.
\item[quopri]
--- Encode/decode binary files using the MIME quoted-printable encoding.
\end{description}
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