From e76b7a8fcd769c4204a7f0e0438dce482fa32015 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 27 Apr 1997 21:25:52 +0000 Subject: Added fnmatch, base64 and quopri, received from Andrew Kuchling. --- Doc/Makefile | 3 ++- Doc/lib.tex | 3 +++ Doc/lib/lib.tex | 3 +++ Doc/lib/liballos.tex | 3 +++ Doc/lib/libbase64.tex | 43 +++++++++++++++++++++++++++++++++++++++++++ Doc/lib/libfnmatch.tex | 38 ++++++++++++++++++++++++++++++++++++++ Doc/lib/libquopri.tex | 31 +++++++++++++++++++++++++++++++ Doc/lib/libwww.tex | 6 ++++++ Doc/liballos.tex | 3 +++ Doc/libbase64.tex | 43 +++++++++++++++++++++++++++++++++++++++++++ Doc/libfnmatch.tex | 38 ++++++++++++++++++++++++++++++++++++++ Doc/libquopri.tex | 31 +++++++++++++++++++++++++++++++ Doc/libwww.tex | 6 ++++++ 13 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 Doc/lib/libbase64.tex create mode 100644 Doc/lib/libfnmatch.tex create mode 100644 Doc/lib/libquopri.tex create mode 100644 Doc/libbase64.tex create mode 100644 Doc/libfnmatch.tex create mode 100644 Doc/libquopri.tex diff --git a/Doc/Makefile b/Doc/Makefile index ebcfa12..bf2491c 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -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) diff --git a/Doc/lib.tex b/Doc/lib.tex index fd98bfa..f9e23aa 100644 --- a/Doc/lib.tex +++ b/Doc/lib.tex @@ -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} diff --git a/Doc/lib/lib.tex b/Doc/lib/lib.tex index fd98bfa..f9e23aa 100644 --- a/Doc/lib/lib.tex +++ b/Doc/lib/lib.tex @@ -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} diff --git a/Doc/lib/liballos.tex b/Doc/lib/liballos.tex index 5cf7f94..2a536cd 100644 --- a/Doc/lib/liballos.tex +++ b/Doc/lib/liballos.tex @@ -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} diff --git a/Doc/lib/libbase64.tex b/Doc/lib/libbase64.tex new file mode 100644 index 0000000..c487576 --- /dev/null +++ b/Doc/lib/libbase64.tex @@ -0,0 +1,43 @@ +\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} + + diff --git a/Doc/lib/libfnmatch.tex b/Doc/lib/libfnmatch.tex new file mode 100644 index 0000000..78b21a4 --- /dev/null +++ b/Doc/lib/libfnmatch.tex @@ -0,0 +1,38 @@ +\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} + diff --git a/Doc/lib/libquopri.tex b/Doc/lib/libquopri.tex new file mode 100644 index 0000000..0314f8a --- /dev/null +++ b/Doc/lib/libquopri.tex @@ -0,0 +1,31 @@ +\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} + + + diff --git a/Doc/lib/libwww.tex b/Doc/lib/libwww.tex index aae20b2..93bce63 100644 --- a/Doc/lib/libwww.tex +++ b/Doc/lib/libwww.tex @@ -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} diff --git a/Doc/liballos.tex b/Doc/liballos.tex index 5cf7f94..2a536cd 100644 --- a/Doc/liballos.tex +++ b/Doc/liballos.tex @@ -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} diff --git a/Doc/libbase64.tex b/Doc/libbase64.tex new file mode 100644 index 0000000..c487576 --- /dev/null +++ b/Doc/libbase64.tex @@ -0,0 +1,43 @@ +\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} + + diff --git a/Doc/libfnmatch.tex b/Doc/libfnmatch.tex new file mode 100644 index 0000000..78b21a4 --- /dev/null +++ b/Doc/libfnmatch.tex @@ -0,0 +1,38 @@ +\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} + diff --git a/Doc/libquopri.tex b/Doc/libquopri.tex new file mode 100644 index 0000000..0314f8a --- /dev/null +++ b/Doc/libquopri.tex @@ -0,0 +1,31 @@ +\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} + + + diff --git a/Doc/libwww.tex b/Doc/libwww.tex index aae20b2..93bce63 100644 --- a/Doc/libwww.tex +++ b/Doc/libwww.tex @@ -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} -- cgit v0.12