mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Lots of explicit class names for method and member descs.
This commit is contained in:
parent
b8e8df2e63
commit
ae91afdcfb
42 changed files with 489 additions and 489 deletions
|
@ -155,37 +155,37 @@ the \var{raw} parameter is false. This is relevant only for the
|
|||
|
||||
\class{RawConfigParser} instances have the following methods:
|
||||
|
||||
\begin{methoddesc}{defaults}{}
|
||||
\begin{methoddesc}[RawConfigParser]{defaults}{}
|
||||
Return a dictionary containing the instance-wide defaults.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{sections}{}
|
||||
\begin{methoddesc}[RawConfigParser]{sections}{}
|
||||
Return a list of the sections available; \code{DEFAULT} is not
|
||||
included in the list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{add_section}{section}
|
||||
\begin{methoddesc}[RawConfigParser]{add_section}{section}
|
||||
Add a section named \var{section} to the instance. If a section by
|
||||
the given name already exists, \exception{DuplicateSectionError} is
|
||||
raised.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{has_section}{section}
|
||||
\begin{methoddesc}[RawConfigParser]{has_section}{section}
|
||||
Indicates whether the named section is present in the
|
||||
configuration. The \code{DEFAULT} section is not acknowledged.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{options}{section}
|
||||
\begin{methoddesc}[RawConfigParser]{options}{section}
|
||||
Returns a list of options available in the specified \var{section}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{has_option}{section, option}
|
||||
\begin{methoddesc}[RawConfigParser]{has_option}{section, option}
|
||||
If the given section exists, and contains the given option,
|
||||
return \constant{True}; otherwise return \constant{False}.
|
||||
\versionadded{1.6}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read}{filenames}
|
||||
\begin{methoddesc}[RawConfigParser]{read}{filenames}
|
||||
Attempt to read and parse a list of filenames, returning a list of filenames
|
||||
which were successfully parsed. If \var{filenames} is a string or
|
||||
Unicode string, it is treated as a single filename.
|
||||
|
@ -210,28 +210,28 @@ config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')])
|
|||
\versionchanged[Returns list of successfully parsed filenames]{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{readfp}{fp\optional{, filename}}
|
||||
\begin{methoddesc}[RawConfigParser]{readfp}{fp\optional{, filename}}
|
||||
Read and parse configuration data from the file or file-like object in
|
||||
\var{fp} (only the \method{readline()} method is used). If
|
||||
\var{filename} is omitted and \var{fp} has a \member{name} attribute,
|
||||
that is used for \var{filename}; the default is \samp{<???>}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{get}{section, option}
|
||||
\begin{methoddesc}[RawConfigParser]{get}{section, option}
|
||||
Get an \var{option} value for the named \var{section}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getint}{section, option}
|
||||
\begin{methoddesc}[RawConfigParser]{getint}{section, option}
|
||||
A convenience method which coerces the \var{option} in the specified
|
||||
\var{section} to an integer.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getfloat}{section, option}
|
||||
\begin{methoddesc}[RawConfigParser]{getfloat}{section, option}
|
||||
A convenience method which coerces the \var{option} in the specified
|
||||
\var{section} to a floating point number.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getboolean}{section, option}
|
||||
\begin{methoddesc}[RawConfigParser]{getboolean}{section, option}
|
||||
A convenience method which coerces the \var{option} in the specified
|
||||
\var{section} to a Boolean value. Note that the accepted values
|
||||
for the option are \code{"1"}, \code{"yes"}, \code{"true"}, and \code{"on"},
|
||||
|
@ -241,12 +241,12 @@ string values are checked in a case-insensitive manner. Any other value will
|
|||
cause it to raise \exception{ValueError}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{items}{section}
|
||||
\begin{methoddesc}[RawConfigParser]{items}{section}
|
||||
Return a list of \code{(\var{name}, \var{value})} pairs for each
|
||||
option in the given \var{section}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set}{section, option, value}
|
||||
\begin{methoddesc}[RawConfigParser]{set}{section, option, value}
|
||||
If the given section exists, set the given option to the specified
|
||||
value; otherwise raise \exception{NoSectionError}. While it is
|
||||
possible to use \class{RawConfigParser} (or \class{ConfigParser} with
|
||||
|
@ -256,14 +256,14 @@ output to files) can only be achieved using string values.
|
|||
\versionadded{1.6}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{write}{fileobject}
|
||||
\begin{methoddesc}[RawConfigParser]{write}{fileobject}
|
||||
Write a representation of the configuration to the specified file
|
||||
object. This representation can be parsed by a future \method{read()}
|
||||
call.
|
||||
\versionadded{1.6}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{remove_option}{section, option}
|
||||
\begin{methoddesc}[RawConfigParser]{remove_option}{section, option}
|
||||
Remove the specified \var{option} from the specified \var{section}.
|
||||
If the section does not exist, raise \exception{NoSectionError}.
|
||||
If the option existed to be removed, return \constant{True};
|
||||
|
@ -271,13 +271,13 @@ otherwise return \constant{False}.
|
|||
\versionadded{1.6}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{remove_section}{section}
|
||||
\begin{methoddesc}[RawConfigParser]{remove_section}{section}
|
||||
Remove the specified \var{section} from the configuration.
|
||||
If the section in fact existed, return \code{True}.
|
||||
Otherwise return \code{False}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{optionxform}{option}
|
||||
\begin{methoddesc}[RawConfigParser]{optionxform}{option}
|
||||
Transforms the option name \var{option} as found in an input file or
|
||||
as passed in by client code to the form that should be used in the
|
||||
internal structures. The default implementation returns a lower-case
|
||||
|
@ -293,14 +293,14 @@ option names case sensitive.
|
|||
The \class{ConfigParser} class extends some methods of the
|
||||
\class{RawConfigParser} interface, adding some optional arguments.
|
||||
|
||||
\begin{methoddesc}{get}{section, option\optional{, raw\optional{, vars}}}
|
||||
\begin{methoddesc}[ConfigParser]{get}{section, option\optional{, raw\optional{, vars}}}
|
||||
Get an \var{option} value for the named \var{section}. All the
|
||||
\character{\%} interpolations are expanded in the return values, based
|
||||
on the defaults passed into the constructor, as well as the options
|
||||
\var{vars} provided, unless the \var{raw} argument is true.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{items}{section\optional{, raw\optional{, vars}}}
|
||||
\begin{methoddesc}[ConfigParser]{items}{section\optional{, raw\optional{, vars}}}
|
||||
Return a list of \code{(\var{name}, \var{value})} pairs for each
|
||||
option in the given \var{section}. Optional arguments have the
|
||||
same meaning as for the \method{get()} method.
|
||||
|
@ -313,7 +313,7 @@ same meaning as for the \method{get()} method.
|
|||
The \class{SafeConfigParser} class implements the same extended
|
||||
interface as \class{ConfigParser}, with the following addition:
|
||||
|
||||
\begin{methoddesc}{set}{section, option, value}
|
||||
\begin{methoddesc}[SafeConfigParser]{set}{section, option, value}
|
||||
If the given section exists, set the given option to the specified
|
||||
value; otherwise raise \exception{NoSectionError}. \var{value} must
|
||||
be a string (\class{str} or \class{unicode}); if not,
|
||||
|
|
|
@ -37,7 +37,7 @@ will default to \var{sys.stdin} and \var{sys.stdout}.
|
|||
|
||||
A \class{Cmd} instance has the following methods:
|
||||
|
||||
\begin{methoddesc}{cmdloop}{\optional{intro}}
|
||||
\begin{methoddesc}[Cmd]{cmdloop}{\optional{intro}}
|
||||
Repeatedly issue a prompt, accept input, parse an initial prefix off
|
||||
the received input, and dispatch to action methods, passing them the
|
||||
remainder of the line as argument.
|
||||
|
@ -82,7 +82,7 @@ commands with corresponding \method{help_*()} methods), and also lists
|
|||
any undocumented commands.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{onecmd}{str}
|
||||
\begin{methoddesc}[Cmd]{onecmd}{str}
|
||||
Interpret the argument as though it had been typed in response to the
|
||||
prompt. This may be overridden, but should not normally need to be;
|
||||
see the \method{precmd()} and \method{postcmd()} methods for useful
|
||||
|
@ -93,25 +93,25 @@ value of that method is returned, otherwise the return value from the
|
|||
\method{default()} method is returned.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{emptyline}{}
|
||||
\begin{methoddesc}[Cmd]{emptyline}{}
|
||||
Method called when an empty line is entered in response to the prompt.
|
||||
If this method is not overridden, it repeats the last nonempty command
|
||||
entered.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{default}{line}
|
||||
\begin{methoddesc}[Cmd]{default}{line}
|
||||
Method called on an input line when the command prefix is not
|
||||
recognized. If this method is not overridden, it prints an
|
||||
error message and returns.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{completedefault}{text, line, begidx, endidx}
|
||||
\begin{methoddesc}[Cmd]{completedefault}{text, line, begidx, endidx}
|
||||
Method called to complete an input line when no command-specific
|
||||
\method{complete_*()} method is available. By default, it returns an
|
||||
empty list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{precmd}{line}
|
||||
\begin{methoddesc}[Cmd]{precmd}{line}
|
||||
Hook method executed just before the command line \var{line} is
|
||||
interpreted, but after the input prompt is generated and issued. This
|
||||
method is a stub in \class{Cmd}; it exists to be overridden by
|
||||
|
@ -121,7 +121,7 @@ implementation may re-write the command or simply return \var{line}
|
|||
unchanged.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{postcmd}{stop, line}
|
||||
\begin{methoddesc}[Cmd]{postcmd}{stop, line}
|
||||
Hook method executed just after a command dispatch is finished. This
|
||||
method is a stub in \class{Cmd}; it exists to be overridden by
|
||||
subclasses. \var{line} is the command line which was executed, and
|
||||
|
@ -133,13 +133,13 @@ corresponds to \var{stop}; returning false will cause interpretation
|
|||
to continue.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{preloop}{}
|
||||
\begin{methoddesc}[Cmd]{preloop}{}
|
||||
Hook method executed once when \method{cmdloop()} is called. This
|
||||
method is a stub in \class{Cmd}; it exists to be overridden by
|
||||
subclasses.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{postloop}{}
|
||||
\begin{methoddesc}[Cmd]{postloop}{}
|
||||
Hook method executed once when \method{cmdloop()} is about to return.
|
||||
This method is a stub in \class{Cmd}; it exists to be overridden by
|
||||
subclasses.
|
||||
|
@ -147,47 +147,47 @@ subclasses.
|
|||
|
||||
Instances of \class{Cmd} subclasses have some public instance variables:
|
||||
|
||||
\begin{memberdesc}{prompt}
|
||||
\begin{memberdesc}[Cmd]{prompt}
|
||||
The prompt issued to solicit input.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{identchars}
|
||||
\begin{memberdesc}[Cmd]{identchars}
|
||||
The string of characters accepted for the command prefix.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{lastcmd}
|
||||
\begin{memberdesc}[Cmd]{lastcmd}
|
||||
The last nonempty command prefix seen.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{intro}
|
||||
\begin{memberdesc}[Cmd]{intro}
|
||||
A string to issue as an intro or banner. May be overridden by giving
|
||||
the \method{cmdloop()} method an argument.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{doc_header}
|
||||
\begin{memberdesc}[Cmd]{doc_header}
|
||||
The header to issue if the help output has a section for documented
|
||||
commands.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{misc_header}
|
||||
\begin{memberdesc}[Cmd]{misc_header}
|
||||
The header to issue if the help output has a section for miscellaneous
|
||||
help topics (that is, there are \method{help_*()} methods without
|
||||
corresponding \method{do_*()} methods).
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{undoc_header}
|
||||
\begin{memberdesc}[Cmd]{undoc_header}
|
||||
The header to issue if the help output has a section for undocumented
|
||||
commands (that is, there are \method{do_*()} methods without
|
||||
corresponding \method{help_*()} methods).
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{ruler}
|
||||
\begin{memberdesc}[Cmd]{ruler}
|
||||
The character used to draw separator lines under the help-message
|
||||
headers. If empty, no ruler line is drawn. It defaults to
|
||||
\character{=}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{use_rawinput}
|
||||
\begin{memberdesc}[Cmd]{use_rawinput}
|
||||
A flag, defaulting to true. If true, \method{cmdloop()} uses
|
||||
\function{raw_input()} to display a prompt and read the next command;
|
||||
if false, \method{sys.stdout.write()} and
|
||||
|
|
|
@ -68,7 +68,7 @@ syntax error, or raises \exception{OverflowError} or
|
|||
\subsection{Interactive Interpreter Objects
|
||||
\label{interpreter-objects}}
|
||||
|
||||
\begin{methoddesc}{runsource}{source\optional{, filename\optional{, symbol}}}
|
||||
\begin{methoddesc}[InteractiveInterpreter]{runsource}{source\optional{, filename\optional{, symbol}}}
|
||||
Compile and run some source in the interpreter.
|
||||
Arguments are the same as for \function{compile_command()}; the
|
||||
default for \var{filename} is \code{'<input>'}, and for
|
||||
|
@ -98,7 +98,7 @@ The return value can be used to decide whether to use
|
|||
\code{sys.ps1} or \code{sys.ps2} to prompt the next line.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{runcode}{code}
|
||||
\begin{methoddesc}[InteractiveInterpreter]{runcode}{code}
|
||||
Execute a code object.
|
||||
When an exception occurs, \method{showtraceback()} is called to
|
||||
display a traceback. All exceptions are caught except
|
||||
|
@ -109,7 +109,7 @@ elsewhere in this code, and may not always be caught. The caller
|
|||
should be prepared to deal with it.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{showsyntaxerror}{\optional{filename}}
|
||||
\begin{methoddesc}[InteractiveInterpreter]{showsyntaxerror}{\optional{filename}}
|
||||
Display the syntax error that just occurred. This does not display
|
||||
a stack trace because there isn't one for syntax errors.
|
||||
If \var{filename} is given, it is stuffed into the exception instead
|
||||
|
@ -118,13 +118,13 @@ always uses \code{'<string>'} when reading from a string.
|
|||
The output is written by the \method{write()} method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{showtraceback}{}
|
||||
\begin{methoddesc}[InteractiveInterpreter]{showtraceback}{}
|
||||
Display the exception that just occurred. We remove the first stack
|
||||
item because it is within the interpreter object implementation.
|
||||
The output is written by the \method{write()} method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{write}{data}
|
||||
\begin{methoddesc}[InteractiveInterpreter]{write}{data}
|
||||
Write a string to the standard error stream (\code{sys.stderr}).
|
||||
Derived classes should override this to provide the appropriate output
|
||||
handling as needed.
|
||||
|
@ -138,7 +138,7 @@ The \class{InteractiveConsole} class is a subclass of
|
|||
\class{InteractiveInterpreter}, and so offers all the methods of the
|
||||
interpreter objects as well as the following additions.
|
||||
|
||||
\begin{methoddesc}{interact}{\optional{banner}}
|
||||
\begin{methoddesc}[InteractiveConsole]{interact}{\optional{banner}}
|
||||
Closely emulate the interactive Python console.
|
||||
The optional banner argument specify the banner to print before the
|
||||
first interaction; by default it prints a banner similar to the one
|
||||
|
@ -147,7 +147,7 @@ name of the console object in parentheses (so as not to confuse this
|
|||
with the real interpreter -- since it's so close!).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{push}{line}
|
||||
\begin{methoddesc}[InteractiveConsole]{push}{line}
|
||||
Push a line of source text to the interpreter.
|
||||
The line should not have a trailing newline; it may have internal
|
||||
newlines. The line is appended to a buffer and the interpreter's
|
||||
|
@ -160,11 +160,11 @@ appended. The return value is \code{True} if more input is required,
|
|||
\method{runsource()}).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{resetbuffer}{}
|
||||
\begin{methoddesc}[InteractiveConsole]{resetbuffer}{}
|
||||
Remove any unhandled source text from the input buffer.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{raw_input}{\optional{prompt}}
|
||||
\begin{methoddesc}[InteractiveConsole]{raw_input}{\optional{prompt}}
|
||||
Write a prompt and read a line. The returned line does not include
|
||||
the trailing newline. When the user enters the \EOF{} key sequence,
|
||||
\exception{EOFError} is raised. The base implementation uses the
|
||||
|
|
|
@ -221,7 +221,7 @@ def maketree(iterable):
|
|||
|
||||
\subsection{\class{defaultdict} objects \label{defaultdict-objects}}
|
||||
|
||||
\begin{funcdesc}{defaultdict}{\optional{default_factory\optional{, ...}}}
|
||||
\begin{classdesc}{defaultdict}{\optional{default_factory\optional{, ...}}}
|
||||
Returns a new dictionary-like object. \class{defaultdict} is a subclass
|
||||
of the builtin \class{dict} class. It overrides one method and adds one
|
||||
writable instance variable. The remaining functionality is the same as
|
||||
|
@ -233,7 +233,7 @@ def maketree(iterable):
|
|||
passed to the \class{dict} constructor, including keyword arguments.
|
||||
|
||||
\versionadded{2.5}
|
||||
\end{funcdesc}
|
||||
\end{classdesc}
|
||||
|
||||
\class{defaultdict} objects support the following method in addition to
|
||||
the standard \class{dict} operations:
|
||||
|
@ -256,11 +256,11 @@ the standard \class{dict} operations:
|
|||
|
||||
\class{defaultdict} objects support the following instance variable:
|
||||
|
||||
\begin{datadesc}{default_factory}
|
||||
\begin{memberdesc}{default_factory}
|
||||
This attribute is used by the \method{__missing__} method; it is initialized
|
||||
from the first argument to the constructor, if present, or to \code{None},
|
||||
if absent.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
|
||||
\subsubsection{\class{defaultdict} Examples \label{defaultdict-examples}}
|
||||
|
|
|
@ -292,12 +292,12 @@ If there is a failure, the object's state will not be altered.
|
|||
|
||||
\class{FileCookieJar} instances have the following public attributes:
|
||||
|
||||
\begin{memberdesc}{filename}
|
||||
\begin{memberdesc}[FileCookieJar]{filename}
|
||||
Filename of default file in which to keep cookies. This attribute may
|
||||
be assigned to.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{delayload}
|
||||
\begin{memberdesc}[FileCookieJar]{delayload}
|
||||
If true, load cookies lazily from disk. This attribute should not be
|
||||
assigned to. This is only a hint, since this only affects
|
||||
performance, not behaviour (unless the cookies on disk are changing).
|
||||
|
@ -400,13 +400,13 @@ In addition to implementing the methods above, implementations of the
|
|||
attributes, indicating which protocols should be used, and how. All
|
||||
of these attributes may be assigned to.
|
||||
|
||||
\begin{memberdesc}{netscape}
|
||||
\begin{memberdesc}[CookiePolicy]{netscape}
|
||||
Implement Netscape protocol.
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{rfc2965}
|
||||
\begin{memberdesc}[CookiePolicy]{rfc2965}
|
||||
Implement RFC 2965 protocol.
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{hide_cookie2}
|
||||
\begin{memberdesc}[CookiePolicy]{hide_cookie2}
|
||||
Don't add \mailheader{Cookie2} header to requests (the presence of
|
||||
this header indicates to the server that we understand RFC 2965
|
||||
cookies).
|
||||
|
@ -504,7 +504,7 @@ receiving cookies.
|
|||
which are all initialised from the constructor arguments of the same
|
||||
name, and which may all be assigned to.
|
||||
|
||||
\begin{memberdesc}{rfc2109_as_netscape}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{rfc2109_as_netscape}
|
||||
If true, request that the \class{CookieJar} instance downgrade RFC
|
||||
2109 cookies (ie. cookies received in a \mailheader{Set-Cookie} header
|
||||
with a version cookie-attribute of 1) to Netscape cookies by setting
|
||||
|
@ -517,7 +517,7 @@ RFC 2109 cookies are downgraded by default.
|
|||
|
||||
General strictness switches:
|
||||
|
||||
\begin{memberdesc}{strict_domain}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{strict_domain}
|
||||
Don't allow sites to set two-component domains with country-code
|
||||
top-level domains like \code{.co.uk}, \code{.gov.uk},
|
||||
\code{.co.nz}.etc. This is far from perfect and isn't guaranteed to
|
||||
|
@ -526,7 +526,7 @@ work!
|
|||
|
||||
RFC 2965 protocol strictness switches:
|
||||
|
||||
\begin{memberdesc}{strict_rfc2965_unverifiable}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{strict_rfc2965_unverifiable}
|
||||
Follow RFC 2965 rules on unverifiable transactions (usually, an
|
||||
unverifiable transaction is one resulting from a redirect or a request
|
||||
for an image hosted on another site). If this is false, cookies are
|
||||
|
@ -535,19 +535,19 @@ for an image hosted on another site). If this is false, cookies are
|
|||
|
||||
Netscape protocol strictness switches:
|
||||
|
||||
\begin{memberdesc}{strict_ns_unverifiable}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_unverifiable}
|
||||
apply RFC 2965 rules on unverifiable transactions even to Netscape
|
||||
cookies
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{strict_ns_domain}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_domain}
|
||||
Flags indicating how strict to be with domain-matching rules for
|
||||
Netscape cookies. See below for acceptable values.
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{strict_ns_set_initial_dollar}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_set_initial_dollar}
|
||||
Ignore cookies in Set-Cookie: headers that have names starting with
|
||||
\code{'\$'}.
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{strict_ns_set_path}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{strict_ns_set_path}
|
||||
Don't allow setting cookies whose path doesn't path-match request URI.
|
||||
\end{memberdesc}
|
||||
|
||||
|
@ -556,30 +556,30 @@ constructed by or-ing together (for example,
|
|||
\code{DomainStrictNoDots|DomainStrictNonDomain} means both flags are
|
||||
set).
|
||||
|
||||
\begin{memberdesc}{DomainStrictNoDots}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{DomainStrictNoDots}
|
||||
When setting cookies, the 'host prefix' must not contain a dot
|
||||
(eg. \code{www.foo.bar.com} can't set a cookie for \code{.bar.com},
|
||||
because \code{www.foo} contains a dot).
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{DomainStrictNonDomain}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{DomainStrictNonDomain}
|
||||
Cookies that did not explicitly specify a \code{domain}
|
||||
cookie-attribute can only be returned to a domain equal to the domain
|
||||
that set the cookie (eg. \code{spam.example.com} won't be returned
|
||||
cookies from \code{example.com} that had no \code{domain}
|
||||
cookie-attribute).
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{DomainRFC2965Match}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{DomainRFC2965Match}
|
||||
When setting cookies, require a full RFC 2965 domain-match.
|
||||
\end{memberdesc}
|
||||
|
||||
The following attributes are provided for convenience, and are the
|
||||
most useful combinations of the above flags:
|
||||
|
||||
\begin{memberdesc}{DomainLiberal}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{DomainLiberal}
|
||||
Equivalent to 0 (ie. all of the above Netscape domain strictness flags
|
||||
switched off).
|
||||
\end{memberdesc}
|
||||
\begin{memberdesc}{DomainStrict}
|
||||
\begin{memberdesc}[DefaultCookiePolicy]{DomainStrict}
|
||||
Equivalent to \code{DomainStrictNoDots|DomainStrictNonDomain}.
|
||||
\end{memberdesc}
|
||||
|
||||
|
|
|
@ -1154,7 +1154,7 @@ following methods. Exactly which methods are needed depends on the
|
|||
uses made of aware \module{datetime} objects. If in doubt, simply
|
||||
implement all of them.
|
||||
|
||||
\begin{methoddesc}{utcoffset}{self, dt}
|
||||
\begin{methoddesc}[tzinfo]{utcoffset}{self, dt}
|
||||
Return offset of local time from UTC, in minutes east of UTC. If
|
||||
local time is west of UTC, this should be negative. Note that this
|
||||
is intended to be the total offset from UTC; for example, if a
|
||||
|
@ -1178,7 +1178,7 @@ implement all of them.
|
|||
\exception{NotImplementedError}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{dst}{self, dt}
|
||||
\begin{methoddesc}[tzinfo]{dst}{self, dt}
|
||||
Return the daylight saving time (DST) adjustment, in minutes east of
|
||||
UTC, or \code{None} if DST information isn't known. Return
|
||||
\code{timedelta(0)} if DST is not in effect.
|
||||
|
@ -1237,7 +1237,7 @@ implement all of them.
|
|||
\exception{NotImplementedError}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{tzname}{self, dt}
|
||||
\begin{methoddesc}[tzinfo]{tzname}{self, dt}
|
||||
Return the time zone name corresponding to the \class{datetime}
|
||||
object \var{dt}, as a string.
|
||||
Nothing about string names is defined by the
|
||||
|
@ -1278,7 +1278,7 @@ and not need worry about objects in other timezones.
|
|||
There is one more \class{tzinfo} method that a subclass may wish to
|
||||
override:
|
||||
|
||||
\begin{methoddesc}{fromutc}{self, dt}
|
||||
\begin{methoddesc}[tzinfo]{fromutc}{self, dt}
|
||||
This is called from the default \class{datetime.astimezone()}
|
||||
implementation. When called from that, \code{\var{dt}.tzinfo} is
|
||||
\var{self}, and \var{dt}'s date and time members are to be viewed as
|
||||
|
|
|
@ -51,14 +51,14 @@ requests are handled as XML-RPC method calls. HTTP GET requests are
|
|||
handled by generating pydoc-style HTML documentation. This allows a
|
||||
server to provide its own web-based documentation.
|
||||
|
||||
\begin{methoddesc}{set_server_title}{server_title}
|
||||
\begin{methoddesc}[DocXMLRPCServer]{set_server_title}{server_title}
|
||||
|
||||
Set the title used in the generated HTML documentation. This title
|
||||
will be used inside the HTML "title" element.
|
||||
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set_server_name}{server_name}
|
||||
\begin{methoddesc}[DocXMLRPCServer]{set_server_name}{server_name}
|
||||
|
||||
Set the name used in the generated HTML documentation. This name will
|
||||
appear at the top of the generated documentation inside a "h1"
|
||||
|
@ -67,7 +67,7 @@ element.
|
|||
\end{methoddesc}
|
||||
|
||||
|
||||
\begin{methoddesc}{set_server_documentation}{server_documentation}
|
||||
\begin{methoddesc}[DocXMLRPCServer]{set_server_documentation}{server_documentation}
|
||||
|
||||
Set the description used in the generated HTML documentation. This
|
||||
description will appear as a paragraph, below the server name, in the
|
||||
|
@ -84,14 +84,14 @@ are handled as XML-RPC method calls. HTTP GET requests are handled by
|
|||
generating pydoc-style HTML documentation. This allows a server to
|
||||
provide its own web-based documentation.
|
||||
|
||||
\begin{methoddesc}{set_server_title}{server_title}
|
||||
\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_title}{server_title}
|
||||
|
||||
Set the title used in the generated HTML documentation. This title
|
||||
will be used inside the HTML "title" element.
|
||||
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set_server_name}{server_name}
|
||||
\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_name}{server_name}
|
||||
|
||||
Set the name used in the generated HTML documentation. This name will
|
||||
appear at the top of the generated documentation inside a "h1"
|
||||
|
@ -100,7 +100,7 @@ element.
|
|||
\end{methoddesc}
|
||||
|
||||
|
||||
\begin{methoddesc}{set_server_documentation}{server_documentation}
|
||||
\begin{methoddesc}[DocCGIXMLRPCRequestHandler]{set_server_documentation}{server_documentation}
|
||||
|
||||
Set the description used in the generated HTML documentation. This
|
||||
description will appear as a paragraph, below the server name, in the
|
||||
|
|
|
@ -95,7 +95,7 @@ which is used followed by \samp{lines} for the text version or
|
|||
|
||||
\class{FTP} instances have the following methods:
|
||||
|
||||
\begin{methoddesc}{set_debuglevel}{level}
|
||||
\begin{methoddesc}[FTP]{set_debuglevel}{level}
|
||||
Set the instance's debugging level. This controls the amount of
|
||||
debugging output printed. The default, \code{0}, produces no
|
||||
debugging output. A value of \code{1} produces a moderate amount of
|
||||
|
@ -104,7 +104,7 @@ debugging output, generally a single line per request. A value of
|
|||
logging each line sent and received on the control connection.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{connect}{host\optional{, port\optional{, timeout}}}
|
||||
\begin{methoddesc}[FTP]{connect}{host\optional{, port\optional{, timeout}}}
|
||||
Connect to the given host and port. The default port number is \code{21}, as
|
||||
specified by the FTP protocol specification. It is rarely needed to
|
||||
specify a different port number. This function should be called only
|
||||
|
@ -119,13 +119,13 @@ class); if the object timeout is also None, the global default timeout
|
|||
setting will be used.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getwelcome}{}
|
||||
\begin{methoddesc}[FTP]{getwelcome}{}
|
||||
Return the welcome message sent by the server in reply to the initial
|
||||
connection. (This message sometimes contains disclaimers or help
|
||||
information that may be relevant to the user.)
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{login}{\optional{user\optional{, passwd\optional{, acct}}}}
|
||||
\begin{methoddesc}[FTP]{login}{\optional{user\optional{, passwd\optional{, acct}}}}
|
||||
Log in as the given \var{user}. The \var{passwd} and \var{acct}
|
||||
parameters are optional and default to the empty string. If no
|
||||
\var{user} is specified, it defaults to \code{'anonymous'}. If
|
||||
|
@ -137,23 +137,23 @@ instance was created. Most FTP commands are only allowed after the
|
|||
client has logged in.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{abort}{}
|
||||
\begin{methoddesc}[FTP]{abort}{}
|
||||
Abort a file transfer that is in progress. Using this does not always
|
||||
work, but it's worth a try.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{sendcmd}{command}
|
||||
\begin{methoddesc}[FTP]{sendcmd}{command}
|
||||
Send a simple command string to the server and return the response
|
||||
string.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{voidcmd}{command}
|
||||
\begin{methoddesc}[FTP]{voidcmd}{command}
|
||||
Send a simple command string to the server and handle the response.
|
||||
Return nothing if a response code in the range 200--299 is received.
|
||||
Raise an exception otherwise.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{retrbinary}{command,
|
||||
\begin{methoddesc}[FTP]{retrbinary}{command,
|
||||
callback\optional{, maxblocksize\optional{, rest}}}
|
||||
Retrieve a file in binary transfer mode. \var{command} should be an
|
||||
appropriate \samp{RETR} command: \code{'RETR \var{filename}'}.
|
||||
|
@ -166,7 +166,7 @@ read on the low-level socket object created to do the actual transfer
|
|||
same thing as in the \method{transfercmd()} method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{retrlines}{command\optional{, callback}}
|
||||
\begin{methoddesc}[FTP]{retrlines}{command\optional{, callback}}
|
||||
Retrieve a file or directory listing in \ASCII{} transfer mode.
|
||||
\var{command} should be an appropriate \samp{RETR} command (see
|
||||
\method{retrbinary()}) or a \samp{LIST} command (usually just the string
|
||||
|
@ -175,13 +175,13 @@ with the trailing CRLF stripped. The default \var{callback} prints
|
|||
the line to \code{sys.stdout}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set_pasv}{boolean}
|
||||
\begin{methoddesc}[FTP]{set_pasv}{boolean}
|
||||
Enable ``passive'' mode if \var{boolean} is true, other disable
|
||||
passive mode. (In Python 2.0 and before, passive mode was off by
|
||||
default; in Python 2.1 and later, it is on by default.)
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{storbinary}{command, file\optional{, blocksize}}
|
||||
\begin{methoddesc}[FTP]{storbinary}{command, file\optional{, blocksize}}
|
||||
Store a file in binary transfer mode. \var{command} should be an
|
||||
appropriate \samp{STOR} command: \code{"STOR \var{filename}"}.
|
||||
\var{file} is an open file object which is read until \EOF{} using its
|
||||
|
@ -190,14 +190,14 @@ data to be stored. The \var{blocksize} argument defaults to 8192.
|
|||
\versionchanged[default for \var{blocksize} added]{2.1}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{storlines}{command, file}
|
||||
\begin{methoddesc}[FTP]{storlines}{command, file}
|
||||
Store a file in \ASCII{} transfer mode. \var{command} should be an
|
||||
appropriate \samp{STOR} command (see \method{storbinary()}). Lines are
|
||||
read until \EOF{} from the open file object \var{file} using its
|
||||
\method{readline()} method to provide the data to be stored.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{transfercmd}{cmd\optional{, rest}}
|
||||
\begin{methoddesc}[FTP]{transfercmd}{cmd\optional{, rest}}
|
||||
Initiate a transfer over the data connection. If the transfer is
|
||||
active, send a \samp{EPRT} or \samp{PORT} command and the transfer command specified
|
||||
by \var{cmd}, and accept the connection. If the server is passive,
|
||||
|
@ -219,7 +219,7 @@ not recognize the \samp{REST} command, an
|
|||
simply call \method{transfercmd()} without a \var{rest} argument.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{ntransfercmd}{cmd\optional{, rest}}
|
||||
\begin{methoddesc}[FTP]{ntransfercmd}{cmd\optional{, rest}}
|
||||
Like \method{transfercmd()}, but returns a tuple of the data
|
||||
connection and the expected size of the data. If the expected size
|
||||
could not be computed, \code{None} will be returned as the expected
|
||||
|
@ -227,14 +227,14 @@ size. \var{cmd} and \var{rest} means the same thing as in
|
|||
\method{transfercmd()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{nlst}{argument\optional{, \ldots}}
|
||||
\begin{methoddesc}[FTP]{nlst}{argument\optional{, \ldots}}
|
||||
Return a list of files as returned by the \samp{NLST} command. The
|
||||
optional \var{argument} is a directory to list (default is the current
|
||||
server directory). Multiple arguments can be used to pass
|
||||
non-standard options to the \samp{NLST} command.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{dir}{argument\optional{, \ldots}}
|
||||
\begin{methoddesc}[FTP]{dir}{argument\optional{, \ldots}}
|
||||
Produce a directory listing as returned by the \samp{LIST} command,
|
||||
printing it to standard output. The optional \var{argument} is a
|
||||
directory to list (default is the current server directory). Multiple
|
||||
|
@ -244,41 +244,41 @@ command. If the last argument is a function, it is used as a
|
|||
prints to \code{sys.stdout}. This method returns \code{None}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{rename}{fromname, toname}
|
||||
\begin{methoddesc}[FTP]{rename}{fromname, toname}
|
||||
Rename file \var{fromname} on the server to \var{toname}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{delete}{filename}
|
||||
\begin{methoddesc}[FTP]{delete}{filename}
|
||||
Remove the file named \var{filename} from the server. If successful,
|
||||
returns the text of the response, otherwise raises
|
||||
\exception{error_perm} on permission errors or
|
||||
\exception{error_reply} on other errors.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{cwd}{pathname}
|
||||
\begin{methoddesc}[FTP]{cwd}{pathname}
|
||||
Set the current directory on the server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{mkd}{pathname}
|
||||
\begin{methoddesc}[FTP]{mkd}{pathname}
|
||||
Create a new directory on the server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{pwd}{}
|
||||
\begin{methoddesc}[FTP]{pwd}{}
|
||||
Return the pathname of the current directory on the server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{rmd}{dirname}
|
||||
\begin{methoddesc}[FTP]{rmd}{dirname}
|
||||
Remove the directory named \var{dirname} on the server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{size}{filename}
|
||||
\begin{methoddesc}[FTP]{size}{filename}
|
||||
Request the size of the file named \var{filename} on the server. On
|
||||
success, the size of the file is returned as an integer, otherwise
|
||||
\code{None} is returned. Note that the \samp{SIZE} command is not
|
||||
standardized, but is supported by many common server implementations.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{quit}{}
|
||||
\begin{methoddesc}[FTP]{quit}{}
|
||||
Send a \samp{QUIT} command to the server and close the connection.
|
||||
This is the ``polite'' way to close a connection, but it may raise an
|
||||
exception of the server reponds with an error to the
|
||||
|
@ -287,7 +287,7 @@ method which renders the \class{FTP} instance useless for subsequent
|
|||
calls (see below).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{close}{}
|
||||
\begin{methoddesc}[FTP]{close}{}
|
||||
Close the connection unilaterally. This should not be applied to an
|
||||
already closed connection such as after a successful call to
|
||||
\method{quit()}. After this call the \class{FTP} instance should not
|
||||
|
|
|
@ -1166,7 +1166,7 @@ class C(B):
|
|||
as detailed below.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{type}{name, bases, dict}
|
||||
\begin{funcdescni}{type}{name, bases, dict}
|
||||
Return a new type object. This is essentially a dynamic form of the
|
||||
\keyword{class} statement. The \var{name} string is the class name
|
||||
and becomes the \member{__name__} attribute; the \var{bases} tuple
|
||||
|
@ -1183,7 +1183,7 @@ class C(B):
|
|||
>>> X = type('X', (object,), dict(a=1))
|
||||
\end{verbatim}
|
||||
\versionadded{2.2}
|
||||
\end{funcdesc}
|
||||
\end{funcdescni}
|
||||
|
||||
\begin{funcdesc}{unichr}{i}
|
||||
Return the Unicode string of one character whose Unicode code is the
|
||||
|
|
|
@ -48,25 +48,25 @@ information).
|
|||
|
||||
Profile objects have the following methods:
|
||||
|
||||
\begin{methoddesc}{addinfo}{key, value}
|
||||
\begin{methoddesc}[Profile]{addinfo}{key, value}
|
||||
Add an arbitrary labelled value to the profile output.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{close}{}
|
||||
\begin{methoddesc}[Profile]{close}{}
|
||||
Close the logfile and terminate the profiler.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{fileno}{}
|
||||
\begin{methoddesc}[Profile]{fileno}{}
|
||||
Return the file descriptor of the profiler's log file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{run}{cmd}
|
||||
\begin{methoddesc}[Profile]{run}{cmd}
|
||||
Profile an \keyword{exec}-compatible string in the script environment.
|
||||
The globals from the \refmodule[main]{__main__} module are used as
|
||||
both the globals and locals for the script.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{runcall}{func, *args, **keywords}
|
||||
\begin{methoddesc}[Profile]{runcall}{func, *args, **keywords}
|
||||
Profile a single call of a callable.
|
||||
Additional positional and keyword arguments may be passed
|
||||
along; the result of the call is returned, and exceptions are
|
||||
|
@ -75,16 +75,16 @@ disabled on the way out.
|
|||
\end{methoddesc}
|
||||
|
||||
|
||||
\begin{methoddesc}{runctx}{cmd, globals, locals}
|
||||
\begin{methoddesc}[Profile]{runctx}{cmd, globals, locals}
|
||||
Evaluate an \keyword{exec}-compatible string in a specific environment.
|
||||
The string is compiled before profiling begins.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{start}{}
|
||||
\begin{methoddesc}[Profile]{start}{}
|
||||
Start the profiler.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{stop}{}
|
||||
\begin{methoddesc}[Profile]{stop}{}
|
||||
Stop the profiler.
|
||||
\end{methoddesc}
|
||||
|
||||
|
|
|
@ -96,11 +96,11 @@ error while parsing.
|
|||
In addition to tag methods, the \class{HTMLParser} class provides some
|
||||
additional methods and instance variables for use within tag methods.
|
||||
|
||||
\begin{memberdesc}{formatter}
|
||||
\begin{memberdesc}[HTMLParser]{formatter}
|
||||
This is the formatter instance associated with the parser.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{nofill}
|
||||
\begin{memberdesc}[HTMLParser]{nofill}
|
||||
Boolean flag which should be true when whitespace should not be
|
||||
collapsed, or false when it should be. In general, this should only
|
||||
be true when character data is to be treated as ``preformatted'' text,
|
||||
|
@ -109,7 +109,7 @@ affects the operation of \method{handle_data()} and \method{save_end()}.
|
|||
\end{memberdesc}
|
||||
|
||||
|
||||
\begin{methoddesc}{anchor_bgn}{href, name, type}
|
||||
\begin{methoddesc}[HTMLParser]{anchor_bgn}{href, name, type}
|
||||
This method is called at the start of an anchor region. The arguments
|
||||
correspond to the attributes of the \code{<A>} tag with the same
|
||||
names. The default implementation maintains a list of hyperlinks
|
||||
|
@ -118,27 +118,27 @@ document. The list of hyperlinks is available as the data attribute
|
|||
\member{anchorlist}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{anchor_end}{}
|
||||
\begin{methoddesc}[HTMLParser]{anchor_end}{}
|
||||
This method is called at the end of an anchor region. The default
|
||||
implementation adds a textual footnote marker using an index into the
|
||||
list of hyperlinks created by \method{anchor_bgn()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{handle_image}{source, alt\optional{, ismap\optional{,
|
||||
\begin{methoddesc}[HTMLParser]{handle_image}{source, alt\optional{, ismap\optional{,
|
||||
align\optional{, width\optional{, height}}}}}
|
||||
This method is called to handle images. The default implementation
|
||||
simply passes the \var{alt} value to the \method{handle_data()}
|
||||
method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{save_bgn}{}
|
||||
\begin{methoddesc}[HTMLParser]{save_bgn}{}
|
||||
Begins saving character data in a buffer instead of sending it to the
|
||||
formatter object. Retrieve the stored data via \method{save_end()}.
|
||||
Use of the \method{save_bgn()} / \method{save_end()} pair may not be
|
||||
nested.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{save_end}{}
|
||||
\begin{methoddesc}[HTMLParser]{save_end}{}
|
||||
Ends buffering character data and returns all data saved since the
|
||||
preceding call to \method{save_bgn()}. If the \member{nofill} flag is
|
||||
false, whitespace is collapsed to single spaces. A call to this
|
||||
|
|
|
@ -309,7 +309,7 @@ Example: \code{httplib.responses[httplib.NOT_FOUND]} is \code{'Not Found'}.
|
|||
|
||||
\class{HTTPConnection} instances have the following methods:
|
||||
|
||||
\begin{methoddesc}{request}{method, url\optional{, body\optional{, headers}}}
|
||||
\begin{methoddesc}[HTTPConnection]{request}{method, url\optional{, body\optional{, headers}}}
|
||||
This will send a request to the server using the HTTP request method
|
||||
\var{method} and the selector \var{url}. If the \var{body} argument is
|
||||
present, it should be a string of data to send after the headers are finished.
|
||||
|
@ -323,24 +323,24 @@ with the request.
|
|||
\versionchanged[\var{body} can be a file object]{2.6}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getresponse}{}
|
||||
\begin{methoddesc}[HTTPConnection]{getresponse}{}
|
||||
Should be called after a request is sent to get the response from the server.
|
||||
Returns an \class{HTTPResponse} instance.
|
||||
\note{Note that you must have read the whole response before you can send a new
|
||||
request to the server.}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set_debuglevel}{level}
|
||||
\begin{methoddesc}[HTTPConnection]{set_debuglevel}{level}
|
||||
Set the debugging level (the amount of debugging output printed).
|
||||
The default debug level is \code{0}, meaning no debugging output is
|
||||
printed.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{connect}{}
|
||||
\begin{methoddesc}[HTTPConnection]{connect}{}
|
||||
Connect to the server specified when the object was created.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{close}{}
|
||||
\begin{methoddesc}[HTTPConnection]{close}{}
|
||||
Close the connection to the server.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -348,7 +348,7 @@ As an alternative to using the \method{request()} method described above,
|
|||
you can also send your request step by step, by using the four functions
|
||||
below.
|
||||
|
||||
\begin{methoddesc}{putrequest}{request, selector\optional{,
|
||||
\begin{methoddesc}[HTTPConnection]{putrequest}{request, selector\optional{,
|
||||
skip\_host\optional{, skip_accept_encoding}}}
|
||||
This should be the first call after the connection to the server has
|
||||
been made. It sends a line to the server consisting of the
|
||||
|
@ -360,18 +360,18 @@ with non-False values.
|
|||
\versionchanged[\var{skip_accept_encoding} argument added]{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{putheader}{header, argument\optional{, ...}}
|
||||
\begin{methoddesc}[HTTPConnection]{putheader}{header, argument\optional{, ...}}
|
||||
Send an \rfc{822}-style header to the server. It sends a line to the
|
||||
server consisting of the header, a colon and a space, and the first
|
||||
argument. If more arguments are given, continuation lines are sent,
|
||||
each consisting of a tab and an argument.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{endheaders}{}
|
||||
\begin{methoddesc}[HTTPConnection]{endheaders}{}
|
||||
Send a blank line to the server, signalling the end of the headers.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{send}{data}
|
||||
\begin{methoddesc}[HTTPConnection]{send}{data}
|
||||
Send data to the server. This should be used directly only after the
|
||||
\method{endheaders()} method has been called and before
|
||||
\method{getresponse()} is called.
|
||||
|
@ -381,34 +381,34 @@ Send data to the server. This should be used directly only after the
|
|||
|
||||
\class{HTTPResponse} instances have the following methods and attributes:
|
||||
|
||||
\begin{methoddesc}{read}{\optional{amt}}
|
||||
\begin{methoddesc}[HTTPResponse]{read}{\optional{amt}}
|
||||
Reads and returns the response body, or up to the next \var{amt} bytes.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getheader}{name\optional{, default}}
|
||||
\begin{methoddesc}[HTTPResponse]{getheader}{name\optional{, default}}
|
||||
Get the contents of the header \var{name}, or \var{default} if there is no
|
||||
matching header.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getheaders}{}
|
||||
\begin{methoddesc}[HTTPResponse]{getheaders}{}
|
||||
Return a list of (header, value) tuples. \versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{datadesc}{msg}
|
||||
\begin{memberdesc}[HTTPResponse]{msg}
|
||||
A \class{mimetools.Message} instance containing the response headers.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{datadesc}{version}
|
||||
\begin{memberdesc}[HTTPResponse]{version}
|
||||
HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{datadesc}{status}
|
||||
\begin{memberdesc}[HTTPResponse]{status}
|
||||
Status code returned by server.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{datadesc}{reason}
|
||||
\begin{memberdesc}[HTTPResponse]{reason}
|
||||
Reason phrase returned by server.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
|
||||
\subsection{Examples \label{httplib-examples}}
|
||||
|
|
|
@ -153,11 +153,11 @@ can contain an asterisk to indicate an infinite upper bound
|
|||
An \class{IMAP4} instance has the following methods:
|
||||
|
||||
|
||||
\begin{methoddesc}{append}{mailbox, flags, date_time, message}
|
||||
\begin{methoddesc}[IMAP4]{append}{mailbox, flags, date_time, message}
|
||||
Append \var{message} to named mailbox.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{authenticate}{mechanism, authobject}
|
||||
\begin{methoddesc}[IMAP4]{authenticate}{mechanism, authobject}
|
||||
Authenticate command --- requires response processing.
|
||||
|
||||
\var{mechanism} specifies which authentication mechanism is to be
|
||||
|
@ -176,115 +176,115 @@ data = authobject(response)
|
|||
be sent instead.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{check}{}
|
||||
\begin{methoddesc}[IMAP4]{check}{}
|
||||
Checkpoint mailbox on server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{close}{}
|
||||
\begin{methoddesc}[IMAP4]{close}{}
|
||||
Close currently selected mailbox. Deleted messages are removed from
|
||||
writable mailbox. This is the recommended command before
|
||||
\samp{LOGOUT}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{copy}{message_set, new_mailbox}
|
||||
\begin{methoddesc}[IMAP4]{copy}{message_set, new_mailbox}
|
||||
Copy \var{message_set} messages onto end of \var{new_mailbox}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{create}{mailbox}
|
||||
\begin{methoddesc}[IMAP4]{create}{mailbox}
|
||||
Create new mailbox named \var{mailbox}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{delete}{mailbox}
|
||||
\begin{methoddesc}[IMAP4]{delete}{mailbox}
|
||||
Delete old mailbox named \var{mailbox}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{deleteacl}{mailbox, who}
|
||||
\begin{methoddesc}[IMAP4]{deleteacl}{mailbox, who}
|
||||
Delete the ACLs (remove any rights) set for who on mailbox.
|
||||
\versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{expunge}{}
|
||||
\begin{methoddesc}[IMAP4]{expunge}{}
|
||||
Permanently remove deleted items from selected mailbox. Generates an
|
||||
\samp{EXPUNGE} response for each deleted message. Returned data
|
||||
contains a list of \samp{EXPUNGE} message numbers in order
|
||||
received.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{fetch}{message_set, message_parts}
|
||||
\begin{methoddesc}[IMAP4]{fetch}{message_set, message_parts}
|
||||
Fetch (parts of) messages. \var{message_parts} should be
|
||||
a string of message part names enclosed within parentheses,
|
||||
eg: \samp{"(UID BODY[TEXT])"}. Returned data are tuples
|
||||
of message part envelope and data.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getacl}{mailbox}
|
||||
\begin{methoddesc}[IMAP4]{getacl}{mailbox}
|
||||
Get the \samp{ACL}s for \var{mailbox}.
|
||||
The method is non-standard, but is supported by the \samp{Cyrus} server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getannotation}{mailbox, entry, attribute}
|
||||
\begin{methoddesc}[IMAP4]{getannotation}{mailbox, entry, attribute}
|
||||
Retrieve the specified \samp{ANNOTATION}s for \var{mailbox}.
|
||||
The method is non-standard, but is supported by the \samp{Cyrus} server.
|
||||
\versionadded{2.5}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getquota}{root}
|
||||
\begin{methoddesc}[IMAP4]{getquota}{root}
|
||||
Get the \samp{quota} \var{root}'s resource usage and limits.
|
||||
This method is part of the IMAP4 QUOTA extension defined in rfc2087.
|
||||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getquotaroot}{mailbox}
|
||||
\begin{methoddesc}[IMAP4]{getquotaroot}{mailbox}
|
||||
Get the list of \samp{quota} \samp{roots} for the named \var{mailbox}.
|
||||
This method is part of the IMAP4 QUOTA extension defined in rfc2087.
|
||||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{list}{\optional{directory\optional{, pattern}}}
|
||||
\begin{methoddesc}[IMAP4]{list}{\optional{directory\optional{, pattern}}}
|
||||
List mailbox names in \var{directory} matching
|
||||
\var{pattern}. \var{directory} defaults to the top-level mail
|
||||
folder, and \var{pattern} defaults to match anything. Returned data
|
||||
contains a list of \samp{LIST} responses.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{login}{user, password}
|
||||
\begin{methoddesc}[IMAP4]{login}{user, password}
|
||||
Identify the client using a plaintext password.
|
||||
The \var{password} will be quoted.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{login_cram_md5}{user, password}
|
||||
\begin{methoddesc}[IMAP4]{login_cram_md5}{user, password}
|
||||
Force use of \samp{CRAM-MD5} authentication when identifying the
|
||||
client to protect the password. Will only work if the server
|
||||
\samp{CAPABILITY} response includes the phrase \samp{AUTH=CRAM-MD5}.
|
||||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{logout}{}
|
||||
\begin{methoddesc}[IMAP4]{logout}{}
|
||||
Shutdown connection to server. Returns server \samp{BYE} response.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{lsub}{\optional{directory\optional{, pattern}}}
|
||||
\begin{methoddesc}[IMAP4]{lsub}{\optional{directory\optional{, pattern}}}
|
||||
List subscribed mailbox names in directory matching pattern.
|
||||
\var{directory} defaults to the top level directory and
|
||||
\var{pattern} defaults to match any mailbox.
|
||||
Returned data are tuples of message part envelope and data.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{myrights}{mailbox}
|
||||
\begin{methoddesc}[IMAP4]{myrights}{mailbox}
|
||||
Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).
|
||||
\versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{namespace}{}
|
||||
\begin{methoddesc}[IMAP4]{namespace}{}
|
||||
Returns IMAP namespaces as defined in RFC2342.
|
||||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{noop}{}
|
||||
\begin{methoddesc}[IMAP4]{noop}{}
|
||||
Send \samp{NOOP} to server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{open}{host, port}
|
||||
\begin{methoddesc}[IMAP4]{open}{host, port}
|
||||
Opens socket to \var{port} at \var{host}.
|
||||
The connection objects established by this method
|
||||
will be used in the \code{read}, \code{readline}, \code{send}, and
|
||||
|
@ -292,42 +292,42 @@ data = authobject(response)
|
|||
You may override this method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{partial}{message_num, message_part, start, length}
|
||||
\begin{methoddesc}[IMAP4]{partial}{message_num, message_part, start, length}
|
||||
Fetch truncated part of a message.
|
||||
Returned data is a tuple of message part envelope and data.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{proxyauth}{user}
|
||||
\begin{methoddesc}[IMAP4]{proxyauth}{user}
|
||||
Assume authentication as \var{user}.
|
||||
Allows an authorised administrator to proxy into any user's mailbox.
|
||||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read}{size}
|
||||
\begin{methoddesc}[IMAP4]{read}{size}
|
||||
Reads \var{size} bytes from the remote server.
|
||||
You may override this method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{readline}{}
|
||||
\begin{methoddesc}[IMAP4]{readline}{}
|
||||
Reads one line from the remote server.
|
||||
You may override this method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{recent}{}
|
||||
\begin{methoddesc}[IMAP4]{recent}{}
|
||||
Prompt server for an update. Returned data is \code{None} if no new
|
||||
messages, else value of \samp{RECENT} response.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{rename}{oldmailbox, newmailbox}
|
||||
\begin{methoddesc}[IMAP4]{rename}{oldmailbox, newmailbox}
|
||||
Rename mailbox named \var{oldmailbox} to \var{newmailbox}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{response}{code}
|
||||
\begin{methoddesc}[IMAP4]{response}{code}
|
||||
Return data for response \var{code} if received, or
|
||||
\code{None}. Returns the given code, instead of the usual type.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{search}{charset, criterion\optional{, ...}}
|
||||
\begin{methoddesc}[IMAP4]{search}{charset, criterion\optional{, ...}}
|
||||
Search mailbox for matching messages. \var{charset} may be
|
||||
\code{None}, in which case no \samp{CHARSET} will be specified in the
|
||||
request to the server. The IMAP protocol requires that at least one
|
||||
|
@ -345,45 +345,45 @@ typ, msgnums = M.search(None, '(FROM "LDJ")')
|
|||
\end{verbatim}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{select}{\optional{mailbox\optional{, readonly}}}
|
||||
\begin{methoddesc}[IMAP4]{select}{\optional{mailbox\optional{, readonly}}}
|
||||
Select a mailbox. Returned data is the count of messages in
|
||||
\var{mailbox} (\samp{EXISTS} response). The default \var{mailbox}
|
||||
is \code{'INBOX'}. If the \var{readonly} flag is set, modifications
|
||||
to the mailbox are not allowed.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{send}{data}
|
||||
\begin{methoddesc}[IMAP4]{send}{data}
|
||||
Sends \code{data} to the remote server.
|
||||
You may override this method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{setacl}{mailbox, who, what}
|
||||
\begin{methoddesc}[IMAP4]{setacl}{mailbox, who, what}
|
||||
Set an \samp{ACL} for \var{mailbox}.
|
||||
The method is non-standard, but is supported by the \samp{Cyrus} server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{setannotation}{mailbox, entry, attribute\optional{, ...}}
|
||||
\begin{methoddesc}[IMAP4]{setannotation}{mailbox, entry, attribute\optional{, ...}}
|
||||
Set \samp{ANNOTATION}s for \var{mailbox}.
|
||||
The method is non-standard, but is supported by the \samp{Cyrus} server.
|
||||
\versionadded{2.5}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{setquota}{root, limits}
|
||||
\begin{methoddesc}[IMAP4]{setquota}{root, limits}
|
||||
Set the \samp{quota} \var{root}'s resource \var{limits}.
|
||||
This method is part of the IMAP4 QUOTA extension defined in rfc2087.
|
||||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{shutdown}{}
|
||||
\begin{methoddesc}[IMAP4]{shutdown}{}
|
||||
Close connection established in \code{open}.
|
||||
You may override this method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{socket}{}
|
||||
\begin{methoddesc}[IMAP4]{socket}{}
|
||||
Returns socket instance used to connect to server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{sort}{sort_criteria, charset, search_criterion\optional{, ...}}
|
||||
\begin{methoddesc}[IMAP4]{sort}{sort_criteria, charset, search_criterion\optional{, ...}}
|
||||
The \code{sort} command is a variant of \code{search} with sorting
|
||||
semantics for the results. Returned data contains a space separated
|
||||
list of matching message numbers.
|
||||
|
@ -402,11 +402,11 @@ typ, msgnums = M.search(None, '(FROM "LDJ")')
|
|||
This is an \samp{IMAP4rev1} extension command.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{status}{mailbox, names}
|
||||
\begin{methoddesc}[IMAP4]{status}{mailbox, names}
|
||||
Request named status conditions for \var{mailbox}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{store}{message_set, command, flag_list}
|
||||
\begin{methoddesc}[IMAP4]{store}{message_set, command, flag_list}
|
||||
Alters flag dispositions for messages in mailbox. \var{command} is
|
||||
specified by section 6.4.6 of \rfc{2060} as being one of "FLAGS", "+FLAGS",
|
||||
or "-FLAGS", optionally with a suffix of ".SILENT".
|
||||
|
@ -421,11 +421,11 @@ M.expunge()
|
|||
\end{verbatim}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{subscribe}{mailbox}
|
||||
\begin{methoddesc}[IMAP4]{subscribe}{mailbox}
|
||||
Subscribe to new mailbox.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{thread}{threading_algorithm, charset,
|
||||
\begin{methoddesc}[IMAP4]{thread}{threading_algorithm, charset,
|
||||
search_criterion\optional{, ...}}
|
||||
The \code{thread} command is a variant of \code{search} with
|
||||
threading semantics for the results. Returned data contains a space
|
||||
|
@ -448,18 +448,18 @@ M.expunge()
|
|||
This is an \samp{IMAP4rev1} extension command. \versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{uid}{command, arg\optional{, ...}}
|
||||
\begin{methoddesc}[IMAP4]{uid}{command, arg\optional{, ...}}
|
||||
Execute command args with messages identified by UID, rather than
|
||||
message number. Returns response appropriate to command. At least
|
||||
one argument must be supplied; if none are provided, the server will
|
||||
return an error and an exception will be raised.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{unsubscribe}{mailbox}
|
||||
\begin{methoddesc}[IMAP4]{unsubscribe}{mailbox}
|
||||
Unsubscribe from old mailbox.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{xatom}{name\optional{, arg\optional{, ...}}}
|
||||
\begin{methoddesc}[IMAP4]{xatom}{name\optional{, arg\optional{, ...}}}
|
||||
Allow simple extension commands notified by server in
|
||||
\samp{CAPABILITY} response.
|
||||
\end{methoddesc}
|
||||
|
@ -467,7 +467,7 @@ M.expunge()
|
|||
|
||||
Instances of \class{IMAP4_SSL} have just one additional method:
|
||||
|
||||
\begin{methoddesc}{ssl}{}
|
||||
\begin{methoddesc}[IMAP4_SSL]{ssl}{}
|
||||
Returns SSLObject instance used for the secure connection with the server.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -475,12 +475,12 @@ Instances of \class{IMAP4_SSL} have just one additional method:
|
|||
The following attributes are defined on instances of \class{IMAP4}:
|
||||
|
||||
|
||||
\begin{memberdesc}{PROTOCOL_VERSION}
|
||||
\begin{memberdesc}[IMAP4]{PROTOCOL_VERSION}
|
||||
The most recent supported protocol in the
|
||||
\samp{CAPABILITY} response from the server.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{debug}
|
||||
\begin{memberdesc}[IMAP4]{debug}
|
||||
Integer value to control debugging output. The initialize value is
|
||||
taken from the module variable \code{Debug}. Values greater than
|
||||
three trace each command.
|
||||
|
|
|
@ -1246,7 +1246,7 @@ in preference to them.
|
|||
Older mailbox objects support only iteration and provide a single public
|
||||
method:
|
||||
|
||||
\begin{methoddesc}{next}{}
|
||||
\begin{methoddesc}[oldmailbox]{next}{}
|
||||
Return the next message in the mailbox, created with the optional \var{factory}
|
||||
argument passed into the mailbox object's constructor. By default this is an
|
||||
\class{rfc822.Message} object (see the \refmodule{rfc822} module). Depending
|
||||
|
|
|
@ -76,7 +76,7 @@ open file \var{output}. The block size is currently fixed at 8192.
|
|||
The \class{Message} class defines the following methods in
|
||||
addition to the \class{rfc822.Message} methods:
|
||||
|
||||
\begin{methoddesc}{getplist}{}
|
||||
\begin{methoddesc}[Message]{getplist}{}
|
||||
Return the parameter list of the \mailheader{Content-Type} header.
|
||||
This is a list of strings. For parameters of the form
|
||||
\samp{\var{key}=\var{value}}, \var{key} is converted to lower case but
|
||||
|
@ -86,34 +86,34 @@ This is a list of strings. For parameters of the form
|
|||
'spam=2', 'Spam']}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getparam}{name}
|
||||
\begin{methoddesc}[Message]{getparam}{name}
|
||||
Return the \var{value} of the first parameter (as returned by
|
||||
\method{getplist()}) of the form \samp{\var{name}=\var{value}} for the
|
||||
given \var{name}. If \var{value} is surrounded by quotes of the form
|
||||
`\code{<}...\code{>}' or `\code{"}...\code{"}', these are removed.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getencoding}{}
|
||||
\begin{methoddesc}[Message]{getencoding}{}
|
||||
Return the encoding specified in the
|
||||
\mailheader{Content-Transfer-Encoding} message header. If no such
|
||||
header exists, return \code{'7bit'}. The encoding is converted to
|
||||
lower case.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{gettype}{}
|
||||
\begin{methoddesc}[Message]{gettype}{}
|
||||
Return the message type (of the form \samp{\var{type}/\var{subtype}})
|
||||
as specified in the \mailheader{Content-Type} header. If no such
|
||||
header exists, return \code{'text/plain'}. The type is converted to
|
||||
lower case.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getmaintype}{}
|
||||
\begin{methoddesc}[Message]{getmaintype}{}
|
||||
Return the main type as specified in the \mailheader{Content-Type}
|
||||
header. If no such header exists, return \code{'text'}. The main
|
||||
type is converted to lower case.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getsubtype}{}
|
||||
\begin{methoddesc}[Message]{getsubtype}{}
|
||||
Return the subtype as specified in the \mailheader{Content-Type}
|
||||
header. If no such header exists, return \code{'plain'}. The subtype
|
||||
is converted to lower case.
|
||||
|
|
|
@ -178,49 +178,49 @@ An example usage of the module:
|
|||
\class{MimeTypes} instances provide an interface which is very like
|
||||
that of the \refmodule{mimetypes} module.
|
||||
|
||||
\begin{datadesc}{suffix_map}
|
||||
\begin{memberdesc}[MimeTypes]{suffix_map}
|
||||
Dictionary mapping suffixes to suffixes. This is used to allow
|
||||
recognition of encoded files for which the encoding and the type are
|
||||
indicated by the same extension. For example, the \file{.tgz}
|
||||
extension is mapped to \file{.tar.gz} to allow the encoding and type
|
||||
to be recognized separately. This is initially a copy of the global
|
||||
\code{suffix_map} defined in the module.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{datadesc}{encodings_map}
|
||||
\begin{memberdesc}[MimeTypes]{encodings_map}
|
||||
Dictionary mapping filename extensions to encoding types. This is
|
||||
initially a copy of the global \code{encodings_map} defined in the
|
||||
module.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{datadesc}{types_map}
|
||||
\begin{memberdesc}[MimeTypes]{types_map}
|
||||
Dictionary mapping filename extensions to MIME types. This is
|
||||
initially a copy of the global \code{types_map} defined in the
|
||||
module.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{datadesc}{common_types}
|
||||
\begin{memberdesc}[MimeTypes]{common_types}
|
||||
Dictionary mapping filename extensions to non-standard, but commonly
|
||||
found MIME types. This is initially a copy of the global
|
||||
\code{common_types} defined in the module.
|
||||
\end{datadesc}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{methoddesc}{guess_extension}{type\optional{, strict}}
|
||||
\begin{methoddesc}[MimeTypes]{guess_extension}{type\optional{, strict}}
|
||||
Similar to the \function{guess_extension()} function, using the
|
||||
tables stored as part of the object.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{guess_type}{url\optional{, strict}}
|
||||
\begin{methoddesc}[MimeTypes]{guess_type}{url\optional{, strict}}
|
||||
Similar to the \function{guess_type()} function, using the tables
|
||||
stored as part of the object.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read}{path}
|
||||
\begin{methoddesc}[MimeTypes]{read}{path}
|
||||
Load MIME information from a file named \var{path}. This uses
|
||||
\method{readfp()} to parse the file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{readfp}{file}
|
||||
\begin{methoddesc}[MimeTypes]{readfp}{file}
|
||||
Load MIME type information from an open file. The file must have
|
||||
the format of the standard \file{mime.types} files.
|
||||
\end{methoddesc}
|
||||
|
|
|
@ -31,7 +31,7 @@ writing. Note that a \class{StringIO} object could also be used.
|
|||
|
||||
\class{MimeWriter} instances have the following methods:
|
||||
|
||||
\begin{methoddesc}{addheader}{key, value\optional{, prefix}}
|
||||
\begin{methoddesc}[MimeWriter]{addheader}{key, value\optional{, prefix}}
|
||||
Add a header line to the MIME message. The \var{key} is the name of
|
||||
the header, where the \var{value} obviously provides the value of the
|
||||
header. The optional argument \var{prefix} determines where the header
|
||||
|
@ -39,14 +39,14 @@ is inserted; \samp{0} means append at the end, \samp{1} is insert at
|
|||
the start. The default is to append.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{flushheaders}{}
|
||||
\begin{methoddesc}[MimeWriter]{flushheaders}{}
|
||||
Causes all headers accumulated so far to be written out (and
|
||||
forgotten). This is useful if you don't need a body part at all,
|
||||
e.g.\ for a subpart of type \mimetype{message/rfc822} that's (mis)used
|
||||
to store some header-like information.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{startbody}{ctype\optional{, plist\optional{, prefix}}}
|
||||
\begin{methoddesc}[MimeWriter]{startbody}{ctype\optional{, plist\optional{, prefix}}}
|
||||
Returns a file-like object which can be used to write to the
|
||||
body of the message. The content-type is set to the provided
|
||||
\var{ctype}, and the optional parameter \var{plist} provides
|
||||
|
@ -55,8 +55,8 @@ functions as in \method{addheader()} except that the default is to
|
|||
insert at the start.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{startmultipartbody}{subtype\optional{,
|
||||
boundary\optional{, plist\optional{, prefix}}}}
|
||||
\begin{methoddesc}[MimeWriter]{startmultipartbody}{subtype\optional{,
|
||||
boundary\optional{, plist\optional{, prefix}}}}
|
||||
Returns a file-like object which can be used to write to the
|
||||
body of the message. Additionally, this method initializes the
|
||||
multi-part code, where \var{subtype} provides the multipart subtype,
|
||||
|
@ -66,7 +66,7 @@ multi-part code, where \var{subtype} provides the multipart subtype,
|
|||
created using \method{nextpart()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{nextpart}{}
|
||||
\begin{methoddesc}[MimeWriter]{nextpart}{}
|
||||
Returns a new instance of \class{MimeWriter} which represents an
|
||||
individual part in a multipart message. This may be used to write the
|
||||
part as well as used for creating recursively complex multipart
|
||||
|
@ -74,7 +74,7 @@ messages. The message must first be initialized with
|
|||
\method{startmultipartbody()} before using \method{nextpart()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{lastpart}{}
|
||||
\begin{methoddesc}[MimeWriter]{lastpart}{}
|
||||
This is used to designate the last part of a multipart message, and
|
||||
should \emph{always} be used when writing multipart messages.
|
||||
\end{methoddesc}
|
||||
|
|
|
@ -121,17 +121,17 @@ MSI routines, and standard table structures.
|
|||
|
||||
\subsection{Database Objects\label{database-objects}}
|
||||
|
||||
\begin{methoddesc}{OpenView}{sql}
|
||||
\begin{methoddesc}[Database]{OpenView}{sql}
|
||||
Return a view object, by calling \cfunction{MSIDatabaseOpenView}.
|
||||
\var{sql} is the SQL statement to execute.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{Commit}{}
|
||||
\begin{methoddesc}[Database]{Commit}{}
|
||||
Commit the changes pending in the current transaction,
|
||||
by calling \cfunction{MSIDatabaseCommit}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{GetSummaryInformation}{count}
|
||||
\begin{methoddesc}[Database]{GetSummaryInformation}{count}
|
||||
Return a new summary information object, by calling
|
||||
\cfunction{MsiGetSummaryInformation}. \var{count} is the maximum number of
|
||||
updated values.
|
||||
|
@ -145,24 +145,24 @@ MSI routines, and standard table structures.
|
|||
|
||||
\subsection{View Objects\label{view-objects}}
|
||||
|
||||
\begin{methoddesc}{Execute}{\optional{params=None}}
|
||||
\begin{methoddesc}[View]{Execute}{\optional{params=None}}
|
||||
Execute the SQL query of the view, through \cfunction{MSIViewExecute}.
|
||||
\var{params} is an optional record describing actual values
|
||||
of the parameter tokens in the query.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{GetColumnInfo}{kind}
|
||||
\begin{methoddesc}[View]{GetColumnInfo}{kind}
|
||||
Return a record describing the columns of the view, through
|
||||
calling \cfunction{MsiViewGetColumnInfo}. \var{kind} can be either
|
||||
\code{MSICOLINFO_NAMES} or \code{MSICOLINFO_TYPES}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{Fetch}{}
|
||||
\begin{methoddesc}[View]{Fetch}{}
|
||||
Return a result record of the query, through calling
|
||||
\cfunction{MsiViewFetch}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{Modify}{kind, data}
|
||||
\begin{methoddesc}[View]{Modify}{kind, data}
|
||||
Modify the view, by calling \cfunction{MsiViewModify}. \var{kind}
|
||||
can be one of \code{MSIMODIFY_SEEK}, \code{MSIMODIFY_REFRESH},
|
||||
\code{MSIMODIFY_INSERT}, \code{MSIMODIFY_UPDATE}, \code{MSIMODIFY_ASSIGN},
|
||||
|
@ -174,7 +174,7 @@ MSI routines, and standard table structures.
|
|||
\var{data} must be a record describing the new data.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{Close}{}
|
||||
\begin{methoddesc}[View]{Close}{}
|
||||
Close the view, through \cfunction{MsiViewClose}.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -188,7 +188,7 @@ MSI routines, and standard table structures.
|
|||
|
||||
\subsection{Summary Information Objects\label{summary-objects}}
|
||||
|
||||
\begin{methoddesc}{GetProperty}{field}
|
||||
\begin{methoddesc}[SummaryInformation]{GetProperty}{field}
|
||||
Return a property of the summary, through \cfunction{MsiSummaryInfoGetProperty}.
|
||||
\var{field} is the name of the property, and can be one of the
|
||||
constants
|
||||
|
@ -200,19 +200,19 @@ MSI routines, and standard table structures.
|
|||
\code{PID_APPNAME}, or \code{PID_SECURITY}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{GetPropertyCount}{}
|
||||
\begin{methoddesc}[SummaryInformation]{GetPropertyCount}{}
|
||||
Return the number of summary properties, through
|
||||
\cfunction{MsiSummaryInfoGetPropertyCount}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{SetProperty}{field, value}
|
||||
\begin{methoddesc}[SummaryInformation]{SetProperty}{field, value}
|
||||
Set a property through \cfunction{MsiSummaryInfoSetProperty}. \var{field}
|
||||
can have the same values as in \method{GetProperty}, \var{value}
|
||||
is the new value of the property. Possible value types are integer
|
||||
and string.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{Persist}{}
|
||||
\begin{methoddesc}[SummaryInformation]{Persist}{}
|
||||
Write the modified properties to the summary information stream,
|
||||
using \cfunction{MsiSummaryInfoPersist}.
|
||||
\end{methoddesc}
|
||||
|
@ -226,27 +226,27 @@ MSI routines, and standard table structures.
|
|||
|
||||
\subsection{Record Objects\label{record-objects}}
|
||||
|
||||
\begin{methoddesc}{GetFieldCount}{}
|
||||
\begin{methoddesc}[Record]{GetFieldCount}{}
|
||||
Return the number of fields of the record, through \cfunction{MsiRecordGetFieldCount}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{SetString}{field, value}
|
||||
\begin{methoddesc}[Record]{SetString}{field, value}
|
||||
Set \var{field} to \var{value} through \cfunction{MsiRecordSetString}.
|
||||
\var{field} must be an integer; \var{value} a string.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{SetStream}{field, value}
|
||||
\begin{methoddesc}[Record]{SetStream}{field, value}
|
||||
Set \var{field} to the contents of the file named \var{value},
|
||||
through \cfunction{MsiRecordSetStream}.
|
||||
\var{field} must be an integer; \var{value} a string.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{SetInteger}{field, value}
|
||||
\begin{methoddesc}[Record]{SetInteger}{field, value}
|
||||
Set \var{field} to \var{value} through \cfunction{MsiRecordSetInteger}.
|
||||
Both \var{field} and \var{value} must be an integer.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{ClearData}{}
|
||||
\begin{methoddesc}[Record]{ClearData}{}
|
||||
Set all fields of the record to 0, through \cfunction{MsiRecordClearData}.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -274,7 +274,7 @@ the string inside the exception will contain more detail.
|
|||
\var{name} is the name of the CAB file in the MSI file.
|
||||
\end{classdesc}
|
||||
|
||||
\begin{methoddesc}[CAB]{append}{full, logical}
|
||||
\begin{methoddesc}[CAB]{append}{full, file, logical}
|
||||
Add the file with the pathname \var{full} to the CAB file,
|
||||
under the name \var{logical}. If there is already a file
|
||||
named \var{logical}, a new file name is created.
|
||||
|
@ -283,7 +283,7 @@ the string inside the exception will contain more detail.
|
|||
new name of the file inside the CAB file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[CAB]{append}{database}
|
||||
\begin{methoddesc}[CAB]{commit}{database}
|
||||
Generate a CAB file, add it as a stream to the MSI file,
|
||||
put it into the \code{Media} table, and remove the generated
|
||||
file from the disk.
|
||||
|
|
|
@ -48,7 +48,7 @@ own pattern for section-divider and end-marker lines.
|
|||
|
||||
A \class{MultiFile} instance has the following methods:
|
||||
|
||||
\begin{methoddesc}{readline}{str}
|
||||
\begin{methoddesc}[MultiFile]{readline}{str}
|
||||
Read a line. If the line is data (not a section-divider or end-marker
|
||||
or real EOF) return it. If the line matches the most-recently-stacked
|
||||
boundary, return \code{''} and set \code{self.last} to 1 or 0 according as
|
||||
|
@ -58,33 +58,33 @@ underlying stream object, the method raises \exception{Error} unless
|
|||
all boundaries have been popped.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{readlines}{str}
|
||||
\begin{methoddesc}[MultiFile]{readlines}{str}
|
||||
Return all lines remaining in this part as a list of strings.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read}{}
|
||||
\begin{methoddesc}[MultiFile]{read}{}
|
||||
Read all lines, up to the next section. Return them as a single
|
||||
(multiline) string. Note that this doesn't take a size argument!
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{seek}{pos\optional{, whence}}
|
||||
\begin{methoddesc}[MultiFile]{seek}{pos\optional{, whence}}
|
||||
Seek. Seek indices are relative to the start of the current section.
|
||||
The \var{pos} and \var{whence} arguments are interpreted as for a file
|
||||
seek.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{tell}{}
|
||||
\begin{methoddesc}[MultiFile]{tell}{}
|
||||
Return the file position relative to the start of the current section.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{next}{}
|
||||
\begin{methoddesc}[MultiFile]{next}{}
|
||||
Skip lines to the next section (that is, read lines until a
|
||||
section-divider or end-marker has been consumed). Return true if
|
||||
there is such a section, false if an end-marker is seen. Re-enable
|
||||
the most-recently-pushed boundary.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{is_data}{str}
|
||||
\begin{methoddesc}[MultiFile]{is_data}{str}
|
||||
Return true if \var{str} is data and false if it might be a section
|
||||
boundary. As written, it tests for a prefix other than \code{'-}\code{-'} at
|
||||
start of line (which all MIME boundaries have) but it is declared so
|
||||
|
@ -95,7 +95,7 @@ boundary tests; if it always returns false it will merely slow
|
|||
processing, not cause it to fail.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{push}{str}
|
||||
\begin{methoddesc}[MultiFile]{push}{str}
|
||||
Push a boundary string. When a decorated version of this boundary
|
||||
is found as an input line, it will be interpreted as a section-divider
|
||||
or end-marker (depending on the decoration, see \rfc{2045}). All subsequent
|
||||
|
@ -108,12 +108,12 @@ most-recently-pushed boundary will return EOF; encountering any other
|
|||
boundary will raise an error.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{pop}{}
|
||||
\begin{methoddesc}[MultiFile]{pop}{}
|
||||
Pop a section boundary. This boundary will no longer be interpreted
|
||||
as EOF.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{section_divider}{str}
|
||||
\begin{methoddesc}[MultiFile]{section_divider}{str}
|
||||
Turn a boundary into a section-divider line. By default, this
|
||||
method prepends \code{'-}\code{-'} (which MIME section boundaries have) but
|
||||
it is declared so it can be overridden in derived classes. This
|
||||
|
@ -121,7 +121,7 @@ method need not append LF or CR-LF, as comparison with the result
|
|||
ignores trailing whitespace.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{end_marker}{str}
|
||||
\begin{methoddesc}[MultiFile]{end_marker}{str}
|
||||
Turn a boundary string into an end-marker line. By default, this
|
||||
method prepends \code{'-}\code{-'} and appends \code{'-}\code{-'} (like a
|
||||
MIME-multipart end-of-message marker) but it is declared so it can be
|
||||
|
@ -131,11 +131,11 @@ CR-LF, as comparison with the result ignores trailing whitespace.
|
|||
|
||||
Finally, \class{MultiFile} instances have two public instance variables:
|
||||
|
||||
\begin{memberdesc}{level}
|
||||
\begin{memberdesc}[MultiFile]{level}
|
||||
Nesting depth of the current part.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{last}
|
||||
\begin{memberdesc}[MultiFile]{last}
|
||||
True if the last end-of-file was for an end-of-message marker.
|
||||
\end{memberdesc}
|
||||
|
||||
|
|
|
@ -35,23 +35,23 @@ acquired.
|
|||
|
||||
\class{mutex} objects have following methods:
|
||||
|
||||
\begin{methoddesc}{test}{}
|
||||
\begin{methoddesc}[mutex]{test}{}
|
||||
Check whether the mutex is locked.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{testandset}{}
|
||||
\begin{methoddesc}[mutex]{testandset}{}
|
||||
``Atomic'' test-and-set, grab the lock if it is not set,
|
||||
and return \code{True}, otherwise, return \code{False}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{lock}{function, argument}
|
||||
\begin{methoddesc}[mutex]{lock}{function, argument}
|
||||
Execute \code{\var{function}(\var{argument})}, unless the mutex is locked.
|
||||
In the case it is locked, place the function and argument on the queue.
|
||||
See \method{unlock} for explanation of when
|
||||
\code{\var{function}(\var{argument})} is executed in that case.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{unlock}{}
|
||||
\begin{methoddesc}[mutex]{unlock}{}
|
||||
Unlock the mutex if queue is empty, otherwise execute the first element
|
||||
in the queue.
|
||||
\end{methoddesc}
|
||||
|
|
|
@ -35,7 +35,7 @@ of the error, \member{filename} is the name of the source file, and
|
|||
|
||||
A \class{netrc} instance has the following methods:
|
||||
|
||||
\begin{methoddesc}{authenticators}{host}
|
||||
\begin{methoddesc}[netrc]{authenticators}{host}
|
||||
Return a 3-tuple \code{(\var{login}, \var{account}, \var{password})}
|
||||
of authenticators for \var{host}. If the netrc file did not
|
||||
contain an entry for the given host, return the tuple associated with
|
||||
|
@ -43,20 +43,20 @@ the `default' entry. If neither matching host nor default entry is
|
|||
available, return \code{None}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{__repr__}{}
|
||||
\begin{methoddesc}[netrc]{__repr__}{}
|
||||
Dump the class data as a string in the format of a netrc file.
|
||||
(This discards comments and may reorder the entries.)
|
||||
\end{methoddesc}
|
||||
|
||||
Instances of \class{netrc} have public instance variables:
|
||||
|
||||
\begin{memberdesc}{hosts}
|
||||
\begin{memberdesc}[netrc]{hosts}
|
||||
Dictionary mapping host names to \code{(\var{login}, \var{account},
|
||||
\var{password})} tuples. The `default' entry, if any, is represented
|
||||
as a pseudo-host by that name.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{macros}
|
||||
\begin{memberdesc}[netrc]{macros}
|
||||
Dictionary mapping macro names to string lists.
|
||||
\end{memberdesc}
|
||||
|
||||
|
|
|
@ -121,13 +121,13 @@ If the server's response indicates an error, the method raises one of
|
|||
the above exceptions.
|
||||
|
||||
|
||||
\begin{methoddesc}{getwelcome}{}
|
||||
\begin{methoddesc}[NNTP]{getwelcome}{}
|
||||
Return the welcome message sent by the server in reply to the initial
|
||||
connection. (This message sometimes contains disclaimers or help
|
||||
information that may be relevant to the user.)
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set_debuglevel}{level}
|
||||
\begin{methoddesc}[NNTP]{set_debuglevel}{level}
|
||||
Set the instance's debugging level. This controls the amount of
|
||||
debugging output printed. The default, \code{0}, produces no debugging
|
||||
output. A value of \code{1} produces a moderate amount of debugging
|
||||
|
@ -137,7 +137,7 @@ logging each line sent and received on the connection (including
|
|||
message text).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{newgroups}{date, time, \optional{file}}
|
||||
\begin{methoddesc}[NNTP]{newgroups}{date, time, \optional{file}}
|
||||
Send a \samp{NEWGROUPS} command. The \var{date} argument should be a
|
||||
string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the
|
||||
date, and \var{time} should be a string of the form
|
||||
|
@ -152,7 +152,7 @@ calling \method{write()} on it to store the lines of the command output.
|
|||
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{newnews}{group, date, time, \optional{file}}
|
||||
\begin{methoddesc}[NNTP]{newnews}{group, date, time, \optional{file}}
|
||||
Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or
|
||||
\code{'*'}, and \var{date} and \var{time} have the same meaning as for
|
||||
\method{newgroups()}. Return a pair \code{(\var{response},
|
||||
|
@ -165,7 +165,7 @@ calling \method{write()} on it to store the lines of the command output.
|
|||
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{list}{\optional{file}}
|
||||
\begin{methoddesc}[NNTP]{list}{\optional{file}}
|
||||
Send a \samp{LIST} command. Return a pair \code{(\var{response},
|
||||
\var{list})} where \var{list} is a list of tuples. Each tuple has the
|
||||
form \code{(\var{group}, \var{last}, \var{first}, \var{flag})}, where
|
||||
|
@ -182,7 +182,7 @@ calling \method{write()} on it to store the lines of the command output.
|
|||
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{descriptions}{grouppattern}
|
||||
\begin{methoddesc}[NNTP]{descriptions}{grouppattern}
|
||||
Send a \samp{LIST NEWSGROUPS} command, where \var{grouppattern} is a wildmat
|
||||
string as specified in RFC2980 (it's essentially the same as DOS or UNIX
|
||||
shell wildcard strings). Return a pair \code{(\var{response},
|
||||
|
@ -192,7 +192,7 @@ shell wildcard strings). Return a pair \code{(\var{response},
|
|||
\versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{description}{group}
|
||||
\begin{methoddesc}[NNTP]{description}{group}
|
||||
Get a description for a single group \var{group}. If more than one group
|
||||
matches (if 'group' is a real wildmat string), return the first match.
|
||||
If no group matches, return an empty string.
|
||||
|
@ -203,7 +203,7 @@ needed, use \method{descriptions()}.
|
|||
\versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{group}{name}
|
||||
\begin{methoddesc}[NNTP]{group}{name}
|
||||
Send a \samp{GROUP} command, where \var{name} is the group name.
|
||||
Return a tuple \code{(\var{response}, \var{count}, \var{first},
|
||||
\var{last}, \var{name})} where \var{count} is the (estimated) number
|
||||
|
@ -212,7 +212,7 @@ the group, \var{last} is the last article number in the group, and
|
|||
\var{name} is the group name. The numbers are returned as strings.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{help}{\optional{file}}
|
||||
\begin{methoddesc}[NNTP]{help}{\optional{file}}
|
||||
Send a \samp{HELP} command. Return a pair \code{(\var{response},
|
||||
\var{list})} where \var{list} is a list of help strings.
|
||||
If the \var{file} parameter is supplied, then the output of the
|
||||
|
@ -223,7 +223,7 @@ calling \method{write()} on it to store the lines of the command output.
|
|||
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{stat}{id}
|
||||
\begin{methoddesc}[NNTP]{stat}{id}
|
||||
Send a \samp{STAT} command, where \var{id} is the message id (enclosed
|
||||
in \character{<} and \character{>}) or an article number (as a string).
|
||||
Return a triple \code{(\var{response}, \var{number}, \var{id})} where
|
||||
|
@ -231,15 +231,15 @@ Return a triple \code{(\var{response}, \var{number}, \var{id})} where
|
|||
message id (enclosed in \character{<} and \character{>}).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{next}{}
|
||||
\begin{methoddesc}[NNTP]{next}{}
|
||||
Send a \samp{NEXT} command. Return as for \method{stat()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{last}{}
|
||||
\begin{methoddesc}[NNTP]{last}{}
|
||||
Send a \samp{LAST} command. Return as for \method{stat()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{head}{id}
|
||||
\begin{methoddesc}[NNTP]{head}{id}
|
||||
Send a \samp{HEAD} command, where \var{id} has the same meaning as for
|
||||
\method{stat()}. Return a tuple
|
||||
\code{(\var{response}, \var{number}, \var{id}, \var{list})}
|
||||
|
@ -248,7 +248,7 @@ and \var{list} is a list of the article's headers (an uninterpreted
|
|||
list of lines, without trailing newlines).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{body}{id,\optional{file}}
|
||||
\begin{methoddesc}[NNTP]{body}{id,\optional{file}}
|
||||
Send a \samp{BODY} command, where \var{id} has the same meaning as for
|
||||
\method{stat()}. If the \var{file} parameter is supplied, then
|
||||
the body is stored in a file. If \var{file} is a string, then
|
||||
|
@ -259,16 +259,16 @@ Return as for \method{head()}. If \var{file} is supplied, then
|
|||
the returned \var{list} is an empty list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{article}{id}
|
||||
\begin{methoddesc}[NNTP]{article}{id}
|
||||
Send an \samp{ARTICLE} command, where \var{id} has the same meaning as
|
||||
for \method{stat()}. Return as for \method{head()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{slave}{}
|
||||
\begin{methoddesc}[NNTP]{slave}{}
|
||||
Send a \samp{SLAVE} command. Return the server's \var{response}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{xhdr}{header, string, \optional{file}}
|
||||
\begin{methoddesc}[NNTP]{xhdr}{header, string, \optional{file}}
|
||||
Send an \samp{XHDR} command. This command is not defined in the RFC
|
||||
but is a common extension. The \var{header} argument is a header
|
||||
keyword, e.g. \code{'subject'}. The \var{string} argument should have
|
||||
|
@ -286,7 +286,7 @@ calling \method{write()} on it to store the lines of the command output.
|
|||
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{post}{file}
|
||||
\begin{methoddesc}[NNTP]{post}{file}
|
||||
Post an article using the \samp{POST} command. The \var{file}
|
||||
argument is an open file object which is read until EOF using its
|
||||
\method{readline()} method. It should be a well-formed news article,
|
||||
|
@ -294,14 +294,14 @@ including the required headers. The \method{post()} method
|
|||
automatically escapes lines beginning with \samp{.}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{ihave}{id, file}
|
||||
\begin{methoddesc}[NNTP]{ihave}{id, file}
|
||||
Send an \samp{IHAVE} command. \var{id} is a message id (enclosed in
|
||||
\character{<} and \character{>}).
|
||||
If the response is not an error, treat
|
||||
\var{file} exactly as for the \method{post()} method.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{date}{}
|
||||
\begin{methoddesc}[NNTP]{date}{}
|
||||
Return a triple \code{(\var{response}, \var{date}, \var{time})},
|
||||
containing the current date and time in a form suitable for the
|
||||
\method{newnews()} and \method{newgroups()} methods.
|
||||
|
@ -309,7 +309,7 @@ This is an optional NNTP extension, and may not be supported by all
|
|||
servers.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{xgtitle}{name, \optional{file}}
|
||||
\begin{methoddesc}[NNTP]{xgtitle}{name, \optional{file}}
|
||||
Process an \samp{XGTITLE} command, returning a pair \code{(\var{response},
|
||||
\var{list})}, where \var{list} is a list of tuples containing
|
||||
\code{(\var{name}, \var{title})}.
|
||||
|
@ -327,7 +327,7 @@ RFC2980 says ``It is suggested that this extension be deprecated''. Use
|
|||
\method{descriptions()} or \method{description()} instead.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{xover}{start, end, \optional{file}}
|
||||
\begin{methoddesc}[NNTP]{xover}{start, end, \optional{file}}
|
||||
Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list
|
||||
of tuples, one for each article in the range delimited by the \var{start}
|
||||
and \var{end} article numbers. Each tuple is of the form
|
||||
|
@ -343,13 +343,13 @@ This is an optional NNTP extension, and may not be supported by all
|
|||
servers.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{xpath}{id}
|
||||
\begin{methoddesc}[NNTP]{xpath}{id}
|
||||
Return a pair \code{(\var{resp}, \var{path})}, where \var{path} is the
|
||||
directory path to the article with message ID \var{id}. This is an
|
||||
optional NNTP extension, and may not be supported by all servers.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{quit}{}
|
||||
\begin{methoddesc}[NNTP]{quit}{}
|
||||
Send a \samp{QUIT} command and close the connection. Once this method
|
||||
has been called, no other methods of the NNTP object should be called.
|
||||
\end{methoddesc}
|
||||
|
|
|
@ -39,21 +39,21 @@ Example:
|
|||
|
||||
Template objects following methods:
|
||||
|
||||
\begin{methoddesc}{reset}{}
|
||||
\begin{methoddesc}[Template]{reset}{}
|
||||
Restore a pipeline template to its initial state.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{clone}{}
|
||||
\begin{methoddesc}[Template]{clone}{}
|
||||
Return a new, equivalent, pipeline template.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{debug}{flag}
|
||||
\begin{methoddesc}[Template]{debug}{flag}
|
||||
If \var{flag} is true, turn debugging on. Otherwise, turn debugging
|
||||
off. When debugging is on, commands to be executed are printed, and
|
||||
the shell is given \code{set -x} command to be more verbose.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{append}{cmd, kind}
|
||||
\begin{methoddesc}[Template]{append}{cmd, kind}
|
||||
Append a new action at the end. The \var{cmd} variable must be a valid
|
||||
bourne shell command. The \var{kind} variable consists of two letters.
|
||||
|
||||
|
@ -68,17 +68,17 @@ command writes a file on the command line) or \code{'.'} (which means
|
|||
the command does not write anything, and hence must be last.)
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{prepend}{cmd, kind}
|
||||
\begin{methoddesc}[Template]{prepend}{cmd, kind}
|
||||
Add a new action at the beginning. See \method{append()} for explanations
|
||||
of the arguments.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{open}{file, mode}
|
||||
\begin{methoddesc}[Template]{open}{file, mode}
|
||||
Return a file-like object, open to \var{file}, but read from or
|
||||
written to by the pipeline. Note that only one of \code{'r'},
|
||||
\code{'w'} may be given.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{copy}{infile, outfile}
|
||||
\begin{methoddesc}[Template]{copy}{infile, outfile}
|
||||
Copy \var{infile} to \var{outfile} through the pipe.
|
||||
\end{methoddesc}
|
||||
|
|
|
@ -84,12 +84,12 @@ using \function{popen4()}.
|
|||
Instances of the \class{Popen3} and \class{Popen4} classes have the
|
||||
following methods:
|
||||
|
||||
\begin{methoddesc}{poll}{}
|
||||
\begin{methoddesc}[Popen3]{poll}{}
|
||||
Returns \code{-1} if child process hasn't completed yet, or its return
|
||||
code otherwise.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{wait}{}
|
||||
\begin{methoddesc}[Popen3]{wait}{}
|
||||
Waits for and returns the status code of the child process. The
|
||||
status code encodes both the return code of the process and
|
||||
information about whether it exited using the \cfunction{exit()}
|
||||
|
@ -101,24 +101,24 @@ status code are defined in the \refmodule{os} module; see section
|
|||
|
||||
The following attributes are also available:
|
||||
|
||||
\begin{memberdesc}{fromchild}
|
||||
\begin{memberdesc}[Popen3]{fromchild}
|
||||
A file object that provides output from the child process. For
|
||||
\class{Popen4} instances, this will provide both the standard output
|
||||
and standard error streams.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{tochild}
|
||||
\begin{memberdesc}[Popen3]{tochild}
|
||||
A file object that provides input to the child process.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{childerr}
|
||||
\begin{memberdesc}[Popen3]{childerr}
|
||||
A file object that provides error output from the child process, if
|
||||
\var{capturestderr} was true for the constructor, otherwise
|
||||
\code{None}. This will always be \code{None} for \class{Popen4}
|
||||
instances.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{pid}
|
||||
\begin{memberdesc}[Popen3]{pid}
|
||||
The process ID of the child process.
|
||||
\end{memberdesc}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ in lower-case; most return the response text sent by the server.
|
|||
An \class{POP3} instance has the following methods:
|
||||
|
||||
|
||||
\begin{methoddesc}{set_debuglevel}{level}
|
||||
\begin{methoddesc}[POP3]{set_debuglevel}{level}
|
||||
Set the instance's debugging level. This controls the amount of
|
||||
debugging output printed. The default, \code{0}, produces no
|
||||
debugging output. A value of \code{1} produces a moderate amount of
|
||||
|
@ -82,64 +82,64 @@ debugging output, generally a single line per request. A value of
|
|||
logging each line sent and received on the control connection.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getwelcome}{}
|
||||
\begin{methoddesc}[POP3]{getwelcome}{}
|
||||
Returns the greeting string sent by the POP3 server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{user}{username}
|
||||
\begin{methoddesc}[POP3]{user}{username}
|
||||
Send user command, response should indicate that a password is required.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{pass_}{password}
|
||||
\begin{methoddesc}[POP3]{pass_}{password}
|
||||
Send password, response includes message count and mailbox size.
|
||||
Note: the mailbox on the server is locked until \method{quit()} is
|
||||
called.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{apop}{user, secret}
|
||||
\begin{methoddesc}[POP3]{apop}{user, secret}
|
||||
Use the more secure APOP authentication to log into the POP3 server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{rpop}{user}
|
||||
\begin{methoddesc}[POP3]{rpop}{user}
|
||||
Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{stat}{}
|
||||
\begin{methoddesc}[POP3]{stat}{}
|
||||
Get mailbox status. The result is a tuple of 2 integers:
|
||||
\code{(\var{message count}, \var{mailbox size})}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{list}{\optional{which}}
|
||||
\begin{methoddesc}[POP3]{list}{\optional{which}}
|
||||
Request message list, result is in the form
|
||||
\code{(\var{response}, ['mesg_num octets', ...], \var{octets})}.
|
||||
If \var{which} is set, it is the message to list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{retr}{which}
|
||||
\begin{methoddesc}[POP3]{retr}{which}
|
||||
Retrieve whole message number \var{which}, and set its seen flag.
|
||||
Result is in form \code{(\var{response}, ['line', ...], \var{octets})}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{dele}{which}
|
||||
\begin{methoddesc}[POP3]{dele}{which}
|
||||
Flag message number \var{which} for deletion. On most servers
|
||||
deletions are not actually performed until QUIT (the major exception is
|
||||
Eudora QPOP, which deliberately violates the RFCs by doing pending
|
||||
deletes on any disconnect).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{rset}{}
|
||||
\begin{methoddesc}[POP3]{rset}{}
|
||||
Remove any deletion marks for the mailbox.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{noop}{}
|
||||
\begin{methoddesc}[POP3]{noop}{}
|
||||
Do nothing. Might be used as a keep-alive.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{quit}{}
|
||||
\begin{methoddesc}[POP3]{quit}{}
|
||||
Signoff: commit changes, unlock mailbox, drop connection.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{top}{which, howmuch}
|
||||
\begin{methoddesc}[POP3]{top}{which, howmuch}
|
||||
Retrieves the message header plus \var{howmuch} lines of the message
|
||||
after the header of message number \var{which}. Result is in form
|
||||
\code{(\var{response}, ['line', ...], \var{octets})}.
|
||||
|
@ -151,7 +151,7 @@ Test this method by hand against the POP3 servers you will use before
|
|||
trusting it.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{uidl}{\optional{which}}
|
||||
\begin{methoddesc}[POP3]{uidl}{\optional{which}}
|
||||
Return message digest (unique id) list.
|
||||
If \var{which} is specified, result contains the unique id for that
|
||||
message in the form \code{'\var{response}\ \var{mesgnum}\ \var{uid}},
|
||||
|
|
|
@ -158,12 +158,12 @@ l/lib/python1.5/test', '/usr/local/lib/python1.5/sunos5', '/usr/local/lib/python
|
|||
\class{PrettyPrinter} instances have the following methods:
|
||||
|
||||
|
||||
\begin{methoddesc}{pformat}{object}
|
||||
\begin{methoddesc}[PrettyPrinter]{pformat}{object}
|
||||
Return the formatted representation of \var{object}. This takes into
|
||||
account the options passed to the \class{PrettyPrinter} constructor.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{pprint}{object}
|
||||
\begin{methoddesc}[PrettyPrinter]{pprint}{object}
|
||||
Print the formatted representation of \var{object} on the configured
|
||||
stream, followed by a newline.
|
||||
\end{methoddesc}
|
||||
|
@ -173,7 +173,7 @@ corresponding functions of the same names. Using these methods on an
|
|||
instance is slightly more efficient since new \class{PrettyPrinter}
|
||||
objects don't need to be created.
|
||||
|
||||
\begin{methoddesc}{isreadable}{object}
|
||||
\begin{methoddesc}[PrettyPrinter]{isreadable}{object}
|
||||
Determine if the formatted representation of the object is
|
||||
``readable,'' or can be used to reconstruct the value using
|
||||
\function{eval()}\bifuncindex{eval}. Note that this returns false for
|
||||
|
@ -182,7 +182,7 @@ recursive objects. If the \var{depth} parameter of the
|
|||
this returns false.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{isrecursive}{object}
|
||||
\begin{methoddesc}[PrettyPrinter]{isrecursive}{object}
|
||||
Determine if the object requires a recursive representation.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -190,7 +190,7 @@ This method is provided as a hook to allow subclasses to modify the
|
|||
way objects are converted to strings. The default implementation uses
|
||||
the internals of the \function{saferepr()} implementation.
|
||||
|
||||
\begin{methoddesc}{format}{object, context, maxlevels, level}
|
||||
\begin{methoddesc}[PrettyPrinter]{format}{object, context, maxlevels, level}
|
||||
Returns three values: the formatted version of \var{object} as a
|
||||
string, a flag indicating whether the result is readable, and a flag
|
||||
indicating whether recursion was detected. The first argument is the
|
||||
|
|
|
@ -45,22 +45,22 @@ other queue organizations (e.g. stack) but the inheritable interface
|
|||
is not described here. See the source code for details. The public
|
||||
methods are:
|
||||
|
||||
\begin{methoddesc}{qsize}{}
|
||||
\begin{methoddesc}[Queue]{qsize}{}
|
||||
Return the approximate size of the queue. Because of multithreading
|
||||
semantics, this number is not reliable.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{empty}{}
|
||||
\begin{methoddesc}[Queue]{empty}{}
|
||||
Return \code{True} if the queue is empty, \code{False} otherwise.
|
||||
Because of multithreading semantics, this is not reliable.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{full}{}
|
||||
\begin{methoddesc}[Queue]{full}{}
|
||||
Return \code{True} if the queue is full, \code{False} otherwise.
|
||||
Because of multithreading semantics, this is not reliable.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{put}{item\optional{, block\optional{, timeout}}}
|
||||
\begin{methoddesc}[Queue]{put}{item\optional{, block\optional{, timeout}}}
|
||||
Put \var{item} into the queue. If optional args \var{block} is true
|
||||
and \var{timeout} is None (the default), block if necessary until a
|
||||
free slot is available. If \var{timeout} is a positive number, it
|
||||
|
@ -74,11 +74,11 @@ exception (\var{timeout} is ignored in that case).
|
|||
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{put_nowait}{item}
|
||||
\begin{methoddesc}[Queue]{put_nowait}{item}
|
||||
Equivalent to \code{put(\var{item}, False)}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{get}{\optional{block\optional{, timeout}}}
|
||||
\begin{methoddesc}[Queue]{get}{\optional{block\optional{, timeout}}}
|
||||
Remove and return an item from the queue. If optional args
|
||||
\var{block} is true and \var{timeout} is None (the default),
|
||||
block if necessary until an item is available. If \var{timeout} is
|
||||
|
@ -92,14 +92,14 @@ immediately available, else raise the \exception{Empty} exception
|
|||
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{get_nowait}{}
|
||||
\begin{methoddesc}[Queue]{get_nowait}{}
|
||||
Equivalent to \code{get(False)}.
|
||||
\end{methoddesc}
|
||||
|
||||
Two methods are offered to support tracking whether enqueued tasks have
|
||||
been fully processed by daemon consumer threads.
|
||||
|
||||
\begin{methoddesc}{task_done}{}
|
||||
\begin{methoddesc}[Queue]{task_done}{}
|
||||
Indicate that a formerly enqueued task is complete. Used by queue consumer
|
||||
threads. For each \method{get()} used to fetch a task, a subsequent call to
|
||||
\method{task_done()} tells the queue that the processing on the task is complete.
|
||||
|
@ -113,7 +113,7 @@ placed in the queue.
|
|||
\versionadded{2.5}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{join}{}
|
||||
\begin{methoddesc}[Queue]{join}{}
|
||||
Blocks until all items in the queue have been gotten and processed.
|
||||
|
||||
The count of unfinished tasks goes up whenever an item is added to the
|
||||
|
|
|
@ -44,18 +44,18 @@ provide size limits for the representations of different object types,
|
|||
and methods which format specific object types.
|
||||
|
||||
|
||||
\begin{memberdesc}{maxlevel}
|
||||
\begin{memberdesc}[Repr]{maxlevel}
|
||||
Depth limit on the creation of recursive representations. The
|
||||
default is \code{6}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{maxdict}
|
||||
\memberline{maxlist}
|
||||
\memberline{maxtuple}
|
||||
\memberline{maxset}
|
||||
\memberline{maxfrozenset}
|
||||
\memberline{maxdeque}
|
||||
\memberline{maxarray}
|
||||
\begin{memberdesc}[Repr]{maxdict}
|
||||
\memberline[Repr]{maxlist}
|
||||
\memberline[Repr]{maxtuple}
|
||||
\memberline[Repr]{maxset}
|
||||
\memberline[Repr]{maxfrozenset}
|
||||
\memberline[Repr]{maxdeque}
|
||||
\memberline[Repr]{maxarray}
|
||||
Limits on the number of entries represented for the named object
|
||||
type. The default is \code{4} for \member{maxdict}, \code{5} for
|
||||
\member{maxarray}, and \code{6} for the others.
|
||||
|
@ -63,13 +63,13 @@ and methods which format specific object types.
|
|||
and \member{set}]{2.4}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{maxlong}
|
||||
\begin{memberdesc}[Repr]{maxlong}
|
||||
Maximum number of characters in the representation for a long
|
||||
integer. Digits are dropped from the middle. The default is
|
||||
\code{40}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{maxstring}
|
||||
\begin{memberdesc}[Repr]{maxstring}
|
||||
Limit on the number of characters in the representation of the
|
||||
string. Note that the ``normal'' representation of the string is
|
||||
used as the character source: if escape sequences are needed in the
|
||||
|
@ -77,19 +77,19 @@ and methods which format specific object types.
|
|||
shortened. The default is \code{30}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{maxother}
|
||||
\begin{memberdesc}[Repr]{maxother}
|
||||
This limit is used to control the size of object types for which no
|
||||
specific formatting method is available on the \class{Repr} object.
|
||||
It is applied in a similar manner as \member{maxstring}. The
|
||||
default is \code{20}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{methoddesc}{repr}{obj}
|
||||
\begin{methoddesc}[Repr]{repr}{obj}
|
||||
The equivalent to the built-in \function{repr()} that uses the
|
||||
formatting imposed by the instance.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{repr1}{obj, level}
|
||||
\begin{methoddesc}[Repr]{repr1}{obj, level}
|
||||
Recursive implementation used by \method{repr()}. This uses the
|
||||
type of \var{obj} to determine which formatting method to call,
|
||||
passing it \var{obj} and \var{level}. The type-specific methods
|
||||
|
@ -98,7 +98,7 @@ and methods which format specific object types.
|
|||
call.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddescni}{repr_\var{type}}{obj, level}
|
||||
\begin{methoddescni}[Repr]{repr_\var{type}}{obj, level}
|
||||
Formatting methods for specific types are implemented as methods
|
||||
with a name based on the type name. In the method name, \var{type}
|
||||
is replaced by
|
||||
|
|
|
@ -89,20 +89,20 @@ makes use of this and would break were it not available.
|
|||
|
||||
\class{RExec} instances support the following methods:
|
||||
|
||||
\begin{methoddesc}{r_eval}{code}
|
||||
\begin{methoddesc}[RExec]{r_eval}{code}
|
||||
\var{code} must either be a string containing a Python expression, or
|
||||
a compiled code object, which will be evaluated in the restricted
|
||||
environment's \module{__main__} module. The value of the expression or
|
||||
code object will be returned.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{r_exec}{code}
|
||||
\begin{methoddesc}[RExec]{r_exec}{code}
|
||||
\var{code} must either be a string containing one or more lines of
|
||||
Python code, or a compiled code object, which will be executed in the
|
||||
restricted environment's \module{__main__} module.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{r_execfile}{filename}
|
||||
\begin{methoddesc}[RExec]{r_execfile}{filename}
|
||||
Execute the Python code contained in the file \var{filename} in the
|
||||
restricted environment's \module{__main__} module.
|
||||
\end{methoddesc}
|
||||
|
@ -112,17 +112,17 @@ beginning with \samp{r_}, but the code will be granted access to
|
|||
restricted versions of the standard I/O streams \code{sys.stdin},
|
||||
\code{sys.stderr}, and \code{sys.stdout}.
|
||||
|
||||
\begin{methoddesc}{s_eval}{code}
|
||||
\begin{methoddesc}[RExec]{s_eval}{code}
|
||||
\var{code} must be a string containing a Python expression, which will
|
||||
be evaluated in the restricted environment.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{s_exec}{code}
|
||||
\begin{methoddesc}[RExec]{s_exec}{code}
|
||||
\var{code} must be a string containing one or more lines of Python code,
|
||||
which will be executed in the restricted environment.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{s_execfile}{code}
|
||||
\begin{methoddesc}[RExec]{s_execfile}{code}
|
||||
Execute the Python code contained in the file \var{filename} in the
|
||||
restricted environment.
|
||||
\end{methoddesc}
|
||||
|
@ -132,13 +132,13 @@ implicitly called by code executing in the restricted environment.
|
|||
Overriding these methods in a subclass is used to change the policies
|
||||
enforced by a restricted environment.
|
||||
|
||||
\begin{methoddesc}{r_import}{modulename\optional{, globals\optional{,
|
||||
locals\optional{, fromlist}}}}
|
||||
\begin{methoddesc}[RExec]{r_import}{modulename\optional{, globals\optional{,
|
||||
locals\optional{, fromlist}}}}
|
||||
Import the module \var{modulename}, raising an \exception{ImportError}
|
||||
exception if the module is considered unsafe.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{r_open}{filename\optional{, mode\optional{, bufsize}}}
|
||||
\begin{methoddesc}[RExec]{r_open}{filename\optional{, mode\optional{, bufsize}}}
|
||||
Method called when \function{open()} is called in the restricted
|
||||
environment. The arguments are identical to those of \function{open()},
|
||||
and a file object (or a class instance compatible with file objects)
|
||||
|
@ -148,28 +148,28 @@ the example below for an implementation of a less restrictive
|
|||
\method{r_open()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{r_reload}{module}
|
||||
\begin{methoddesc}[RExec]{r_reload}{module}
|
||||
Reload the module object \var{module}, re-parsing and re-initializing it.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{r_unload}{module}
|
||||
\begin{methoddesc}[RExec]{r_unload}{module}
|
||||
Unload the module object \var{module} (remove it from the
|
||||
restricted environment's \code{sys.modules} dictionary).
|
||||
\end{methoddesc}
|
||||
|
||||
And their equivalents with access to restricted standard I/O streams:
|
||||
|
||||
\begin{methoddesc}{s_import}{modulename\optional{, globals\optional{,
|
||||
locals\optional{, fromlist}}}}
|
||||
\begin{methoddesc}[RExec]{s_import}{modulename\optional{, globals\optional{,
|
||||
locals\optional{, fromlist}}}}
|
||||
Import the module \var{modulename}, raising an \exception{ImportError}
|
||||
exception if the module is considered unsafe.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{s_reload}{module}
|
||||
\begin{methoddesc}[RExec]{s_reload}{module}
|
||||
Reload the module object \var{module}, re-parsing and re-initializing it.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{s_unload}{module}
|
||||
\begin{methoddesc}[RExec]{s_unload}{module}
|
||||
Unload the module object \var{module}.
|
||||
% XXX what are the semantics of this?
|
||||
\end{methoddesc}
|
||||
|
@ -184,7 +184,7 @@ instance won't have any effect; instead, create a subclass of
|
|||
Instances of the new class will then use those new values. All these
|
||||
attributes are tuples of strings.
|
||||
|
||||
\begin{memberdesc}{nok_builtin_names}
|
||||
\begin{memberdesc}[RExec]{nok_builtin_names}
|
||||
Contains the names of built-in functions which will \emph{not} be
|
||||
available to programs running in the restricted environment. The
|
||||
value for \class{RExec} is \code{('open', 'reload', '__import__')}.
|
||||
|
@ -196,7 +196,7 @@ built-in functions are added to Python, they will also be added to
|
|||
this module.)
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{ok_builtin_modules}
|
||||
\begin{memberdesc}[RExec]{ok_builtin_modules}
|
||||
Contains the names of built-in modules which can be safely imported.
|
||||
The value for \class{RExec} is \code{('audioop', 'array', 'binascii',
|
||||
'cmath', 'errno', 'imageop', 'marshal', 'math', 'md5', 'operator',
|
||||
|
@ -205,14 +205,14 @@ The value for \class{RExec} is \code{('audioop', 'array', 'binascii',
|
|||
applies --- use the value from the base class as a starting point.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{ok_path}
|
||||
\begin{memberdesc}[RExec]{ok_path}
|
||||
Contains the directories which will be searched when an \keyword{import}
|
||||
is performed in the restricted environment.
|
||||
The value for \class{RExec} is the same as \code{sys.path} (at the time
|
||||
the module is loaded) for unrestricted code.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{ok_posix_names}
|
||||
\begin{memberdesc}[RExec]{ok_posix_names}
|
||||
% Should this be called ok_os_names?
|
||||
Contains the names of the functions in the \refmodule{os} module which will be
|
||||
available to programs running in the restricted environment. The
|
||||
|
@ -221,14 +221,14 @@ value for \class{RExec} is \code{('error', 'fstat', 'listdir',
|
|||
'getcwd', 'getuid', 'getgid', 'geteuid', 'getegid')}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{ok_sys_names}
|
||||
\begin{memberdesc}[RExec]{ok_sys_names}
|
||||
Contains the names of the functions and variables in the \refmodule{sys}
|
||||
module which will be available to programs running in the restricted
|
||||
environment. The value for \class{RExec} is \code{('ps1', 'ps2',
|
||||
'copyright', 'version', 'platform', 'exit', 'maxint')}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{ok_file_types}
|
||||
\begin{memberdesc}[RExec]{ok_file_types}
|
||||
Contains the file types from which modules are allowed to be loaded.
|
||||
Each file type is an integer constant defined in the \refmodule{imp} module.
|
||||
The meaningful values are \constant{PY_SOURCE}, \constant{PY_COMPILED}, and
|
||||
|
|
|
@ -142,12 +142,12 @@ switch dates. Not enough to worry about for common use.
|
|||
|
||||
A \class{Message} instance has the following methods:
|
||||
|
||||
\begin{methoddesc}{rewindbody}{}
|
||||
\begin{methoddesc}[Message]{rewindbody}{}
|
||||
Seek to the start of the message body. This only works if the file
|
||||
object is seekable.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{isheader}{line}
|
||||
\begin{methoddesc}[Message]{isheader}{line}
|
||||
Returns a line's canonicalized fieldname (the dictionary key that will
|
||||
be used to index it) if the line is a legal \rfc{2822} header; otherwise
|
||||
returns \code{None} (implying that parsing should stop here and the
|
||||
|
@ -155,33 +155,33 @@ line be pushed back on the input stream). It is sometimes useful to
|
|||
override this method in a subclass.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{islast}{line}
|
||||
\begin{methoddesc}[Message]{islast}{line}
|
||||
Return true if the given line is a delimiter on which Message should
|
||||
stop. The delimiter line is consumed, and the file object's read
|
||||
location positioned immediately after it. By default this method just
|
||||
checks that the line is blank, but you can override it in a subclass.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{iscomment}{line}
|
||||
\begin{methoddesc}[Message]{iscomment}{line}
|
||||
Return \code{True} if the given line should be ignored entirely, just skipped.
|
||||
By default this is a stub that always returns \code{False}, but you can
|
||||
override it in a subclass.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getallmatchingheaders}{name}
|
||||
\begin{methoddesc}[Message]{getallmatchingheaders}{name}
|
||||
Return a list of lines consisting of all headers matching
|
||||
\var{name}, if any. Each physical line, whether it is a continuation
|
||||
line or not, is a separate list item. Return the empty list if no
|
||||
header matches \var{name}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getfirstmatchingheader}{name}
|
||||
\begin{methoddesc}[Message]{getfirstmatchingheader}{name}
|
||||
Return a list of lines comprising the first header matching
|
||||
\var{name}, and its continuation line(s), if any. Return
|
||||
\code{None} if there is no header matching \var{name}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getrawheader}{name}
|
||||
\begin{methoddesc}[Message]{getrawheader}{name}
|
||||
Return a single string consisting of the text after the colon in the
|
||||
first header matching \var{name}. This includes leading whitespace,
|
||||
the trailing linefeed, and internal linefeeds and whitespace if there
|
||||
|
@ -189,19 +189,19 @@ any continuation line(s) were present. Return \code{None} if there is
|
|||
no header matching \var{name}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getheader}{name\optional{, default}}
|
||||
\begin{methoddesc}[Message]{getheader}{name\optional{, default}}
|
||||
Like \code{getrawheader(\var{name})}, but strip leading and trailing
|
||||
whitespace. Internal whitespace is not stripped. The optional
|
||||
\var{default} argument can be used to specify a different default to
|
||||
be returned when there is no header matching \var{name}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{get}{name\optional{, default}}
|
||||
\begin{methoddesc}[Message]{get}{name\optional{, default}}
|
||||
An alias for \method{getheader()}, to make the interface more compatible
|
||||
with regular dictionaries.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getaddr}{name}
|
||||
\begin{methoddesc}[Message]{getaddr}{name}
|
||||
Return a pair \code{(\var{full name}, \var{email address})} parsed
|
||||
from the string returned by \code{getheader(\var{name})}. If no
|
||||
header matching \var{name} exists, return \code{(None, None)};
|
||||
|
@ -217,7 +217,7 @@ If the header contained
|
|||
exact same result.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getaddrlist}{name}
|
||||
\begin{methoddesc}[Message]{getaddrlist}{name}
|
||||
This is similar to \code{getaddr(\var{list})}, but parses a header
|
||||
containing a list of email addresses (e.g.\ a \mailheader{To} header) and
|
||||
returns a list of \code{(\var{full name}, \var{email address})} pairs
|
||||
|
@ -229,7 +229,7 @@ are several \mailheader{Cc} headers), all are parsed for addresses.
|
|||
Any continuation lines the named headers contain are also parsed.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getdate}{name}
|
||||
\begin{methoddesc}[Message]{getdate}{name}
|
||||
Retrieve a header using \method{getheader()} and parse it into a 9-tuple
|
||||
compatible with \function{time.mktime()}; note that fields 6, 7, and 8
|
||||
are not usable. If there is no header matching
|
||||
|
@ -241,7 +241,7 @@ collection of email from many sources, it is still possible that this
|
|||
function may occasionally yield an incorrect result.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getdate_tz}{name}
|
||||
\begin{methoddesc}[Message]{getdate_tz}{name}
|
||||
Retrieve a header using \method{getheader()} and parse it into a
|
||||
10-tuple; the first 9 elements will make a tuple compatible with
|
||||
\function{time.mktime()}, and the 10th is a number giving the offset
|
||||
|
@ -270,19 +270,19 @@ support the \method{clear()}, \method{copy()}, \method{popitem()}, or
|
|||
|
||||
Finally, \class{Message} instances have some public instance variables:
|
||||
|
||||
\begin{memberdesc}{headers}
|
||||
\begin{memberdesc}[Message]{headers}
|
||||
A list containing the entire set of header lines, in the order in
|
||||
which they were read (except that setitem calls may disturb this
|
||||
order). Each line contains a trailing newline. The
|
||||
blank line terminating the headers is not contained in the list.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{fp}
|
||||
\begin{memberdesc}[Message]{fp}
|
||||
The file or file-like object passed at instantiation time. This can
|
||||
be used to read the message content.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{unixfrom}
|
||||
\begin{memberdesc}[Message]{unixfrom}
|
||||
The \UNIX{} \samp{From~} line, if the message had one, or an empty
|
||||
string. This is needed to regenerate the message in some contexts,
|
||||
such as an \code{mbox}-style mailbox file.
|
||||
|
@ -293,34 +293,34 @@ such as an \code{mbox}-style mailbox file.
|
|||
|
||||
An \class{AddressList} instance has the following methods:
|
||||
|
||||
\begin{methoddesc}{__len__}{}
|
||||
\begin{methoddesc}[AddressList]{__len__}{}
|
||||
Return the number of addresses in the address list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{__str__}{}
|
||||
\begin{methoddesc}[AddressList]{__str__}{}
|
||||
Return a canonicalized string representation of the address list.
|
||||
Addresses are rendered in "name" <host@domain> form, comma-separated.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{__add__}{alist}
|
||||
\begin{methoddesc}[AddressList]{__add__}{alist}
|
||||
Return a new \class{AddressList} instance that contains all addresses
|
||||
in both \class{AddressList} operands, with duplicates removed (set
|
||||
union).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{__iadd__}{alist}
|
||||
\begin{methoddesc}[AddressList]{__iadd__}{alist}
|
||||
In-place version of \method{__add__()}; turns this \class{AddressList}
|
||||
instance into the union of itself and the right-hand instance,
|
||||
\var{alist}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{__sub__}{alist}
|
||||
\begin{methoddesc}[AddressList]{__sub__}{alist}
|
||||
Return a new \class{AddressList} instance that contains every address
|
||||
in the left-hand \class{AddressList} operand that is not present in
|
||||
the right-hand address operand (set difference).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{__isub__}{alist}
|
||||
\begin{methoddesc}[AddressList]{__isub__}{alist}
|
||||
In-place version of \method{__sub__()}, removing addresses in this
|
||||
list which are also in \var{alist}.
|
||||
\end{methoddesc}
|
||||
|
@ -328,7 +328,7 @@ list which are also in \var{alist}.
|
|||
|
||||
Finally, \class{AddressList} instances have one public instance variable:
|
||||
|
||||
\begin{memberdesc}{addresslist}
|
||||
\begin{memberdesc}[AddressList]{addresslist}
|
||||
A list of tuple string pairs, one per address. In each member, the
|
||||
first is the canonicalized name part, the second is the
|
||||
actual route-address (\character{@}-separated username-host.domain
|
||||
|
|
|
@ -48,7 +48,7 @@ From print_time 930343700.273
|
|||
|
||||
\class{scheduler} instances have the following methods:
|
||||
|
||||
\begin{methoddesc}{enterabs}{time, priority, action, argument}
|
||||
\begin{methoddesc}[scheduler]{enterabs}{time, priority, action, argument}
|
||||
Schedule a new event. The \var{time} argument should be a numeric type
|
||||
compatible with the return value of the \var{timefunc} function passed
|
||||
to the constructor. Events scheduled for
|
||||
|
@ -63,23 +63,23 @@ Return value is an event which may be used for later cancellation of
|
|||
the event (see \method{cancel()}).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{enter}{delay, priority, action, argument}
|
||||
\begin{methoddesc}[scheduler]{enter}{delay, priority, action, argument}
|
||||
Schedule an event for \var{delay} more time units. Other then the
|
||||
relative time, the other arguments, the effect and the return value
|
||||
are the same as those for \method{enterabs()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{cancel}{event}
|
||||
\begin{methoddesc}[scheduler]{cancel}{event}
|
||||
Remove the event from the queue. If \var{event} is not an event
|
||||
currently in the queue, this method will raise a
|
||||
\exception{RuntimeError}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{empty}{}
|
||||
\begin{methoddesc}[scheduler]{empty}{}
|
||||
Return true if the event queue is empty.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{run}{}
|
||||
\begin{methoddesc}[scheduler]{run}{}
|
||||
Run all scheduled events. This function will wait
|
||||
(using the \function{delayfunc} function passed to the constructor)
|
||||
for the next event, then execute it and so on until there are no more
|
||||
|
|
|
@ -58,7 +58,7 @@ parsing rules. See section~\ref{shlex-objects}.
|
|||
|
||||
A \class{shlex} instance has the following methods:
|
||||
|
||||
\begin{methoddesc}{get_token}{}
|
||||
\begin{methoddesc}[shlex]{get_token}{}
|
||||
Return a token. If tokens have been stacked using
|
||||
\method{push_token()}, pop a token off the stack. Otherwise, read one
|
||||
from the input stream. If reading encounters an immediate
|
||||
|
@ -66,17 +66,17 @@ end-of-file, \member{self.eof} is returned (the empty string (\code{''})
|
|||
in non-\POSIX{} mode, and \code{None} in \POSIX{} mode).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{push_token}{str}
|
||||
\begin{methoddesc}[shlex]{push_token}{str}
|
||||
Push the argument onto the token stack.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_token}{}
|
||||
\begin{methoddesc}[shlex]{read_token}{}
|
||||
Read a raw token. Ignore the pushback stack, and do not interpret source
|
||||
requests. (This is not ordinarily a useful entry point, and is
|
||||
documented here only for the sake of completeness.)
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{sourcehook}{filename}
|
||||
\begin{methoddesc}[shlex]{sourcehook}{filename}
|
||||
When \class{shlex} detects a source request (see
|
||||
\member{source} below) this method is given the following token as
|
||||
argument, and expected to return a tuple consisting of a filename and
|
||||
|
@ -106,7 +106,7 @@ For more explicit control of source stacking, use the
|
|||
\method{push_source()} and \method{pop_source()} methods.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{push_source}{stream\optional{, filename}}
|
||||
\begin{methoddesc}[shlex]{push_source}{stream\optional{, filename}}
|
||||
Push an input source stream onto the input stack. If the filename
|
||||
argument is specified it will later be available for use in error
|
||||
messages. This is the same method used internally by the
|
||||
|
@ -114,14 +114,14 @@ messages. This is the same method used internally by the
|
|||
\versionadded{2.1}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{pop_source}{}
|
||||
\begin{methoddesc}[shlex]{pop_source}{}
|
||||
Pop the last-pushed input source from the input stack.
|
||||
This is the same method used internally when the lexer reaches
|
||||
\EOF{} on a stacked input stream.
|
||||
\versionadded{2.1}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{error_leader}{\optional{file\optional{, line}}}
|
||||
\begin{methoddesc}[shlex]{error_leader}{\optional{file\optional{, line}}}
|
||||
This method generates an error message leader in the format of a
|
||||
\UNIX{} C compiler error label; the format is \code{'"\%s", line \%d: '},
|
||||
where the \samp{\%s} is replaced with the name of the current source
|
||||
|
@ -137,63 +137,63 @@ Instances of \class{shlex} subclasses have some public instance
|
|||
variables which either control lexical analysis or can be used for
|
||||
debugging:
|
||||
|
||||
\begin{memberdesc}{commenters}
|
||||
\begin{memberdesc}[shlex]{commenters}
|
||||
The string of characters that are recognized as comment beginners.
|
||||
All characters from the comment beginner to end of line are ignored.
|
||||
Includes just \character{\#} by default.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{wordchars}
|
||||
\begin{memberdesc}[shlex]{wordchars}
|
||||
The string of characters that will accumulate into multi-character
|
||||
tokens. By default, includes all \ASCII{} alphanumerics and
|
||||
underscore.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{whitespace}
|
||||
\begin{memberdesc}[shlex]{whitespace}
|
||||
Characters that will be considered whitespace and skipped. Whitespace
|
||||
bounds tokens. By default, includes space, tab, linefeed and
|
||||
carriage-return.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{escape}
|
||||
\begin{memberdesc}[shlex]{escape}
|
||||
Characters that will be considered as escape. This will be only used
|
||||
in \POSIX{} mode, and includes just \character{\textbackslash} by default.
|
||||
\versionadded{2.3}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{quotes}
|
||||
\begin{memberdesc}[shlex]{quotes}
|
||||
Characters that will be considered string quotes. The token
|
||||
accumulates until the same quote is encountered again (thus, different
|
||||
quote types protect each other as in the shell.) By default, includes
|
||||
\ASCII{} single and double quotes.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{escapedquotes}
|
||||
\begin{memberdesc}[shlex]{escapedquotes}
|
||||
Characters in \member{quotes} that will interpret escape characters
|
||||
defined in \member{escape}. This is only used in \POSIX{} mode, and
|
||||
includes just \character{"} by default.
|
||||
\versionadded{2.3}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{whitespace_split}
|
||||
\begin{memberdesc}[shlex]{whitespace_split}
|
||||
If \code{True}, tokens will only be split in whitespaces. This is useful, for
|
||||
example, for parsing command lines with \class{shlex}, getting tokens
|
||||
in a similar way to shell arguments.
|
||||
\versionadded{2.3}
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{infile}
|
||||
\begin{memberdesc}[shlex]{infile}
|
||||
The name of the current input file, as initially set at class
|
||||
instantiation time or stacked by later source requests. It may
|
||||
be useful to examine this when constructing error messages.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{instream}
|
||||
\begin{memberdesc}[shlex]{instream}
|
||||
The input stream from which this \class{shlex} instance is reading
|
||||
characters.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{source}
|
||||
\begin{memberdesc}[shlex]{source}
|
||||
This member is \code{None} by default. If you assign a string to it,
|
||||
that string will be recognized as a lexical-level inclusion request
|
||||
similar to the \samp{source} keyword in various shells. That is, the
|
||||
|
@ -204,23 +204,23 @@ become the original input stream. Source requests may be stacked any
|
|||
number of levels deep.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{debug}
|
||||
\begin{memberdesc}[shlex]{debug}
|
||||
If this member is numeric and \code{1} or more, a \class{shlex}
|
||||
instance will print verbose progress output on its behavior. If you
|
||||
need to use this, you can read the module source code to learn the
|
||||
details.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{lineno}
|
||||
\begin{memberdesc}[shlex]{lineno}
|
||||
Source line number (count of newlines seen so far plus one).
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{token}
|
||||
\begin{memberdesc}[shlex]{token}
|
||||
The token buffer. It may be useful to examine this when catching
|
||||
exceptions.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{eof}
|
||||
\begin{memberdesc}[shlex]{eof}
|
||||
Token used to determine end of file. This will be set to the empty
|
||||
string (\code{''}), in non-\POSIX{} mode, and to \code{None} in
|
||||
\POSIX{} mode.
|
||||
|
|
|
@ -108,13 +108,13 @@ simple, stand alone XML-RPC servers.
|
|||
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{register_introspection_functions}{}
|
||||
\begin{methoddesc}[SimpleXMLRPCServer]{register_introspection_functions}{}
|
||||
Registers the XML-RPC introspection functions \code{system.listMethods},
|
||||
\code{system.methodHelp} and \code{system.methodSignature}.
|
||||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{register_multicall_functions}{}
|
||||
\begin{methoddesc}[SimpleXMLRPCServer]{register_multicall_functions}{}
|
||||
Registers the XML-RPC multicall function system.multicall.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -178,7 +178,7 @@ print s.system.listMethods()
|
|||
The \class{CGIXMLRPCRequestHandler} class can be used to
|
||||
handle XML-RPC requests sent to Python CGI scripts.
|
||||
|
||||
\begin{methoddesc}{register_function}{function\optional{, name}}
|
||||
\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_function}{function\optional{, name}}
|
||||
Register a function that can respond to XML-RPC requests. If
|
||||
\var{name} is given, it will be the method name associated with
|
||||
function, otherwise \var{function.__name__} will be used. \var{name}
|
||||
|
@ -187,7 +187,7 @@ characters not legal in Python identifiers, including the period
|
|||
character.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{register_instance}{instance}
|
||||
\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_instance}{instance}
|
||||
Register an object which is used to expose method names
|
||||
which have not been registered using \method{register_function()}. If
|
||||
instance contains a \method{_dispatch()} method, it is called with the
|
||||
|
@ -203,17 +203,17 @@ parameters from the request, and the return value is passed
|
|||
back to the client.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{register_introspection_functions}{}
|
||||
\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_introspection_functions}{}
|
||||
Register the XML-RPC introspection functions
|
||||
\code{system.listMethods}, \code{system.methodHelp} and
|
||||
\code{system.methodSignature}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{register_multicall_functions}{}
|
||||
\begin{methoddesc}[CGIXMLRPCRequestHandler]{register_multicall_functions}{}
|
||||
Register the XML-RPC multicall function \code{system.multicall}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{handle_request}{\optional{request_text = None}}
|
||||
\begin{methoddesc}[CGIXMLRPCRequestHandler]{handle_request}{\optional{request_text = None}}
|
||||
Handle a XML-RPC request. If \var{request_text} is given, it
|
||||
should be the POST data provided by the HTTP server,
|
||||
otherwise the contents of stdin will be used.
|
||||
|
|
|
@ -126,13 +126,13 @@ A nice selection of exceptions is defined as well:
|
|||
|
||||
An \class{SMTP} instance has the following methods:
|
||||
|
||||
\begin{methoddesc}{set_debuglevel}{level}
|
||||
\begin{methoddesc}[SMTP]{set_debuglevel}{level}
|
||||
Set the debug output level. A true value for \var{level} results in
|
||||
debug messages for connection and for all messages sent to and
|
||||
received from the server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{connect}{\optional{host\optional{, port}}}
|
||||
\begin{methoddesc}[SMTP]{connect}{\optional{host\optional{, port}}}
|
||||
Connect to a host on a given port. The defaults are to connect to the
|
||||
local host at the standard SMTP port (25).
|
||||
If the hostname ends with a colon (\character{:}) followed by a
|
||||
|
@ -142,7 +142,7 @@ This method is automatically invoked by the constructor if a
|
|||
host is specified during instantiation.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{docmd}{cmd, \optional{, argstring}}
|
||||
\begin{methoddesc}[SMTP]{docmd}{cmd, \optional{, argstring}}
|
||||
Send a command \var{cmd} to the server. The optional argument
|
||||
\var{argstring} is simply concatenated to the command, separated by a
|
||||
space.
|
||||
|
@ -159,7 +159,7 @@ If the connection to the server is lost while waiting for the reply,
|
|||
\exception{SMTPServerDisconnected} will be raised.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{helo}{\optional{hostname}}
|
||||
\begin{methoddesc}[SMTP]{helo}{\optional{hostname}}
|
||||
Identify yourself to the SMTP server using \samp{HELO}. The hostname
|
||||
argument defaults to the fully qualified domain name of the local
|
||||
host.
|
||||
|
@ -169,7 +169,7 @@ explicitly. It will be implicitly called by the \method{sendmail()}
|
|||
when necessary.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{ehlo}{\optional{hostname}}
|
||||
\begin{methoddesc}[SMTP]{ehlo}{\optional{hostname}}
|
||||
Identify yourself to an ESMTP server using \samp{EHLO}. The hostname
|
||||
argument defaults to the fully qualified domain name of the local
|
||||
host. Examine the response for ESMTP option and store them for use by
|
||||
|
@ -180,13 +180,13 @@ mail, it should not be necessary to call this method explicitly. It
|
|||
will be implicitly called by \method{sendmail()} when necessary.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{has_extn}{name}
|
||||
\begin{methoddesc}[SMTP]{has_extn}{name}
|
||||
Return \constant{True} if \var{name} is in the set of SMTP service
|
||||
extensions returned by the server, \constant{False} otherwise.
|
||||
Case is ignored.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{verify}{address}
|
||||
\begin{methoddesc}[SMTP]{verify}{address}
|
||||
Check the validity of an address on this server using SMTP \samp{VRFY}.
|
||||
Returns a tuple consisting of code 250 and a full \rfc{822} address
|
||||
(including human name) if the user address is valid. Otherwise returns
|
||||
|
@ -195,7 +195,7 @@ an SMTP error code of 400 or greater and an error string.
|
|||
\note{Many sites disable SMTP \samp{VRFY} in order to foil spammers.}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{login}{user, password}
|
||||
\begin{methoddesc}[SMTP]{login}{user, password}
|
||||
Log in on an SMTP server that requires authentication.
|
||||
The arguments are the username and the password to authenticate with.
|
||||
If there has been no previous \samp{EHLO} or \samp{HELO} command this
|
||||
|
@ -213,7 +213,7 @@ or may raise the following exceptions:
|
|||
\end{description}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{starttls}{\optional{keyfile\optional{, certfile}}}
|
||||
\begin{methoddesc}[SMTP]{starttls}{\optional{keyfile\optional{, certfile}}}
|
||||
Put the SMTP connection in TLS (Transport Layer Security) mode. All
|
||||
SMTP commands that follow will be encrypted. You should then call
|
||||
\method{ehlo()} again.
|
||||
|
@ -222,8 +222,8 @@ If \var{keyfile} and \var{certfile} are provided, these are passed to
|
|||
the \refmodule{socket} module's \function{ssl()} function.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{sendmail}{from_addr, to_addrs, msg\optional{,
|
||||
mail_options, rcpt_options}}
|
||||
\begin{methoddesc}[SMTP]{sendmail}{from_addr, to_addrs, msg\optional{,
|
||||
mail_options, rcpt_options}}
|
||||
Send mail. The required arguments are an \rfc{822} from-address
|
||||
string, a list of \rfc{822} to-address strings (a bare string will be
|
||||
treated as a list with 1 address), and a message string. The caller
|
||||
|
@ -279,7 +279,7 @@ an exception is raised.
|
|||
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{quit}{}
|
||||
\begin{methoddesc}[SMTP]{quit}{}
|
||||
Terminate the SMTP session and close the connection.
|
||||
\end{methoddesc}
|
||||
|
||||
|
|
|
@ -176,16 +176,16 @@ metacharacters, can safely be passed to child processes.
|
|||
|
||||
Instances of the \class{Popen} class have the following methods:
|
||||
|
||||
\begin{methoddesc}{poll}{}
|
||||
\begin{methoddesc}[Popen]{poll}{}
|
||||
Check if child process has terminated. Returns returncode
|
||||
attribute.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{wait}{}
|
||||
\begin{methoddesc}[Popen]{wait}{}
|
||||
Wait for child process to terminate. Returns returncode attribute.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{communicate}{input=None}
|
||||
\begin{methoddesc}[Popen]{communicate}{input=None}
|
||||
Interact with process: Send data to stdin. Read data from stdout and
|
||||
stderr, until end-of-file is reached. Wait for process to terminate.
|
||||
The optional \var{input} argument should be a string to be sent to the
|
||||
|
@ -199,29 +199,29 @@ if the data size is large or unlimited.}
|
|||
|
||||
The following attributes are also available:
|
||||
|
||||
\begin{memberdesc}{stdin}
|
||||
\begin{memberdesc}[Popen]{stdin}
|
||||
If the \var{stdin} argument is \code{PIPE}, this attribute is a file
|
||||
object that provides input to the child process. Otherwise, it is
|
||||
\code{None}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{stdout}
|
||||
\begin{memberdesc}[Popen]{stdout}
|
||||
If the \var{stdout} argument is \code{PIPE}, this attribute is a file
|
||||
object that provides output from the child process. Otherwise, it is
|
||||
\code{None}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{stderr}
|
||||
\begin{memberdesc}[Popen]{stderr}
|
||||
If the \var{stderr} argument is \code{PIPE}, this attribute is file
|
||||
object that provides error output from the child process. Otherwise,
|
||||
it is \code{None}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{pid}
|
||||
\begin{memberdesc}[Popen]{pid}
|
||||
The process ID of the child process.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{returncode}
|
||||
\begin{memberdesc}[Popen]{returncode}
|
||||
The child return code. A \code{None} value indicates that the process
|
||||
hasn't terminated yet. A negative value -N indicates that the child
|
||||
was terminated by signal N (\UNIX{} only).
|
||||
|
|
|
@ -55,7 +55,7 @@ individual descriptions below.
|
|||
\class{Telnet} instances have the following methods:
|
||||
|
||||
|
||||
\begin{methoddesc}{read_until}{expected\optional{, timeout}}
|
||||
\begin{methoddesc}[Telnet]{read_until}{expected\optional{, timeout}}
|
||||
Read until a given string, \var{expected}, is encountered or until
|
||||
\var{timeout} seconds have passed.
|
||||
|
||||
|
@ -64,17 +64,17 @@ possibly the empty string. Raise \exception{EOFError} if the connection
|
|||
is closed and no cooked data is available.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_all}{}
|
||||
\begin{methoddesc}[Telnet]{read_all}{}
|
||||
Read all data until \EOF; block until connection closed.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_some}{}
|
||||
\begin{methoddesc}[Telnet]{read_some}{}
|
||||
Read at least one byte of cooked data unless \EOF{} is hit.
|
||||
Return \code{''} if \EOF{} is hit. Block if no data is immediately
|
||||
available.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_very_eager}{}
|
||||
\begin{methoddesc}[Telnet]{read_very_eager}{}
|
||||
Read everything that can be without blocking in I/O (eager).
|
||||
|
||||
Raise \exception{EOFError} if connection closed and no cooked data
|
||||
|
@ -82,7 +82,7 @@ available. Return \code{''} if no cooked data available otherwise.
|
|||
Do not block unless in the midst of an IAC sequence.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_eager}{}
|
||||
\begin{methoddesc}[Telnet]{read_eager}{}
|
||||
Read readily available data.
|
||||
|
||||
Raise \exception{EOFError} if connection closed and no cooked data
|
||||
|
@ -90,7 +90,7 @@ available. Return \code{''} if no cooked data available otherwise.
|
|||
Do not block unless in the midst of an IAC sequence.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_lazy}{}
|
||||
\begin{methoddesc}[Telnet]{read_lazy}{}
|
||||
Process and return data already in the queues (lazy).
|
||||
|
||||
Raise \exception{EOFError} if connection closed and no data available.
|
||||
|
@ -98,7 +98,7 @@ Return \code{''} if no cooked data available otherwise. Do not block
|
|||
unless in the midst of an IAC sequence.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_very_lazy}{}
|
||||
\begin{methoddesc}[Telnet]{read_very_lazy}{}
|
||||
Return any data available in the cooked queue (very lazy).
|
||||
|
||||
Raise \exception{EOFError} if connection closed and no data available.
|
||||
|
@ -106,7 +106,7 @@ Return \code{''} if no cooked data available otherwise. This method
|
|||
never blocks.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{read_sb_data}{}
|
||||
\begin{methoddesc}[Telnet]{read_sb_data}{}
|
||||
Return the data collected between a SB/SE pair (suboption begin/end).
|
||||
The callback should access these data when it was invoked with a
|
||||
\code{SE} command. This method never blocks.
|
||||
|
@ -114,7 +114,7 @@ The callback should access these data when it was invoked with a
|
|||
\versionadded{2.3}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{open}{host\optional{, port\optional{, timeout}}}
|
||||
\begin{methoddesc}[Telnet]{open}{host\optional{, port\optional{, timeout}}}
|
||||
Connect to a host.
|
||||
The optional second argument is the port number, which
|
||||
defaults to the standard Telnet port (23).
|
||||
|
@ -125,44 +125,44 @@ timeout setting will be used).
|
|||
Do not try to reopen an already connected instance.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{msg}{msg\optional{, *args}}
|
||||
\begin{methoddesc}[Telnet]{msg}{msg\optional{, *args}}
|
||||
Print a debug message when the debug level is \code{>} 0.
|
||||
If extra arguments are present, they are substituted in the
|
||||
message using the standard string formatting operator.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set_debuglevel}{debuglevel}
|
||||
\begin{methoddesc}[Telnet]{set_debuglevel}{debuglevel}
|
||||
Set the debug level. The higher the value of \var{debuglevel}, the
|
||||
more debug output you get (on \code{sys.stdout}).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{close}{}
|
||||
\begin{methoddesc}[Telnet]{close}{}
|
||||
Close the connection.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{get_socket}{}
|
||||
\begin{methoddesc}[Telnet]{get_socket}{}
|
||||
Return the socket object used internally.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{fileno}{}
|
||||
\begin{methoddesc}[Telnet]{fileno}{}
|
||||
Return the file descriptor of the socket object used internally.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{write}{buffer}
|
||||
\begin{methoddesc}[Telnet]{write}{buffer}
|
||||
Write a string to the socket, doubling any IAC characters.
|
||||
This can block if the connection is blocked. May raise
|
||||
\exception{socket.error} if the connection is closed.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{interact}{}
|
||||
\begin{methoddesc}[Telnet]{interact}{}
|
||||
Interaction function, emulates a very dumb Telnet client.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{mt_interact}{}
|
||||
\begin{methoddesc}[Telnet]{mt_interact}{}
|
||||
Multithreaded version of \method{interact()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{expect}{list\optional{, timeout}}
|
||||
\begin{methoddesc}[Telnet]{expect}{list\optional{, timeout}}
|
||||
Read until one from a list of a regular expressions matches.
|
||||
|
||||
The first argument is a list of regular expressions, either
|
||||
|
@ -184,7 +184,7 @@ or if more than one expression can match the same input, the
|
|||
results are indeterministic, and may depend on the I/O timing.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{set_option_negotiation_callback}{callback}
|
||||
\begin{methoddesc}[Telnet]{set_option_negotiation_callback}{callback}
|
||||
Each time a telnet option is read on the input flow, this
|
||||
\var{callback} (if set) is called with the following parameters :
|
||||
callback(telnet socket, command (DO/DONT/WILL/WONT), option). No other
|
||||
|
|
|
@ -20,11 +20,11 @@ returned count is equal to the length of the list returned by
|
|||
\function{enumerate()}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Condition}{}
|
||||
\begin{funcdescni}{Condition}{}
|
||||
A factory function that returns a new condition variable object.
|
||||
A condition variable allows one or more threads to wait until they
|
||||
are notified by another thread.
|
||||
\end{funcdesc}
|
||||
\end{funcdescni}
|
||||
|
||||
\begin{funcdesc}{currentThread}{}
|
||||
Return the current \class{Thread} object, corresponding to the
|
||||
|
@ -41,12 +41,12 @@ includes daemonic threads, dummy thread objects created by
|
|||
terminated threads and threads that have not yet been started.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Event}{}
|
||||
\begin{funcdescni}{Event}{}
|
||||
A factory function that returns a new event object. An event manages
|
||||
a flag that can be set to true with the \method{set()} method and
|
||||
reset to false with the \method{clear()} method. The \method{wait()}
|
||||
method blocks until the flag is true.
|
||||
\end{funcdesc}
|
||||
\end{funcdescni}
|
||||
|
||||
\begin{classdesc*}{local}{}
|
||||
A class that represents thread-local data. Thread-local data are data
|
||||
|
@ -81,14 +81,14 @@ acquire it again without blocking; the thread must release it once
|
|||
for each time it has acquired it.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Semaphore}{\optional{value}}
|
||||
\begin{funcdescni}{Semaphore}{\optional{value}}
|
||||
A factory function that returns a new semaphore object. A
|
||||
semaphore manages a counter representing the number of \method{release()}
|
||||
calls minus the number of \method{acquire()} calls, plus an initial value.
|
||||
The \method{acquire()} method blocks if necessary until it can return
|
||||
without making the counter negative. If not given, \var{value} defaults to
|
||||
1.
|
||||
\end{funcdesc}
|
||||
\end{funcdescni}
|
||||
|
||||
\begin{funcdesc}{BoundedSemaphore}{\optional{value}}
|
||||
A factory function that returns a new bounded semaphore object. A bounded
|
||||
|
@ -99,12 +99,12 @@ semaphore is released too many times it's a sign of a bug. If not given,
|
|||
\var{value} defaults to 1.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{classdesc*}{Thread}{}
|
||||
\begin{classdesc*}{Thread}
|
||||
A class that represents a thread of control. This class can be safely
|
||||
subclassed in a limited fashion.
|
||||
\end{classdesc*}
|
||||
|
||||
\begin{classdesc*}{Timer}{}
|
||||
\begin{classdesc*}{Timer}
|
||||
A thread that executes a function after a specified interval has passed.
|
||||
\end{classdesc*}
|
||||
|
||||
|
@ -182,7 +182,7 @@ and may vary across implementations.
|
|||
|
||||
All methods are executed atomically.
|
||||
|
||||
\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}}
|
||||
\begin{methoddesc}[Lock]{acquire}{\optional{blocking\code{ = 1}}}
|
||||
Acquire a lock, blocking or non-blocking.
|
||||
|
||||
When invoked without arguments, block until the lock is
|
||||
|
@ -197,7 +197,7 @@ immediately; otherwise, do the same thing as when called
|
|||
without arguments, and return true.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{release}{}
|
||||
\begin{methoddesc}[Lock]{release}{}
|
||||
Release a lock.
|
||||
|
||||
When the lock is locked, reset it to unlocked, and return. If
|
||||
|
@ -227,7 +227,7 @@ the final \method{release()} (the \method{release()} of the outermost
|
|||
pair) resets the lock to unlocked and allows another thread blocked in
|
||||
\method{acquire()} to proceed.
|
||||
|
||||
\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}}
|
||||
\begin{methoddesc}[RLock]{acquire}{\optional{blocking\code{ = 1}}}
|
||||
Acquire a lock, blocking or non-blocking.
|
||||
|
||||
When invoked without arguments: if this thread already owns
|
||||
|
@ -249,7 +249,7 @@ immediately; otherwise, do the same thing as when called
|
|||
without arguments, and return true.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{release}{}
|
||||
\begin{methoddesc}[RLock]{release}{}
|
||||
Release a lock, decrementing the recursion level. If after the
|
||||
decrement it is zero, reset the lock to unlocked (not owned by any
|
||||
thread), and if any other threads are blocked waiting for the lock to
|
||||
|
|
|
@ -261,7 +261,7 @@ The only method which is more powerful as a method is
|
|||
\function{degrees()}, which takes an optional argument letting
|
||||
you specify the number of units corresponding to a full circle:
|
||||
|
||||
\begin{methoddesc}{degrees}{\optional{fullcircle}}
|
||||
\begin{methoddesc}[Turtle]{degrees}{\optional{fullcircle}}
|
||||
\var{fullcircle} is by default 360. This can cause the pen to have any
|
||||
angular units whatever: give \var{fullcircle} 2*$\pi$ for radians, or
|
||||
400 for gradians.
|
||||
|
|
|
@ -619,14 +619,14 @@ The test code can use any of the following methods to check for and
|
|||
report failures.
|
||||
|
||||
\begin{methoddesc}[TestCase]{assert_}{expr\optional{, msg}}
|
||||
\methodline{failUnless}{expr\optional{, msg}}
|
||||
\methodline[TestCase]{failUnless}{expr\optional{, msg}}
|
||||
Signal a test failure if \var{expr} is false; the explanation for
|
||||
the error will be \var{msg} if given, otherwise it will be
|
||||
\constant{None}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TestCase]{assertEqual}{first, second\optional{, msg}}
|
||||
\methodline{failUnlessEqual}{first, second\optional{, msg}}
|
||||
\methodline[TestCase]{failUnlessEqual}{first, second\optional{, msg}}
|
||||
Test that \var{first} and \var{second} are equal. If the values do
|
||||
not compare equal, the test will fail with the explanation given by
|
||||
\var{msg}, or \constant{None}. Note that using \method{failUnlessEqual()}
|
||||
|
@ -637,7 +637,7 @@ report failures.
|
|||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TestCase]{assertNotEqual}{first, second\optional{, msg}}
|
||||
\methodline{failIfEqual}{first, second\optional{, msg}}
|
||||
\methodline[TestCase]{failIfEqual}{first, second\optional{, msg}}
|
||||
Test that \var{first} and \var{second} are not equal. If the values
|
||||
do compare equal, the test will fail with the explanation given by
|
||||
\var{msg}, or \constant{None}. Note that using \method{failIfEqual()}
|
||||
|
@ -649,7 +649,7 @@ report failures.
|
|||
|
||||
\begin{methoddesc}[TestCase]{assertAlmostEqual}{first, second\optional{,
|
||||
places\optional{, msg}}}
|
||||
\methodline{failUnlessAlmostEqual}{first, second\optional{,
|
||||
\methodline[TestCase]{failUnlessAlmostEqual}{first, second\optional{,
|
||||
places\optional{, msg}}}
|
||||
Test that \var{first} and \var{second} are approximately equal
|
||||
by computing the difference, rounding to the given number of \var{places},
|
||||
|
@ -661,7 +661,7 @@ report failures.
|
|||
|
||||
\begin{methoddesc}[TestCase]{assertNotAlmostEqual}{first, second\optional{,
|
||||
places\optional{, msg}}}
|
||||
\methodline{failIfAlmostEqual}{first, second\optional{,
|
||||
\methodline[TestCase]{failIfAlmostEqual}{first, second\optional{,
|
||||
places\optional{, msg}}}
|
||||
Test that \var{first} and \var{second} are not approximately equal
|
||||
by computing the difference, rounding to the given number of \var{places},
|
||||
|
@ -672,7 +672,7 @@ report failures.
|
|||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TestCase]{assertRaises}{exception, callable, \moreargs}
|
||||
\methodline{failUnlessRaises}{exception, callable, \moreargs}
|
||||
\methodline[TestCase]{failUnlessRaises}{exception, callable, \moreargs}
|
||||
Test that an exception is raised when \var{callable} is called with
|
||||
any positional or keyword arguments that are also passed to
|
||||
\method{assertRaises()}. The test passes if \var{exception} is
|
||||
|
|
|
@ -588,7 +588,7 @@ The same as \method{http_error_301()}, but called for the
|
|||
|
||||
\class{HTTPCookieProcessor} instances have one attribute:
|
||||
|
||||
\begin{memberdesc}{cookiejar}
|
||||
\begin{memberdesc}[HTTPCookieProcessor]{cookiejar}
|
||||
The \class{cookielib.CookieJar} in which cookies are stored.
|
||||
\end{memberdesc}
|
||||
|
||||
|
|
|
@ -134,12 +134,12 @@ may be either returned data in a conformant type or a \class{Fault} or
|
|||
Servers that support the XML introspection API support some common
|
||||
methods grouped under the reserved \member{system} member:
|
||||
|
||||
\begin{methoddesc}{system.listMethods}{}
|
||||
\begin{methoddesc}[ServerProxy]{system.listMethods}{}
|
||||
This method returns a list of strings, one for each (non-system)
|
||||
method supported by the XML-RPC server.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{system.methodSignature}{name}
|
||||
\begin{methoddesc}[ServerProxy]{system.methodSignature}{name}
|
||||
This method takes one parameter, the name of a method implemented by
|
||||
the XML-RPC server.It returns an array of possible signatures for this
|
||||
method. A signature is an array of types. The first of these types is
|
||||
|
@ -159,7 +159,7 @@ returned. In Python this means that the type of the returned
|
|||
value will be something other that list.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{system.methodHelp}{name}
|
||||
\begin{methoddesc}[ServerProxy]{system.methodHelp}{name}
|
||||
This method takes one parameter, the name of a method implemented by
|
||||
the XML-RPC server. It returns a documentation string describing the
|
||||
use of that method. If no such string is available, an empty string is
|
||||
|
@ -184,7 +184,7 @@ implemented in the obvious ways.
|
|||
It also has the following method, supported mainly for internal use by
|
||||
the unmarshalling code:
|
||||
|
||||
\begin{methoddesc}{encode}{out}
|
||||
\begin{methoddesc}[Boolean]{encode}{out}
|
||||
Write the XML-RPC encoding of this Boolean item to the out stream object.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -197,11 +197,11 @@ ISO 8601 time/date string, or a {}\class{\refmodule{datetime}.datetime},
|
|||
instance. It has the following methods, supported mainly for internal use
|
||||
by the marshalling/unmarshalling code:
|
||||
|
||||
\begin{methoddesc}{decode}{string}
|
||||
\begin{methoddesc}[DateTime]{decode}{string}
|
||||
Accept a string as the instance's new time value.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{encode}{out}
|
||||
\begin{methoddesc}[DateTime]{encode}{out}
|
||||
Write the XML-RPC encoding of this \class{DateTime} item to the
|
||||
\var{out} stream object.
|
||||
\end{methoddesc}
|
||||
|
@ -242,11 +242,11 @@ It also supports certain of Python's built-in operators through a
|
|||
A \class{Fault} object encapsulates the content of an XML-RPC fault tag.
|
||||
Fault objects have the following members:
|
||||
|
||||
\begin{memberdesc}{faultCode}
|
||||
\begin{memberdesc}[Fault]{faultCode}
|
||||
A string indicating the fault type.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{faultString}
|
||||
\begin{memberdesc}[Fault]{faultString}
|
||||
A string containing a diagnostic message associated with the fault.
|
||||
\end{memberdesc}
|
||||
|
||||
|
@ -258,19 +258,19 @@ underlying transport layer (such as a 404 `not found' error if the
|
|||
server named by the URI does not exist). It has the following
|
||||
members:
|
||||
|
||||
\begin{memberdesc}{url}
|
||||
\begin{memberdesc}[ProtocolError]{url}
|
||||
The URI or URL that triggered the error.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{errcode}
|
||||
\begin{memberdesc}[ProtocolError]{errcode}
|
||||
The error code.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{errmsg}
|
||||
\begin{memberdesc}[ProtocolError]{errmsg}
|
||||
The error message or diagnostic string.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}{headers}
|
||||
\begin{memberdesc}[ProtocolError]{headers}
|
||||
A string containing the headers of the HTTP/HTTPS request that
|
||||
triggered the error.
|
||||
\end{memberdesc}
|
||||
|
|
|
@ -68,14 +68,14 @@ Besides the dictionary interface, \class{IC} objects have the
|
|||
following methods:
|
||||
|
||||
|
||||
\begin{methoddesc}{launchurl}{url\optional{, hint}}
|
||||
\begin{methoddesc}[IC]{launchurl}{url\optional{, hint}}
|
||||
Parse the given URL, launch the correct application and pass it the
|
||||
URL. The optional \var{hint} can be a scheme name such as
|
||||
\code{'mailto:'}, in which case incomplete URLs are completed with this
|
||||
scheme. If \var{hint} is not provided, incomplete URLs are invalid.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
|
||||
\begin{methoddesc}[IC]{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
|
||||
Find an URL somewhere in \var{data} and return start position, end
|
||||
position and the URL. The optional \var{start} and \var{end} can be
|
||||
used to limit the search, so for instance if a user clicks in a long
|
||||
|
@ -85,7 +85,7 @@ user clicked. As above, \var{hint} is an optional scheme used to
|
|||
complete incomplete URLs.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{mapfile}{file}
|
||||
\begin{methoddesc}[IC]{mapfile}{file}
|
||||
Return the mapping entry for the given \var{file}, which can be passed
|
||||
as either a filename or an \function{FSSpec()} result, and which
|
||||
need not exist.
|
||||
|
@ -106,7 +106,7 @@ postprocessing application, \var{mimetype} is the MIME type of this
|
|||
file and \var{entryname} is the name of this entry.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{maptypecreator}{type, creator\optional{, filename}}
|
||||
\begin{methoddesc}[IC]{maptypecreator}{type, creator\optional{, filename}}
|
||||
Return the mapping entry for files with given 4-character \var{type} and
|
||||
\var{creator} codes. The optional \var{filename} may be specified to
|
||||
further help finding the correct entry (if the creator code is
|
||||
|
@ -115,7 +115,7 @@ further help finding the correct entry (if the creator code is
|
|||
The mapping entry is returned in the same format as for \var{mapfile}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{settypecreator}{file}
|
||||
\begin{methoddesc}[IC]{settypecreator}{file}
|
||||
Given an existing \var{file}, specified either as a filename or as an
|
||||
\function{FSSpec()} result, set its creator and type correctly based
|
||||
on its extension. The finder is told about the change, so the finder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue