mirror of https://github.com/python/cpython
Remove almost all unpaired backticks in docstrings (#119231)
As reported in #117847 and #115366, an unpaired backtick in a docstring tends to confuse e.g. Sphinx running on subclasses of standard library objects, and the typographic style of using a backtick as an opening quote is no longer in favor. Convert almost all uses of the form The variable `foo' should do xyz to The variable 'foo' should do xyz and also fix up miscellaneous other unpaired backticks (extraneous / missing characters). No functional change is intended here other than in human-readable docstrings.
This commit is contained in:
parent
81865002ae
commit
ef172521a9
|
@ -30,20 +30,20 @@ sequence.
|
||||||
pyrepl uses its own keyspec format that is meant to be a strict superset of
|
pyrepl uses its own keyspec format that is meant to be a strict superset of
|
||||||
readline's KEYSEQ format. This means that if a spec is found that readline
|
readline's KEYSEQ format. This means that if a spec is found that readline
|
||||||
accepts that this doesn't, it should be logged as a bug. Note that this means
|
accepts that this doesn't, it should be logged as a bug. Note that this means
|
||||||
we're using the `\\C-o' style of readline's keyspec, not the `Control-o' sort.
|
we're using the '\\C-o' style of readline's keyspec, not the 'Control-o' sort.
|
||||||
|
|
||||||
The extension to readline is that the sequence \\<KEY> denotes the
|
The extension to readline is that the sequence \\<KEY> denotes the
|
||||||
sequence of characters produced by hitting KEY.
|
sequence of characters produced by hitting KEY.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
`a' - what you get when you hit the `a' key
|
'a' - what you get when you hit the 'a' key
|
||||||
`\\EOA' - Escape - O - A (up, on my terminal)
|
'\\EOA' - Escape - O - A (up, on my terminal)
|
||||||
`\\<UP>' - the up arrow key
|
'\\<UP>' - the up arrow key
|
||||||
`\\<up>' - ditto (keynames are case-insensitive)
|
'\\<up>' - ditto (keynames are case-insensitive)
|
||||||
`\\C-o', `\\c-o' - control-o
|
'\\C-o', '\\c-o' - control-o
|
||||||
`\\M-.' - meta-period
|
'\\M-.' - meta-period
|
||||||
`\\E.' - ditto (that's how meta works for pyrepl)
|
'\\E.' - ditto (that's how meta works for pyrepl)
|
||||||
`\\<tab>', `\\<TAB>', `\\t', `\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
|
'\\<tab>', '\\<TAB>', '\\t', '\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
|
||||||
- all of these are the tab character.
|
- all of these are the tab character.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ class Reader:
|
||||||
* console:
|
* console:
|
||||||
Hopefully encapsulates the OS dependent stuff.
|
Hopefully encapsulates the OS dependent stuff.
|
||||||
* pos:
|
* pos:
|
||||||
A 0-based index into `buffer' for where the insertion point
|
A 0-based index into 'buffer' for where the insertion point
|
||||||
is.
|
is.
|
||||||
* screeninfo:
|
* screeninfo:
|
||||||
Ahem. This list contains some info needed to move the
|
Ahem. This list contains some info needed to move the
|
||||||
|
@ -179,7 +179,7 @@ class Reader:
|
||||||
* cxy, lxy:
|
* cxy, lxy:
|
||||||
the position of the insertion point in screen ...
|
the position of the insertion point in screen ...
|
||||||
* syntax_table:
|
* syntax_table:
|
||||||
Dictionary mapping characters to `syntax class'; read the
|
Dictionary mapping characters to 'syntax class'; read the
|
||||||
emacs docs to see what this means :-)
|
emacs docs to see what this means :-)
|
||||||
* commands:
|
* commands:
|
||||||
Dictionary mapping command names to command classes.
|
Dictionary mapping command names to command classes.
|
||||||
|
@ -431,7 +431,7 @@ class Reader:
|
||||||
|
|
||||||
def get_arg(self, default: int = 1) -> int:
|
def get_arg(self, default: int = 1) -> int:
|
||||||
"""Return any prefix argument that the user has supplied,
|
"""Return any prefix argument that the user has supplied,
|
||||||
returning `default' if there is None. Defaults to 1.
|
returning 'default' if there is None. Defaults to 1.
|
||||||
"""
|
"""
|
||||||
if self.arg is None:
|
if self.arg is None:
|
||||||
return default
|
return default
|
||||||
|
@ -440,7 +440,7 @@ class Reader:
|
||||||
|
|
||||||
def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
|
def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
|
||||||
"""Return what should be in the left-hand margin for line
|
"""Return what should be in the left-hand margin for line
|
||||||
`lineno'."""
|
'lineno'."""
|
||||||
if self.arg is not None and cursor_on_line:
|
if self.arg is not None and cursor_on_line:
|
||||||
prompt = "(arg: %s) " % self.arg
|
prompt = "(arg: %s) " % self.arg
|
||||||
elif self.paste_mode:
|
elif self.paste_mode:
|
||||||
|
|
24
Lib/cmd.py
24
Lib/cmd.py
|
@ -5,16 +5,16 @@ Interpreters constructed with this class obey the following conventions:
|
||||||
1. End of file on input is processed as the command 'EOF'.
|
1. End of file on input is processed as the command 'EOF'.
|
||||||
2. A command is parsed out of each line by collecting the prefix composed
|
2. A command is parsed out of each line by collecting the prefix composed
|
||||||
of characters in the identchars member.
|
of characters in the identchars member.
|
||||||
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
|
3. A command 'foo' is dispatched to a method 'do_foo()'; the do_ method
|
||||||
is passed a single argument consisting of the remainder of the line.
|
is passed a single argument consisting of the remainder of the line.
|
||||||
4. Typing an empty line repeats the last command. (Actually, it calls the
|
4. Typing an empty line repeats the last command. (Actually, it calls the
|
||||||
method `emptyline', which may be overridden in a subclass.)
|
method 'emptyline', which may be overridden in a subclass.)
|
||||||
5. There is a predefined `help' method. Given an argument `topic', it
|
5. There is a predefined 'help' method. Given an argument 'topic', it
|
||||||
calls the command `help_topic'. With no arguments, it lists all topics
|
calls the command 'help_topic'. With no arguments, it lists all topics
|
||||||
with defined help_ functions, broken into up to three topics; documented
|
with defined help_ functions, broken into up to three topics; documented
|
||||||
commands, miscellaneous help topics, and undocumented commands.
|
commands, miscellaneous help topics, and undocumented commands.
|
||||||
6. The command '?' is a synonym for `help'. The command '!' is a synonym
|
6. The command '?' is a synonym for 'help'. The command '!' is a synonym
|
||||||
for `shell', if a do_shell method exists.
|
for 'shell', if a do_shell method exists.
|
||||||
7. If completion is enabled, completing commands will be done automatically,
|
7. If completion is enabled, completing commands will be done automatically,
|
||||||
and completing of commands args is done by calling complete_foo() with
|
and completing of commands args is done by calling complete_foo() with
|
||||||
arguments text, line, begidx, endidx. text is string we are matching
|
arguments text, line, begidx, endidx. text is string we are matching
|
||||||
|
@ -23,21 +23,21 @@ Interpreters constructed with this class obey the following conventions:
|
||||||
indexes of the text being matched, which could be used to provide
|
indexes of the text being matched, which could be used to provide
|
||||||
different completion depending upon which position the argument is in.
|
different completion depending upon which position the argument is in.
|
||||||
|
|
||||||
The `default' method may be overridden to intercept commands for which there
|
The 'default' method may be overridden to intercept commands for which there
|
||||||
is no do_ method.
|
is no do_ method.
|
||||||
|
|
||||||
The `completedefault' method may be overridden to intercept completions for
|
The 'completedefault' method may be overridden to intercept completions for
|
||||||
commands that have no complete_ method.
|
commands that have no complete_ method.
|
||||||
|
|
||||||
The data member `self.ruler' sets the character used to draw separator lines
|
The data member 'self.ruler' sets the character used to draw separator lines
|
||||||
in the help messages. If empty, no ruler line is drawn. It defaults to "=".
|
in the help messages. If empty, no ruler line is drawn. It defaults to "=".
|
||||||
|
|
||||||
If the value of `self.intro' is nonempty when the cmdloop method is called,
|
If the value of 'self.intro' is nonempty when the cmdloop method is called,
|
||||||
it is printed out on interpreter startup. This value may be overridden
|
it is printed out on interpreter startup. This value may be overridden
|
||||||
via an optional argument to the cmdloop() method.
|
via an optional argument to the cmdloop() method.
|
||||||
|
|
||||||
The data members `self.doc_header', `self.misc_header', and
|
The data members 'self.doc_header', 'self.misc_header', and
|
||||||
`self.undoc_header' set the headers used for the help function's
|
'self.undoc_header' set the headers used for the help function's
|
||||||
listings of documented functions, miscellaneous topics, and undocumented
|
listings of documented functions, miscellaneous topics, and undocumented
|
||||||
functions respectively.
|
functions respectively.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -957,7 +957,7 @@ class RawConfigParser(MutableMapping):
|
||||||
self._sections[section].items(), d)
|
self._sections[section].items(), d)
|
||||||
|
|
||||||
def _write_section(self, fp, section_name, section_items, delimiter, unnamed=False):
|
def _write_section(self, fp, section_name, section_items, delimiter, unnamed=False):
|
||||||
"""Write a single section to the specified `fp'."""
|
"""Write a single section to the specified 'fp'."""
|
||||||
if not unnamed:
|
if not unnamed:
|
||||||
fp.write("[{}]\n".format(section_name))
|
fp.write("[{}]\n".format(section_name))
|
||||||
for key, value in section_items:
|
for key, value in section_items:
|
||||||
|
|
|
@ -1227,7 +1227,7 @@ class DocTestRunner:
|
||||||
`OutputChecker` to the constructor.
|
`OutputChecker` to the constructor.
|
||||||
|
|
||||||
The test runner's display output can be controlled in two ways.
|
The test runner's display output can be controlled in two ways.
|
||||||
First, an output function (`out) can be passed to
|
First, an output function (`out`) can be passed to
|
||||||
`TestRunner.run`; this function will be called with strings that
|
`TestRunner.run`; this function will be called with strings that
|
||||||
should be displayed. It defaults to `sys.stdout.write`. If
|
should be displayed. It defaults to `sys.stdout.write`. If
|
||||||
capturing the output is not sufficient, then the display output
|
capturing the output is not sufficient, then the display output
|
||||||
|
@ -2734,7 +2734,7 @@ def testsource(module, name):
|
||||||
return testsrc
|
return testsrc
|
||||||
|
|
||||||
def debug_src(src, pm=False, globs=None):
|
def debug_src(src, pm=False, globs=None):
|
||||||
"""Debug a single doctest docstring, in argument `src`'"""
|
"""Debug a single doctest docstring, in argument `src`"""
|
||||||
testsrc = script_from_examples(src)
|
testsrc = script_from_examples(src)
|
||||||
debug_script(testsrc, pm, globs)
|
debug_script(testsrc, pm, globs)
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ class AddrlistClass:
|
||||||
def __init__(self, field):
|
def __init__(self, field):
|
||||||
"""Initialize a new instance.
|
"""Initialize a new instance.
|
||||||
|
|
||||||
`field' is an unparsed address header field, containing
|
'field' is an unparsed address header field, containing
|
||||||
one or more addresses.
|
one or more addresses.
|
||||||
"""
|
"""
|
||||||
self.specials = '()<>@,:;.\"[]'
|
self.specials = '()<>@,:;.\"[]'
|
||||||
|
@ -233,7 +233,7 @@ class AddrlistClass:
|
||||||
self.CR = '\r\n'
|
self.CR = '\r\n'
|
||||||
self.FWS = self.LWS + self.CR
|
self.FWS = self.LWS + self.CR
|
||||||
self.atomends = self.specials + self.LWS + self.CR
|
self.atomends = self.specials + self.LWS + self.CR
|
||||||
# Note that RFC 2822 now specifies `.' as obs-phrase, meaning that it
|
# Note that RFC 2822 now specifies '.' as obs-phrase, meaning that it
|
||||||
# is obsolete syntax. RFC 2822 requires that we recognize obsolete
|
# is obsolete syntax. RFC 2822 requires that we recognize obsolete
|
||||||
# syntax, so allow dots in phrases.
|
# syntax, so allow dots in phrases.
|
||||||
self.phraseends = self.atomends.replace('.', '')
|
self.phraseends = self.atomends.replace('.', '')
|
||||||
|
@ -423,14 +423,14 @@ class AddrlistClass:
|
||||||
def getdelimited(self, beginchar, endchars, allowcomments=True):
|
def getdelimited(self, beginchar, endchars, allowcomments=True):
|
||||||
"""Parse a header fragment delimited by special characters.
|
"""Parse a header fragment delimited by special characters.
|
||||||
|
|
||||||
`beginchar' is the start character for the fragment.
|
'beginchar' is the start character for the fragment.
|
||||||
If self is not looking at an instance of `beginchar' then
|
If self is not looking at an instance of 'beginchar' then
|
||||||
getdelimited returns the empty string.
|
getdelimited returns the empty string.
|
||||||
|
|
||||||
`endchars' is a sequence of allowable end-delimiting characters.
|
'endchars' is a sequence of allowable end-delimiting characters.
|
||||||
Parsing stops when one of these is encountered.
|
Parsing stops when one of these is encountered.
|
||||||
|
|
||||||
If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed
|
If 'allowcomments' is non-zero, embedded RFC 2822 comments are allowed
|
||||||
within the parsed fragment.
|
within the parsed fragment.
|
||||||
"""
|
"""
|
||||||
if self.field[self.pos] != beginchar:
|
if self.field[self.pos] != beginchar:
|
||||||
|
@ -474,7 +474,7 @@ class AddrlistClass:
|
||||||
|
|
||||||
Optional atomends specifies a different set of end token delimiters
|
Optional atomends specifies a different set of end token delimiters
|
||||||
(the default is to use self.atomends). This is used e.g. in
|
(the default is to use self.atomends). This is used e.g. in
|
||||||
getphraselist() since phrase endings must not include the `.' (which
|
getphraselist() since phrase endings must not include the '.' (which
|
||||||
is legal in phrases)."""
|
is legal in phrases)."""
|
||||||
atomlist = ['']
|
atomlist = ['']
|
||||||
if atomends is None:
|
if atomends is None:
|
||||||
|
|
|
@ -150,7 +150,7 @@ class Policy(_PolicyBase, metaclass=abc.ABCMeta):
|
||||||
wrapping is done. Default is 78.
|
wrapping is done. Default is 78.
|
||||||
|
|
||||||
mangle_from_ -- a flag that, when True escapes From_ lines in the
|
mangle_from_ -- a flag that, when True escapes From_ lines in the
|
||||||
body of the message by putting a `>' in front of
|
body of the message by putting a '>' in front of
|
||||||
them. This is used when the message is being
|
them. This is used when the message is being
|
||||||
serialized by a generator. Default: False.
|
serialized by a generator. Default: False.
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ This module provides an interface to encode and decode both headers and bodies
|
||||||
with Base64 encoding.
|
with Base64 encoding.
|
||||||
|
|
||||||
RFC 2045 defines a method for including character set information in an
|
RFC 2045 defines a method for including character set information in an
|
||||||
`encoded-word' in a header. This method is commonly used for 8-bit real names
|
'encoded-word' in a header. This method is commonly used for 8-bit real names
|
||||||
in To:, From:, Cc:, etc. fields, as well as Subject: lines.
|
in To:, From:, Cc:, etc. fields, as well as Subject: lines.
|
||||||
|
|
||||||
This module does not do the line wrapping or end-of-line character conversion
|
This module does not do the line wrapping or end-of-line character conversion
|
||||||
|
|
|
@ -175,7 +175,7 @@ class Charset:
|
||||||
module expose the following information about a character set:
|
module expose the following information about a character set:
|
||||||
|
|
||||||
input_charset: The initial character set specified. Common aliases
|
input_charset: The initial character set specified. Common aliases
|
||||||
are converted to their `official' email names (e.g. latin_1
|
are converted to their 'official' email names (e.g. latin_1
|
||||||
is converted to iso-8859-1). Defaults to 7-bit us-ascii.
|
is converted to iso-8859-1). Defaults to 7-bit us-ascii.
|
||||||
|
|
||||||
header_encoding: If the character set must be encoded before it can be
|
header_encoding: If the character set must be encoded before it can be
|
||||||
|
@ -245,7 +245,7 @@ class Charset:
|
||||||
def get_body_encoding(self):
|
def get_body_encoding(self):
|
||||||
"""Return the content-transfer-encoding used for body encoding.
|
"""Return the content-transfer-encoding used for body encoding.
|
||||||
|
|
||||||
This is either the string `quoted-printable' or `base64' depending on
|
This is either the string 'quoted-printable' or 'base64' depending on
|
||||||
the encoding used, or it is a function in which case you should call
|
the encoding used, or it is a function in which case you should call
|
||||||
the function with a single argument, the Message object being
|
the function with a single argument, the Message object being
|
||||||
encoded. The function should then set the Content-Transfer-Encoding
|
encoded. The function should then set the Content-Transfer-Encoding
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Generator:
|
||||||
|
|
||||||
Optional mangle_from_ is a flag that, when True (the default if policy
|
Optional mangle_from_ is a flag that, when True (the default if policy
|
||||||
is not set), escapes From_ lines in the body of the message by putting
|
is not set), escapes From_ lines in the body of the message by putting
|
||||||
a `>' in front of them.
|
a '>' in front of them.
|
||||||
|
|
||||||
Optional maxheaderlen specifies the longest length for a non-continued
|
Optional maxheaderlen specifies the longest length for a non-continued
|
||||||
header. When a header line is longer (in characters, with tabs
|
header. When a header line is longer (in characters, with tabs
|
||||||
|
@ -74,7 +74,7 @@ class Generator:
|
||||||
|
|
||||||
unixfrom is a flag that forces the printing of a Unix From_ delimiter
|
unixfrom is a flag that forces the printing of a Unix From_ delimiter
|
||||||
before the first object in the message tree. If the original message
|
before the first object in the message tree. If the original message
|
||||||
has no From_ delimiter, a `standard' one is crafted. By default, this
|
has no From_ delimiter, a 'standard' one is crafted. By default, this
|
||||||
is False to inhibit the printing of any From_ delimiter.
|
is False to inhibit the printing of any From_ delimiter.
|
||||||
|
|
||||||
Note that for subobjects, no From_ line is printed.
|
Note that for subobjects, no From_ line is printed.
|
||||||
|
@ -456,7 +456,7 @@ class DecodedGenerator(Generator):
|
||||||
argument is allowed.
|
argument is allowed.
|
||||||
|
|
||||||
Walks through all subparts of a message. If the subpart is of main
|
Walks through all subparts of a message. If the subpart is of main
|
||||||
type `text', then it prints the decoded payload of the subpart.
|
type 'text', then it prints the decoded payload of the subpart.
|
||||||
|
|
||||||
Otherwise, fmt is a format string that is used instead of the message
|
Otherwise, fmt is a format string that is used instead of the message
|
||||||
payload. fmt is expanded with the following keywords (in
|
payload. fmt is expanded with the following keywords (in
|
||||||
|
|
|
@ -192,7 +192,7 @@ class Header:
|
||||||
|
|
||||||
The maximum line length can be specified explicitly via maxlinelen. For
|
The maximum line length can be specified explicitly via maxlinelen. For
|
||||||
splitting the first line to a shorter value (to account for the field
|
splitting the first line to a shorter value (to account for the field
|
||||||
header which isn't included in s, e.g. `Subject') pass in the name of
|
header which isn't included in s, e.g. 'Subject') pass in the name of
|
||||||
the field in header_name. The default maxlinelen is 78 as recommended
|
the field in header_name. The default maxlinelen is 78 as recommended
|
||||||
by RFC 2822.
|
by RFC 2822.
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ class Header:
|
||||||
output codec of the charset. If the string cannot be encoded to the
|
output codec of the charset. If the string cannot be encoded to the
|
||||||
output codec, a UnicodeError will be raised.
|
output codec, a UnicodeError will be raised.
|
||||||
|
|
||||||
Optional `errors' is passed as the errors argument to the decode
|
Optional 'errors' is passed as the errors argument to the decode
|
||||||
call if s is a byte string.
|
call if s is a byte string.
|
||||||
"""
|
"""
|
||||||
if charset is None:
|
if charset is None:
|
||||||
|
@ -326,7 +326,7 @@ class Header:
|
||||||
|
|
||||||
Optional splitchars is a string containing characters which should be
|
Optional splitchars is a string containing characters which should be
|
||||||
given extra weight by the splitting algorithm during normal header
|
given extra weight by the splitting algorithm during normal header
|
||||||
wrapping. This is in very rough support of RFC 2822's `higher level
|
wrapping. This is in very rough support of RFC 2822's 'higher level
|
||||||
syntactic breaks': split points preceded by a splitchar are preferred
|
syntactic breaks': split points preceded by a splitchar are preferred
|
||||||
during line splitting, with the characters preferred in the order in
|
during line splitting, with the characters preferred in the order in
|
||||||
which they appear in the string. Space and tab may be included in the
|
which they appear in the string. Space and tab may be included in the
|
||||||
|
|
|
@ -43,8 +43,8 @@ def body_line_iterator(msg, decode=False):
|
||||||
def typed_subpart_iterator(msg, maintype='text', subtype=None):
|
def typed_subpart_iterator(msg, maintype='text', subtype=None):
|
||||||
"""Iterate over the subparts with a given MIME type.
|
"""Iterate over the subparts with a given MIME type.
|
||||||
|
|
||||||
Use `maintype' as the main MIME type to match against; this defaults to
|
Use 'maintype' as the main MIME type to match against; this defaults to
|
||||||
"text". Optional `subtype' is the MIME subtype to match against; if
|
"text". Optional 'subtype' is the MIME subtype to match against; if
|
||||||
omitted, only the main type is matched.
|
omitted, only the main type is matched.
|
||||||
"""
|
"""
|
||||||
for subpart in msg.walk():
|
for subpart in msg.walk():
|
||||||
|
|
|
@ -21,7 +21,7 @@ Charset = _charset.Charset
|
||||||
|
|
||||||
SEMISPACE = '; '
|
SEMISPACE = '; '
|
||||||
|
|
||||||
# Regular expression that matches `special' characters in parameters, the
|
# Regular expression that matches 'special' characters in parameters, the
|
||||||
# existence of which force quoting of the parameter value.
|
# existence of which force quoting of the parameter value.
|
||||||
tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
|
tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class Message:
|
||||||
multipart or a message/rfc822), then the payload is a list of Message
|
multipart or a message/rfc822), then the payload is a list of Message
|
||||||
objects, otherwise it is a string.
|
objects, otherwise it is a string.
|
||||||
|
|
||||||
Message objects implement part of the `mapping' interface, which assumes
|
Message objects implement part of the 'mapping' interface, which assumes
|
||||||
there is exactly one occurrence of the header per message. Some headers
|
there is exactly one occurrence of the header per message. Some headers
|
||||||
do in fact appear multiple times (e.g. Received) and for those headers,
|
do in fact appear multiple times (e.g. Received) and for those headers,
|
||||||
you must use the explicit API to set or get all the headers. Not all of
|
you must use the explicit API to set or get all the headers. Not all of
|
||||||
|
@ -597,7 +597,7 @@ class Message:
|
||||||
"""Return the message's content type.
|
"""Return the message's content type.
|
||||||
|
|
||||||
The returned string is coerced to lower case of the form
|
The returned string is coerced to lower case of the form
|
||||||
`maintype/subtype'. If there was no Content-Type header in the
|
'maintype/subtype'. If there was no Content-Type header in the
|
||||||
message, the default type as given by get_default_type() will be
|
message, the default type as given by get_default_type() will be
|
||||||
returned. Since according to RFC 2045, messages always have a default
|
returned. Since according to RFC 2045, messages always have a default
|
||||||
type this will always return a value.
|
type this will always return a value.
|
||||||
|
@ -620,7 +620,7 @@ class Message:
|
||||||
def get_content_maintype(self):
|
def get_content_maintype(self):
|
||||||
"""Return the message's main content type.
|
"""Return the message's main content type.
|
||||||
|
|
||||||
This is the `maintype' part of the string returned by
|
This is the 'maintype' part of the string returned by
|
||||||
get_content_type().
|
get_content_type().
|
||||||
"""
|
"""
|
||||||
ctype = self.get_content_type()
|
ctype = self.get_content_type()
|
||||||
|
@ -629,14 +629,14 @@ class Message:
|
||||||
def get_content_subtype(self):
|
def get_content_subtype(self):
|
||||||
"""Returns the message's sub-content type.
|
"""Returns the message's sub-content type.
|
||||||
|
|
||||||
This is the `subtype' part of the string returned by
|
This is the 'subtype' part of the string returned by
|
||||||
get_content_type().
|
get_content_type().
|
||||||
"""
|
"""
|
||||||
ctype = self.get_content_type()
|
ctype = self.get_content_type()
|
||||||
return ctype.split('/')[1]
|
return ctype.split('/')[1]
|
||||||
|
|
||||||
def get_default_type(self):
|
def get_default_type(self):
|
||||||
"""Return the `default' content type.
|
"""Return the 'default' content type.
|
||||||
|
|
||||||
Most messages have a default content type of text/plain, except for
|
Most messages have a default content type of text/plain, except for
|
||||||
messages that are subparts of multipart/digest containers. Such
|
messages that are subparts of multipart/digest containers. Such
|
||||||
|
@ -645,7 +645,7 @@ class Message:
|
||||||
return self._default_type
|
return self._default_type
|
||||||
|
|
||||||
def set_default_type(self, ctype):
|
def set_default_type(self, ctype):
|
||||||
"""Set the `default' content type.
|
"""Set the 'default' content type.
|
||||||
|
|
||||||
ctype should be either "text/plain" or "message/rfc822", although this
|
ctype should be either "text/plain" or "message/rfc822", although this
|
||||||
is not enforced. The default content type is not stored in the
|
is not enforced. The default content type is not stored in the
|
||||||
|
@ -678,8 +678,8 @@ class Message:
|
||||||
"""Return the message's Content-Type parameters, as a list.
|
"""Return the message's Content-Type parameters, as a list.
|
||||||
|
|
||||||
The elements of the returned list are 2-tuples of key/value pairs, as
|
The elements of the returned list are 2-tuples of key/value pairs, as
|
||||||
split on the `=' sign. The left hand side of the `=' is the key,
|
split on the '=' sign. The left hand side of the '=' is the key,
|
||||||
while the right hand side is the value. If there is no `=' sign in
|
while the right hand side is the value. If there is no '=' sign in
|
||||||
the parameter the value is the empty string. The value is as
|
the parameter the value is the empty string. The value is as
|
||||||
described in the get_param() method.
|
described in the get_param() method.
|
||||||
|
|
||||||
|
@ -839,9 +839,9 @@ class Message:
|
||||||
"""Return the filename associated with the payload if present.
|
"""Return the filename associated with the payload if present.
|
||||||
|
|
||||||
The filename is extracted from the Content-Disposition header's
|
The filename is extracted from the Content-Disposition header's
|
||||||
`filename' parameter, and it is unquoted. If that header is missing
|
'filename' parameter, and it is unquoted. If that header is missing
|
||||||
the `filename' parameter, this method falls back to looking for the
|
the 'filename' parameter, this method falls back to looking for the
|
||||||
`name' parameter.
|
'name' parameter.
|
||||||
"""
|
"""
|
||||||
missing = object()
|
missing = object()
|
||||||
filename = self.get_param('filename', missing, 'content-disposition')
|
filename = self.get_param('filename', missing, 'content-disposition')
|
||||||
|
@ -854,7 +854,7 @@ class Message:
|
||||||
def get_boundary(self, failobj=None):
|
def get_boundary(self, failobj=None):
|
||||||
"""Return the boundary associated with the payload if present.
|
"""Return the boundary associated with the payload if present.
|
||||||
|
|
||||||
The boundary is extracted from the Content-Type header's `boundary'
|
The boundary is extracted from the Content-Type header's 'boundary'
|
||||||
parameter, and it is unquoted.
|
parameter, and it is unquoted.
|
||||||
"""
|
"""
|
||||||
missing = object()
|
missing = object()
|
||||||
|
|
|
@ -21,7 +21,7 @@ class MIMEMultipart(MIMEBase):
|
||||||
Content-Type and MIME-Version headers.
|
Content-Type and MIME-Version headers.
|
||||||
|
|
||||||
_subtype is the subtype of the multipart content type, defaulting to
|
_subtype is the subtype of the multipart content type, defaulting to
|
||||||
`mixed'.
|
'mixed'.
|
||||||
|
|
||||||
boundary is the multipart boundary string. By default it is
|
boundary is the multipart boundary string. By default it is
|
||||||
calculated as needed.
|
calculated as needed.
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Parser:
|
||||||
textual representation of the message.
|
textual representation of the message.
|
||||||
|
|
||||||
The string must be formatted as a block of RFC 2822 headers and header
|
The string must be formatted as a block of RFC 2822 headers and header
|
||||||
continuation lines, optionally preceded by a `Unix-from' header. The
|
continuation lines, optionally preceded by a 'Unix-from' header. The
|
||||||
header block is terminated either by the end of the string or by a
|
header block is terminated either by the end of the string or by a
|
||||||
blank line.
|
blank line.
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class BytesParser:
|
||||||
textual representation of the message.
|
textual representation of the message.
|
||||||
|
|
||||||
The input must be formatted as a block of RFC 2822 headers and header
|
The input must be formatted as a block of RFC 2822 headers and header
|
||||||
continuation lines, optionally preceded by a `Unix-from' header. The
|
continuation lines, optionally preceded by a 'Unix-from' header. The
|
||||||
header block is terminated either by the end of the input or by a
|
header block is terminated either by the end of the input or by a
|
||||||
blank line.
|
blank line.
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"""Quoted-printable content transfer encoding per RFCs 2045-2047.
|
"""Quoted-printable content transfer encoding per RFCs 2045-2047.
|
||||||
|
|
||||||
This module handles the content transfer encoding method defined in RFC 2045
|
This module handles the content transfer encoding method defined in RFC 2045
|
||||||
to encode US ASCII-like 8-bit data called `quoted-printable'. It is used to
|
to encode US ASCII-like 8-bit data called 'quoted-printable'. It is used to
|
||||||
safely encode text that is in a character set similar to the 7-bit US ASCII
|
safely encode text that is in a character set similar to the 7-bit US ASCII
|
||||||
character set, but that includes some 8-bit characters that are normally not
|
character set, but that includes some 8-bit characters that are normally not
|
||||||
allowed in email bodies or headers.
|
allowed in email bodies or headers.
|
||||||
|
@ -17,7 +17,7 @@ This module provides an interface to encode and decode both headers and bodies
|
||||||
with quoted-printable encoding.
|
with quoted-printable encoding.
|
||||||
|
|
||||||
RFC 2045 defines a method for including character set information in an
|
RFC 2045 defines a method for including character set information in an
|
||||||
`encoded-word' in a header. This method is commonly used for 8-bit real names
|
'encoded-word' in a header. This method is commonly used for 8-bit real names
|
||||||
in To:/From:/Cc: etc. fields, as well as Subject: lines.
|
in To:/From:/Cc: etc. fields, as well as Subject: lines.
|
||||||
|
|
||||||
This module does not do the line wrapping or end-of-line character
|
This module does not do the line wrapping or end-of-line character
|
||||||
|
@ -127,7 +127,7 @@ def quote(c):
|
||||||
def header_encode(header_bytes, charset='iso-8859-1'):
|
def header_encode(header_bytes, charset='iso-8859-1'):
|
||||||
"""Encode a single header line with quoted-printable (like) encoding.
|
"""Encode a single header line with quoted-printable (like) encoding.
|
||||||
|
|
||||||
Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
|
Defined in RFC 2045, this 'Q' encoding is similar to quoted-printable, but
|
||||||
used specifically for email header fields to allow charsets with mostly 7
|
used specifically for email header fields to allow charsets with mostly 7
|
||||||
bit characters (and some 8 bit) to remain more or less readable in non-RFC
|
bit characters (and some 8 bit) to remain more or less readable in non-RFC
|
||||||
2045 aware mail clients.
|
2045 aware mail clients.
|
||||||
|
@ -290,7 +290,7 @@ def _unquote_match(match):
|
||||||
|
|
||||||
# Header decoding is done a bit differently
|
# Header decoding is done a bit differently
|
||||||
def header_decode(s):
|
def header_decode(s):
|
||||||
"""Decode a string encoded with RFC 2045 MIME header `Q' encoding.
|
"""Decode a string encoded with RFC 2045 MIME header 'Q' encoding.
|
||||||
|
|
||||||
This function does not parse a full MIME header value encoded with
|
This function does not parse a full MIME header value encoded with
|
||||||
quoted-printable (like =?iso-8859-1?q?Hello_World?=) -- please use
|
quoted-printable (like =?iso-8859-1?q?Hello_World?=) -- please use
|
||||||
|
|
|
@ -343,7 +343,7 @@ class FTP:
|
||||||
connection and the expected size of the transfer. The
|
connection and the expected size of the transfer. The
|
||||||
expected size may be None if it could not be determined.
|
expected size may be None if it could not be determined.
|
||||||
|
|
||||||
Optional `rest' argument can be a string that is sent as the
|
Optional 'rest' argument can be a string that is sent as the
|
||||||
argument to a REST command. This is essentially a server
|
argument to a REST command. This is essentially a server
|
||||||
marker used to tell the server to skip over any data up to the
|
marker used to tell the server to skip over any data up to the
|
||||||
given marker.
|
given marker.
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
This module helps scripts to parse the command line arguments in
|
This module helps scripts to parse the command line arguments in
|
||||||
sys.argv. It supports the same conventions as the Unix getopt()
|
sys.argv. It supports the same conventions as the Unix getopt()
|
||||||
function (including the special meanings of arguments of the form `-'
|
function (including the special meanings of arguments of the form '-'
|
||||||
and `--'). Long options similar to those supported by GNU software
|
and '--'). Long options similar to those supported by GNU software
|
||||||
may be used as well via an optional third argument. This module
|
may be used as well via an optional third argument. This module
|
||||||
provides two functions and an exception:
|
provides two functions and an exception:
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ def gnu_getopt(args, shortopts, longopts = []):
|
||||||
processing options as soon as a non-option argument is
|
processing options as soon as a non-option argument is
|
||||||
encountered.
|
encountered.
|
||||||
|
|
||||||
If the first character of the option string is `+', or if the
|
If the first character of the option string is '+', or if the
|
||||||
environment variable POSIXLY_CORRECT is set, then option
|
environment variable POSIXLY_CORRECT is set, then option
|
||||||
processing stops as soon as a non-option argument is encountered.
|
processing stops as soon as a non-option argument is encountered.
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ non-existing elements are considered to be infinite. The interesting
|
||||||
property of a heap is that a[0] is always its smallest element.
|
property of a heap is that a[0] is always its smallest element.
|
||||||
|
|
||||||
The strange invariant above is meant to be an efficient memory
|
The strange invariant above is meant to be an efficient memory
|
||||||
representation for a tournament. The numbers below are `k', not a[k]:
|
representation for a tournament. The numbers below are 'k', not a[k]:
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ representation for a tournament. The numbers below are `k', not a[k]:
|
||||||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
||||||
|
|
||||||
|
|
||||||
In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In
|
In the tree above, each cell 'k' is topping '2*k+1' and '2*k+2'. In
|
||||||
a usual binary tournament we see in sports, each cell is the winner
|
a usual binary tournament we see in sports, each cell is the winner
|
||||||
over the two cells it tops, and we can trace the winner down the tree
|
over the two cells it tops, and we can trace the winner down the tree
|
||||||
to see all opponents s/he had. However, in many computer applications
|
to see all opponents s/he had. However, in many computer applications
|
||||||
|
@ -110,7 +110,7 @@ vanishes, you switch heaps and start a new run. Clever and quite
|
||||||
effective!
|
effective!
|
||||||
|
|
||||||
In a word, heaps are useful memory structures to know. I use them in
|
In a word, heaps are useful memory structures to know. I use them in
|
||||||
a few applications, and I think it is good to keep a `heap' module
|
a few applications, and I think it is good to keep a 'heap' module
|
||||||
around. :-)
|
around. :-)
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -1025,7 +1025,7 @@ class HTTPConnection:
|
||||||
response.close()
|
response.close()
|
||||||
|
|
||||||
def send(self, data):
|
def send(self, data):
|
||||||
"""Send `data' to the server.
|
"""Send 'data' to the server.
|
||||||
``data`` can be a string object, a bytes object, an array object, a
|
``data`` can be a string object, a bytes object, an array object, a
|
||||||
file-like object that supports a .read() method, or an iterable object.
|
file-like object that supports a .read() method, or an iterable object.
|
||||||
"""
|
"""
|
||||||
|
@ -1137,10 +1137,10 @@ class HTTPConnection:
|
||||||
skip_accept_encoding=False):
|
skip_accept_encoding=False):
|
||||||
"""Send a request to the server.
|
"""Send a request to the server.
|
||||||
|
|
||||||
`method' specifies an HTTP request method, e.g. 'GET'.
|
'method' specifies an HTTP request method, e.g. 'GET'.
|
||||||
`url' specifies the object being requested, e.g. '/index.html'.
|
'url' specifies the object being requested, e.g. '/index.html'.
|
||||||
`skip_host' if True does not add automatically a 'Host:' header
|
'skip_host' if True does not add automatically a 'Host:' header
|
||||||
`skip_accept_encoding' if True does not add automatically an
|
'skip_accept_encoding' if True does not add automatically an
|
||||||
'Accept-Encoding:' header
|
'Accept-Encoding:' header
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -1986,7 +1986,7 @@ class MozillaCookieJar(FileCookieJar):
|
||||||
|
|
||||||
This class differs from CookieJar only in the format it uses to save and
|
This class differs from CookieJar only in the format it uses to save and
|
||||||
load cookies to and from a file. This class uses the Mozilla/Netscape
|
load cookies to and from a file. This class uses the Mozilla/Netscape
|
||||||
`cookies.txt' format. curl and lynx use this file format, too.
|
'cookies.txt' format. curl and lynx use this file format, too.
|
||||||
|
|
||||||
Don't expect cookies saved while the browser is running to be noticed by
|
Don't expect cookies saved while the browser is running to be noticed by
|
||||||
the browser (in fact, Mozilla on unix will overwrite your saved cookies if
|
the browser (in fact, Mozilla on unix will overwrite your saved cookies if
|
||||||
|
|
|
@ -239,7 +239,7 @@ class IMAP4:
|
||||||
if __debug__:
|
if __debug__:
|
||||||
self._cmd_log_len = 10
|
self._cmd_log_len = 10
|
||||||
self._cmd_log_idx = 0
|
self._cmd_log_idx = 0
|
||||||
self._cmd_log = {} # Last `_cmd_log_len' interactions
|
self._cmd_log = {} # Last '_cmd_log_len' interactions
|
||||||
if self.debug >= 1:
|
if self.debug >= 1:
|
||||||
self._mesg('imaplib version %s' % __version__)
|
self._mesg('imaplib version %s' % __version__)
|
||||||
self._mesg('new IMAP4 connection, tag=%s' % self.tagpre)
|
self._mesg('new IMAP4 connection, tag=%s' % self.tagpre)
|
||||||
|
@ -396,7 +396,7 @@ class IMAP4:
|
||||||
|
|
||||||
(typ, [data]) = <instance>.append(mailbox, flags, date_time, message)
|
(typ, [data]) = <instance>.append(mailbox, flags, date_time, message)
|
||||||
|
|
||||||
All args except `message' can be None.
|
All args except 'message' can be None.
|
||||||
"""
|
"""
|
||||||
name = 'APPEND'
|
name = 'APPEND'
|
||||||
if not mailbox:
|
if not mailbox:
|
||||||
|
@ -927,7 +927,7 @@ class IMAP4:
|
||||||
|
|
||||||
(typ, [data]) = <instance>.xatom(name, arg, ...)
|
(typ, [data]) = <instance>.xatom(name, arg, ...)
|
||||||
|
|
||||||
Returns response appropriate to extension command `name'.
|
Returns response appropriate to extension command 'name'.
|
||||||
"""
|
"""
|
||||||
name = name.upper()
|
name = name.upper()
|
||||||
#if not name in self.capabilities: # Let the server decide!
|
#if not name in self.capabilities: # Let the server decide!
|
||||||
|
@ -1167,7 +1167,7 @@ class IMAP4:
|
||||||
# Some have reported "unexpected response" exceptions.
|
# Some have reported "unexpected response" exceptions.
|
||||||
# Note that ignoring them here causes loops.
|
# Note that ignoring them here causes loops.
|
||||||
# Instead, send me details of the unexpected response and
|
# Instead, send me details of the unexpected response and
|
||||||
# I'll update the code in `_get_response()'.
|
# I'll update the code in '_get_response()'.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._get_response()
|
self._get_response()
|
||||||
|
@ -1259,7 +1259,7 @@ class IMAP4:
|
||||||
self._mesg('untagged responses dump:' + '\n\t\t'.join(items))
|
self._mesg('untagged responses dump:' + '\n\t\t'.join(items))
|
||||||
|
|
||||||
def _log(self, line):
|
def _log(self, line):
|
||||||
# Keep log of last `_cmd_log_len' interactions for debugging.
|
# Keep log of last '_cmd_log_len' interactions for debugging.
|
||||||
self._cmd_log[self._cmd_log_idx] = (line, time.time())
|
self._cmd_log[self._cmd_log_idx] = (line, time.time())
|
||||||
self._cmd_log_idx += 1
|
self._cmd_log_idx += 1
|
||||||
if self._cmd_log_idx >= self._cmd_log_len:
|
if self._cmd_log_idx >= self._cmd_log_len:
|
||||||
|
|
|
@ -116,7 +116,7 @@ class MimeTypes:
|
||||||
mapped to '.tar.gz'. (This is table-driven too, using the
|
mapped to '.tar.gz'. (This is table-driven too, using the
|
||||||
dictionary suffix_map.)
|
dictionary suffix_map.)
|
||||||
|
|
||||||
Optional `strict' argument when False adds a bunch of commonly found,
|
Optional 'strict' argument when False adds a bunch of commonly found,
|
||||||
but non-standard types.
|
but non-standard types.
|
||||||
"""
|
"""
|
||||||
# TODO: Deprecate accepting file paths (in particular path-like objects).
|
# TODO: Deprecate accepting file paths (in particular path-like objects).
|
||||||
|
@ -185,9 +185,9 @@ class MimeTypes:
|
||||||
Return value is a list of strings giving the possible filename
|
Return value is a list of strings giving the possible filename
|
||||||
extensions, including the leading dot ('.'). The extension is not
|
extensions, including the leading dot ('.'). The extension is not
|
||||||
guaranteed to have been associated with any particular data stream,
|
guaranteed to have been associated with any particular data stream,
|
||||||
but would be mapped to the MIME type `type' by guess_type().
|
but would be mapped to the MIME type 'type' by guess_type().
|
||||||
|
|
||||||
Optional `strict' argument when false adds a bunch of commonly found,
|
Optional 'strict' argument when false adds a bunch of commonly found,
|
||||||
but non-standard types.
|
but non-standard types.
|
||||||
"""
|
"""
|
||||||
type = type.lower()
|
type = type.lower()
|
||||||
|
@ -204,11 +204,11 @@ class MimeTypes:
|
||||||
Return value is a string giving a filename extension,
|
Return value is a string giving a filename extension,
|
||||||
including the leading dot ('.'). The extension is not
|
including the leading dot ('.'). The extension is not
|
||||||
guaranteed to have been associated with any particular data
|
guaranteed to have been associated with any particular data
|
||||||
stream, but would be mapped to the MIME type `type' by
|
stream, but would be mapped to the MIME type 'type' by
|
||||||
guess_type(). If no extension can be guessed for `type', None
|
guess_type(). If no extension can be guessed for 'type', None
|
||||||
is returned.
|
is returned.
|
||||||
|
|
||||||
Optional `strict' argument when false adds a bunch of commonly found,
|
Optional 'strict' argument when false adds a bunch of commonly found,
|
||||||
but non-standard types.
|
but non-standard types.
|
||||||
"""
|
"""
|
||||||
extensions = self.guess_all_extensions(type, strict)
|
extensions = self.guess_all_extensions(type, strict)
|
||||||
|
@ -314,7 +314,7 @@ def guess_type(url, strict=True):
|
||||||
to ".tar.gz". (This is table-driven too, using the dictionary
|
to ".tar.gz". (This is table-driven too, using the dictionary
|
||||||
suffix_map).
|
suffix_map).
|
||||||
|
|
||||||
Optional `strict' argument when false adds a bunch of commonly found, but
|
Optional 'strict' argument when false adds a bunch of commonly found, but
|
||||||
non-standard types.
|
non-standard types.
|
||||||
"""
|
"""
|
||||||
if _db is None:
|
if _db is None:
|
||||||
|
@ -338,11 +338,11 @@ def guess_all_extensions(type, strict=True):
|
||||||
Return value is a list of strings giving the possible filename
|
Return value is a list of strings giving the possible filename
|
||||||
extensions, including the leading dot ('.'). The extension is not
|
extensions, including the leading dot ('.'). The extension is not
|
||||||
guaranteed to have been associated with any particular data
|
guaranteed to have been associated with any particular data
|
||||||
stream, but would be mapped to the MIME type `type' by
|
stream, but would be mapped to the MIME type 'type' by
|
||||||
guess_type(). If no extension can be guessed for `type', None
|
guess_type(). If no extension can be guessed for 'type', None
|
||||||
is returned.
|
is returned.
|
||||||
|
|
||||||
Optional `strict' argument when false adds a bunch of commonly found,
|
Optional 'strict' argument when false adds a bunch of commonly found,
|
||||||
but non-standard types.
|
but non-standard types.
|
||||||
"""
|
"""
|
||||||
if _db is None:
|
if _db is None:
|
||||||
|
@ -355,10 +355,10 @@ def guess_extension(type, strict=True):
|
||||||
Return value is a string giving a filename extension, including the
|
Return value is a string giving a filename extension, including the
|
||||||
leading dot ('.'). The extension is not guaranteed to have been
|
leading dot ('.'). The extension is not guaranteed to have been
|
||||||
associated with any particular data stream, but would be mapped to the
|
associated with any particular data stream, but would be mapped to the
|
||||||
MIME type `type' by guess_type(). If no extension can be guessed for
|
MIME type 'type' by guess_type(). If no extension can be guessed for
|
||||||
`type', None is returned.
|
'type', None is returned.
|
||||||
|
|
||||||
Optional `strict' argument when false adds a bunch of commonly found,
|
Optional 'strict' argument when false adds a bunch of commonly found,
|
||||||
but non-standard types.
|
but non-standard types.
|
||||||
"""
|
"""
|
||||||
if _db is None:
|
if _db is None:
|
||||||
|
|
|
@ -105,7 +105,7 @@ class SMTPSenderRefused(SMTPResponseException):
|
||||||
"""Sender address refused.
|
"""Sender address refused.
|
||||||
|
|
||||||
In addition to the attributes set by on all SMTPResponseException
|
In addition to the attributes set by on all SMTPResponseException
|
||||||
exceptions, this sets `sender' to the string that the SMTP refused.
|
exceptions, this sets 'sender' to the string that the SMTP refused.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, code, msg, sender):
|
def __init__(self, code, msg, sender):
|
||||||
|
@ -315,7 +315,7 @@ class SMTP:
|
||||||
def connect(self, host='localhost', port=0, source_address=None):
|
def connect(self, host='localhost', port=0, source_address=None):
|
||||||
"""Connect to a host on a given port.
|
"""Connect to a host on a given port.
|
||||||
|
|
||||||
If the hostname ends with a colon (`:') followed by a number, and
|
If the hostname ends with a colon (':') followed by a number, and
|
||||||
there is no port specified, that suffix will be stripped off and the
|
there is no port specified, that suffix will be stripped off and the
|
||||||
number interpreted as the port number to use.
|
number interpreted as the port number to use.
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ class SMTP:
|
||||||
return (code, msg)
|
return (code, msg)
|
||||||
|
|
||||||
def send(self, s):
|
def send(self, s):
|
||||||
"""Send `s' to the server."""
|
"""Send 's' to the server."""
|
||||||
if self.debuglevel > 0:
|
if self.debuglevel > 0:
|
||||||
self._print_debug('send:', repr(s))
|
self._print_debug('send:', repr(s))
|
||||||
if self.sock:
|
if self.sock:
|
||||||
|
|
|
@ -1217,7 +1217,7 @@ class TarInfo(object):
|
||||||
for keyword, value in pax_headers.items():
|
for keyword, value in pax_headers.items():
|
||||||
keyword = keyword.encode("utf-8")
|
keyword = keyword.encode("utf-8")
|
||||||
if binary:
|
if binary:
|
||||||
# Try to restore the original byte representation of `value'.
|
# Try to restore the original byte representation of 'value'.
|
||||||
# Needless to say, that the encoding must match the string.
|
# Needless to say, that the encoding must match the string.
|
||||||
value = value.encode(encoding, "surrogateescape")
|
value = value.encode(encoding, "surrogateescape")
|
||||||
else:
|
else:
|
||||||
|
@ -1663,13 +1663,13 @@ class TarFile(object):
|
||||||
tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
|
tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
|
||||||
errors="surrogateescape", pax_headers=None, debug=None,
|
errors="surrogateescape", pax_headers=None, debug=None,
|
||||||
errorlevel=None, copybufsize=None, stream=False):
|
errorlevel=None, copybufsize=None, stream=False):
|
||||||
"""Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
|
"""Open an (uncompressed) tar archive 'name'. 'mode' is either 'r' to
|
||||||
read from an existing archive, 'a' to append data to an existing
|
read from an existing archive, 'a' to append data to an existing
|
||||||
file or 'w' to create a new file overwriting an existing one. `mode'
|
file or 'w' to create a new file overwriting an existing one. 'mode'
|
||||||
defaults to 'r'.
|
defaults to 'r'.
|
||||||
If `fileobj' is given, it is used for reading or writing data. If it
|
If 'fileobj' is given, it is used for reading or writing data. If it
|
||||||
can be determined, `mode' is overridden by `fileobj's mode.
|
can be determined, 'mode' is overridden by 'fileobj's mode.
|
||||||
`fileobj' is not closed, when TarFile is closed.
|
'fileobj' is not closed, when TarFile is closed.
|
||||||
"""
|
"""
|
||||||
modes = {"r": "rb", "a": "r+b", "w": "wb", "x": "xb"}
|
modes = {"r": "rb", "a": "r+b", "w": "wb", "x": "xb"}
|
||||||
if mode not in modes:
|
if mode not in modes:
|
||||||
|
@ -1998,7 +1998,7 @@ class TarFile(object):
|
||||||
self.fileobj.close()
|
self.fileobj.close()
|
||||||
|
|
||||||
def getmember(self, name):
|
def getmember(self, name):
|
||||||
"""Return a TarInfo object for member `name'. If `name' can not be
|
"""Return a TarInfo object for member 'name'. If 'name' can not be
|
||||||
found in the archive, KeyError is raised. If a member occurs more
|
found in the archive, KeyError is raised. If a member occurs more
|
||||||
than once in the archive, its last occurrence is assumed to be the
|
than once in the archive, its last occurrence is assumed to be the
|
||||||
most up-to-date version.
|
most up-to-date version.
|
||||||
|
@ -2026,9 +2026,9 @@ class TarFile(object):
|
||||||
|
|
||||||
def gettarinfo(self, name=None, arcname=None, fileobj=None):
|
def gettarinfo(self, name=None, arcname=None, fileobj=None):
|
||||||
"""Create a TarInfo object from the result of os.stat or equivalent
|
"""Create a TarInfo object from the result of os.stat or equivalent
|
||||||
on an existing file. The file is either named by `name', or
|
on an existing file. The file is either named by 'name', or
|
||||||
specified as a file object `fileobj' with a file descriptor. If
|
specified as a file object 'fileobj' with a file descriptor. If
|
||||||
given, `arcname' specifies an alternative name for the file in the
|
given, 'arcname' specifies an alternative name for the file in the
|
||||||
archive, otherwise, the name is taken from the 'name' attribute of
|
archive, otherwise, the name is taken from the 'name' attribute of
|
||||||
'fileobj', or the 'name' argument. The name should be a text
|
'fileobj', or the 'name' argument. The name should be a text
|
||||||
string.
|
string.
|
||||||
|
@ -2124,9 +2124,9 @@ class TarFile(object):
|
||||||
return tarinfo
|
return tarinfo
|
||||||
|
|
||||||
def list(self, verbose=True, *, members=None):
|
def list(self, verbose=True, *, members=None):
|
||||||
"""Print a table of contents to sys.stdout. If `verbose' is False, only
|
"""Print a table of contents to sys.stdout. If 'verbose' is False, only
|
||||||
the names of the members are printed. If it is True, an `ls -l'-like
|
the names of the members are printed. If it is True, an 'ls -l'-like
|
||||||
output is produced. `members' is optional and must be a subset of the
|
output is produced. 'members' is optional and must be a subset of the
|
||||||
list returned by getmembers().
|
list returned by getmembers().
|
||||||
"""
|
"""
|
||||||
# Convert tarinfo type to stat type.
|
# Convert tarinfo type to stat type.
|
||||||
|
@ -2167,11 +2167,11 @@ class TarFile(object):
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def add(self, name, arcname=None, recursive=True, *, filter=None):
|
def add(self, name, arcname=None, recursive=True, *, filter=None):
|
||||||
"""Add the file `name' to the archive. `name' may be any type of file
|
"""Add the file 'name' to the archive. 'name' may be any type of file
|
||||||
(directory, fifo, symbolic link, etc.). If given, `arcname'
|
(directory, fifo, symbolic link, etc.). If given, 'arcname'
|
||||||
specifies an alternative name for the file in the archive.
|
specifies an alternative name for the file in the archive.
|
||||||
Directories are added recursively by default. This can be avoided by
|
Directories are added recursively by default. This can be avoided by
|
||||||
setting `recursive' to False. `filter' is a function
|
setting 'recursive' to False. 'filter' is a function
|
||||||
that expects a TarInfo object argument and returns the changed
|
that expects a TarInfo object argument and returns the changed
|
||||||
TarInfo object, if it returns None the TarInfo object will be
|
TarInfo object, if it returns None the TarInfo object will be
|
||||||
excluded from the archive.
|
excluded from the archive.
|
||||||
|
@ -2218,8 +2218,8 @@ class TarFile(object):
|
||||||
self.addfile(tarinfo)
|
self.addfile(tarinfo)
|
||||||
|
|
||||||
def addfile(self, tarinfo, fileobj=None):
|
def addfile(self, tarinfo, fileobj=None):
|
||||||
"""Add the TarInfo object `tarinfo' to the archive. If `tarinfo' represents
|
"""Add the TarInfo object 'tarinfo' to the archive. If 'tarinfo' represents
|
||||||
a non zero-size regular file, the `fileobj' argument should be a binary file,
|
a non zero-size regular file, the 'fileobj' argument should be a binary file,
|
||||||
and tarinfo.size bytes are read from it and added to the archive.
|
and tarinfo.size bytes are read from it and added to the archive.
|
||||||
You can create TarInfo objects directly, or by using gettarinfo().
|
You can create TarInfo objects directly, or by using gettarinfo().
|
||||||
"""
|
"""
|
||||||
|
@ -2273,12 +2273,12 @@ class TarFile(object):
|
||||||
filter=None):
|
filter=None):
|
||||||
"""Extract all members from the archive to the current working
|
"""Extract all members from the archive to the current working
|
||||||
directory and set owner, modification time and permissions on
|
directory and set owner, modification time and permissions on
|
||||||
directories afterwards. `path' specifies a different directory
|
directories afterwards. 'path' specifies a different directory
|
||||||
to extract to. `members' is optional and must be a subset of the
|
to extract to. 'members' is optional and must be a subset of the
|
||||||
list returned by getmembers(). If `numeric_owner` is True, only
|
list returned by getmembers(). If 'numeric_owner' is True, only
|
||||||
the numbers for user/group names are used and not the names.
|
the numbers for user/group names are used and not the names.
|
||||||
|
|
||||||
The `filter` function will be called on each member just
|
The 'filter' function will be called on each member just
|
||||||
before extraction.
|
before extraction.
|
||||||
It can return a changed TarInfo or None to skip the member.
|
It can return a changed TarInfo or None to skip the member.
|
||||||
String names of common filters are accepted.
|
String names of common filters are accepted.
|
||||||
|
@ -2318,13 +2318,13 @@ class TarFile(object):
|
||||||
filter=None):
|
filter=None):
|
||||||
"""Extract a member from the archive to the current working directory,
|
"""Extract a member from the archive to the current working directory,
|
||||||
using its full name. Its file information is extracted as accurately
|
using its full name. Its file information is extracted as accurately
|
||||||
as possible. `member' may be a filename or a TarInfo object. You can
|
as possible. 'member' may be a filename or a TarInfo object. You can
|
||||||
specify a different directory using `path'. File attributes (owner,
|
specify a different directory using 'path'. File attributes (owner,
|
||||||
mtime, mode) are set unless `set_attrs' is False. If `numeric_owner`
|
mtime, mode) are set unless 'set_attrs' is False. If 'numeric_owner'
|
||||||
is True, only the numbers for user/group names are used and not
|
is True, only the numbers for user/group names are used and not
|
||||||
the names.
|
the names.
|
||||||
|
|
||||||
The `filter` function will be called before extraction.
|
The 'filter' function will be called before extraction.
|
||||||
It can return a changed TarInfo or None to skip the member.
|
It can return a changed TarInfo or None to skip the member.
|
||||||
String names of common filters are accepted.
|
String names of common filters are accepted.
|
||||||
"""
|
"""
|
||||||
|
@ -2389,10 +2389,10 @@ class TarFile(object):
|
||||||
self._dbg(1, "tarfile: %s %s" % (type(e).__name__, e))
|
self._dbg(1, "tarfile: %s %s" % (type(e).__name__, e))
|
||||||
|
|
||||||
def extractfile(self, member):
|
def extractfile(self, member):
|
||||||
"""Extract a member from the archive as a file object. `member' may be
|
"""Extract a member from the archive as a file object. 'member' may be
|
||||||
a filename or a TarInfo object. If `member' is a regular file or
|
a filename or a TarInfo object. If 'member' is a regular file or
|
||||||
a link, an io.BufferedReader object is returned. For all other
|
a link, an io.BufferedReader object is returned. For all other
|
||||||
existing members, None is returned. If `member' does not appear
|
existing members, None is returned. If 'member' does not appear
|
||||||
in the archive, KeyError is raised.
|
in the archive, KeyError is raised.
|
||||||
"""
|
"""
|
||||||
self._check("r")
|
self._check("r")
|
||||||
|
@ -2590,7 +2590,7 @@ class TarFile(object):
|
||||||
else:
|
else:
|
||||||
os.chown(targetpath, u, g)
|
os.chown(targetpath, u, g)
|
||||||
except (OSError, OverflowError) as e:
|
except (OSError, OverflowError) as e:
|
||||||
# OverflowError can be raised if an ID doesn't fit in `id_t`
|
# OverflowError can be raised if an ID doesn't fit in 'id_t'
|
||||||
raise ExtractError("could not change owner") from e
|
raise ExtractError("could not change owner") from e
|
||||||
|
|
||||||
def chmod(self, tarinfo, targetpath):
|
def chmod(self, tarinfo, targetpath):
|
||||||
|
|
|
@ -7,7 +7,7 @@ Options:
|
||||||
|
|
||||||
--nosetuid
|
--nosetuid
|
||||||
-n
|
-n
|
||||||
This program generally tries to setuid `nobody', unless this flag is
|
This program generally tries to setuid 'nobody', unless this flag is
|
||||||
set. The setuid call will fail if this program is not run as root (in
|
set. The setuid call will fail if this program is not run as root (in
|
||||||
which case, use this flag).
|
which case, use this flag).
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ Options:
|
||||||
|
|
||||||
--class classname
|
--class classname
|
||||||
-c classname
|
-c classname
|
||||||
Use `classname' as the concrete SMTP proxy class. Uses `PureProxy' by
|
Use 'classname' as the concrete SMTP proxy class. Uses 'PureProxy' by
|
||||||
default.
|
default.
|
||||||
|
|
||||||
--size limit
|
--size limit
|
||||||
|
@ -39,8 +39,8 @@ Options:
|
||||||
|
|
||||||
Version: %(__version__)s
|
Version: %(__version__)s
|
||||||
|
|
||||||
If localhost is not given then `localhost' is used, and if localport is not
|
If localhost is not given then 'localhost' is used, and if localport is not
|
||||||
given then 8025 is used. If remotehost is not given then `localhost' is used,
|
given then 8025 is used. If remotehost is not given then 'localhost' is used,
|
||||||
and if remoteport is not given, then 25 is used.
|
and if remoteport is not given, then 25 is used.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -672,9 +672,9 @@ class SMTPServer(asyncore.dispatcher):
|
||||||
message to.
|
message to.
|
||||||
|
|
||||||
data is a string containing the entire full text of the message,
|
data is a string containing the entire full text of the message,
|
||||||
headers (if supplied) and all. It has been `de-transparencied'
|
headers (if supplied) and all. It has been 'de-transparencied'
|
||||||
according to RFC 821, Section 4.5.2. In other words, a line
|
according to RFC 821, Section 4.5.2. In other words, a line
|
||||||
containing a `.' followed by other text has had the leading dot
|
containing a '.' followed by other text has had the leading dot
|
||||||
removed.
|
removed.
|
||||||
|
|
||||||
kwargs is a dictionary containing additional information. It is
|
kwargs is a dictionary containing additional information. It is
|
||||||
|
@ -685,7 +685,7 @@ class SMTPServer(asyncore.dispatcher):
|
||||||
['BODY=8BITMIME', 'SMTPUTF8'].
|
['BODY=8BITMIME', 'SMTPUTF8'].
|
||||||
'rcpt_options': same, for the rcpt command.
|
'rcpt_options': same, for the rcpt command.
|
||||||
|
|
||||||
This function should return None for a normal `250 Ok' response;
|
This function should return None for a normal '250 Ok' response;
|
||||||
otherwise, it should return the desired response string in RFC 821
|
otherwise, it should return the desired response string in RFC 821
|
||||||
format.
|
format.
|
||||||
|
|
||||||
|
|
|
@ -1481,7 +1481,7 @@ class BarrierTests(unittest.IsolatedAsyncioTestCase):
|
||||||
# wait again only for rewait tasks
|
# wait again only for rewait tasks
|
||||||
await barrier.wait()
|
await barrier.wait()
|
||||||
else:
|
else:
|
||||||
# wait for end of draining state`
|
# wait for end of draining state
|
||||||
await barrier_nowaiting.wait()
|
await barrier_nowaiting.wait()
|
||||||
# wait for other waiting tasks
|
# wait for other waiting tasks
|
||||||
await barrier.wait()
|
await barrier.wait()
|
||||||
|
@ -1780,7 +1780,7 @@ class BarrierTests(unittest.IsolatedAsyncioTestCase):
|
||||||
self.assertEqual(barrier.n_waiting, 0)
|
self.assertEqual(barrier.n_waiting, 0)
|
||||||
|
|
||||||
async def test_abort_barrier_when_exception_then_resetting(self):
|
async def test_abort_barrier_when_exception_then_resetting(self):
|
||||||
# test from threading.Barrier: see `lock_tests.test_abort_and_reset``
|
# test from threading.Barrier: see `lock_tests.test_abort_and_reset`
|
||||||
barrier1 = asyncio.Barrier(self.N)
|
barrier1 = asyncio.Barrier(self.N)
|
||||||
barrier2 = asyncio.Barrier(self.N)
|
barrier2 = asyncio.Barrier(self.N)
|
||||||
results1 = []
|
results1 = []
|
||||||
|
|
|
@ -402,7 +402,7 @@ class Trace:
|
||||||
@param countfuncs true iff it should just output a list of
|
@param countfuncs true iff it should just output a list of
|
||||||
(filename, modulename, funcname,) for functions
|
(filename, modulename, funcname,) for functions
|
||||||
that were called at least once; This overrides
|
that were called at least once; This overrides
|
||||||
`count' and `trace'
|
'count' and 'trace'
|
||||||
@param ignoremods a list of the names of modules to ignore
|
@param ignoremods a list of the names of modules to ignore
|
||||||
@param ignoredirs a list of the names of directories to ignore
|
@param ignoredirs a list of the names of directories to ignore
|
||||||
all of the (recursive) contents of
|
all of the (recursive) contents of
|
||||||
|
@ -534,7 +534,7 @@ class Trace:
|
||||||
def globaltrace_lt(self, frame, why, arg):
|
def globaltrace_lt(self, frame, why, arg):
|
||||||
"""Handler for call events.
|
"""Handler for call events.
|
||||||
|
|
||||||
If the code block being entered is to be ignored, returns `None',
|
If the code block being entered is to be ignored, returns 'None',
|
||||||
else returns self.localtrace.
|
else returns self.localtrace.
|
||||||
"""
|
"""
|
||||||
if why == 'call':
|
if why == 'call':
|
||||||
|
|
|
@ -1748,7 +1748,7 @@ def patch(
|
||||||
the patch is undone.
|
the patch is undone.
|
||||||
|
|
||||||
If `new` is omitted, then the target is replaced with an
|
If `new` is omitted, then the target is replaced with an
|
||||||
`AsyncMock if the patched object is an async function or a
|
`AsyncMock` if the patched object is an async function or a
|
||||||
`MagicMock` otherwise. If `patch` is used as a decorator and `new` is
|
`MagicMock` otherwise. If `patch` is used as a decorator and `new` is
|
||||||
omitted, the created mock is passed in as an extra argument to the
|
omitted, the created mock is passed in as an extra argument to the
|
||||||
decorated function. If `patch` is used as a context manager the created
|
decorated function. If `patch` is used as a context manager the created
|
||||||
|
|
|
@ -5,7 +5,7 @@ so portions are Copyright (C) 2001,2002 Python Software Foundation, and were
|
||||||
written by Barry Warsaw.
|
written by Barry Warsaw.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Regular expression that matches `special' characters in parameters, the
|
# Regular expression that matches 'special' characters in parameters, the
|
||||||
# existence of which force quoting of the parameter value.
|
# existence of which force quoting of the parameter value.
|
||||||
import re
|
import re
|
||||||
tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
|
tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
|
||||||
|
|
|
@ -1745,8 +1745,8 @@ class ZipFile:
|
||||||
def extract(self, member, path=None, pwd=None):
|
def extract(self, member, path=None, pwd=None):
|
||||||
"""Extract a member from the archive to the current working directory,
|
"""Extract a member from the archive to the current working directory,
|
||||||
using its full name. Its file information is extracted as accurately
|
using its full name. Its file information is extracted as accurately
|
||||||
as possible. `member' may be a filename or a ZipInfo object. You can
|
as possible. 'member' may be a filename or a ZipInfo object. You can
|
||||||
specify a different directory using `path'. You can specify the
|
specify a different directory using 'path'. You can specify the
|
||||||
password to decrypt the file using 'pwd'.
|
password to decrypt the file using 'pwd'.
|
||||||
"""
|
"""
|
||||||
if path is None:
|
if path is None:
|
||||||
|
@ -1758,8 +1758,8 @@ class ZipFile:
|
||||||
|
|
||||||
def extractall(self, path=None, members=None, pwd=None):
|
def extractall(self, path=None, members=None, pwd=None):
|
||||||
"""Extract all members from the archive to the current working
|
"""Extract all members from the archive to the current working
|
||||||
directory. `path' specifies a different directory to extract to.
|
directory. 'path' specifies a different directory to extract to.
|
||||||
`members' is optional and must be a subset of the list returned
|
'members' is optional and must be a subset of the list returned
|
||||||
by namelist(). You can specify the password to decrypt all files
|
by namelist(). You can specify the password to decrypt all files
|
||||||
using 'pwd'.
|
using 'pwd'.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -585,7 +585,7 @@ non-existing elements are considered to be infinite. The interesting\n\
|
||||||
property of a heap is that a[0] is always its smallest element.\n"
|
property of a heap is that a[0] is always its smallest element.\n"
|
||||||
"\n\
|
"\n\
|
||||||
The strange invariant above is meant to be an efficient memory\n\
|
The strange invariant above is meant to be an efficient memory\n\
|
||||||
representation for a tournament. The numbers below are `k', not a[k]:\n\
|
representation for a tournament. The numbers below are 'k', not a[k]:\n\
|
||||||
\n\
|
\n\
|
||||||
0\n\
|
0\n\
|
||||||
\n\
|
\n\
|
||||||
|
@ -598,7 +598,7 @@ representation for a tournament. The numbers below are `k', not a[k]:\n\
|
||||||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30\n\
|
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30\n\
|
||||||
\n\
|
\n\
|
||||||
\n\
|
\n\
|
||||||
In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In\n\
|
In the tree above, each cell 'k' is topping '2*k+1' and '2*k+2'. In\n\
|
||||||
a usual binary tournament we see in sports, each cell is the winner\n\
|
a usual binary tournament we see in sports, each cell is the winner\n\
|
||||||
over the two cells it tops, and we can trace the winner down the tree\n\
|
over the two cells it tops, and we can trace the winner down the tree\n\
|
||||||
to see all opponents s/he had. However, in many computer applications\n\
|
to see all opponents s/he had. However, in many computer applications\n\
|
||||||
|
@ -653,7 +653,7 @@ vanishes, you switch heaps and start a new run. Clever and quite\n\
|
||||||
effective!\n\
|
effective!\n\
|
||||||
\n\
|
\n\
|
||||||
In a word, heaps are useful memory structures to know. I use them in\n\
|
In a word, heaps are useful memory structures to know. I use them in\n\
|
||||||
a few applications, and I think it is good to keep a `heap' module\n\
|
a few applications, and I think it is good to keep a 'heap' module\n\
|
||||||
around. :-)\n"
|
around. :-)\n"
|
||||||
"\n\
|
"\n\
|
||||||
--------------------\n\
|
--------------------\n\
|
||||||
|
|
|
@ -656,7 +656,7 @@ Create a new interpreter and return a unique generated ID.\n\
|
||||||
The caller is responsible for destroying the interpreter before exiting,\n\
|
The caller is responsible for destroying the interpreter before exiting,\n\
|
||||||
typically by using _interpreters.destroy(). This can be managed \n\
|
typically by using _interpreters.destroy(). This can be managed \n\
|
||||||
automatically by passing \"reqrefs=True\" and then using _incref() and\n\
|
automatically by passing \"reqrefs=True\" and then using _incref() and\n\
|
||||||
_decref()` appropriately.\n\
|
_decref() appropriately.\n\
|
||||||
\n\
|
\n\
|
||||||
\"config\" must be a valid interpreter config or the name of a\n\
|
\"config\" must be a valid interpreter config or the name of a\n\
|
||||||
predefined config (\"isolated\" or \"legacy\"). The default\n\
|
predefined config (\"isolated\" or \"legacy\"). The default\n\
|
||||||
|
|
|
@ -12,7 +12,7 @@ PyDoc_STRVAR(_multibytecodec_MultibyteCodec_encode__doc__,
|
||||||
"encode($self, /, input, errors=None)\n"
|
"encode($self, /, input, errors=None)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Return an encoded string version of `input\'.\n"
|
"Return an encoded string version of \'input\'.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\'errors\' may be given to set a different error handling scheme. Default is\n"
|
"\'errors\' may be given to set a different error handling scheme. Default is\n"
|
||||||
"\'strict\' meaning that encoding errors raise a UnicodeEncodeError. Other possible\n"
|
"\'strict\' meaning that encoding errors raise a UnicodeEncodeError. Other possible\n"
|
||||||
|
@ -682,4 +682,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
|
||||||
|
|
||||||
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
|
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
|
||||||
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
|
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
|
||||||
/*[clinic end generated code: output=ee767a6d93c7108a input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=f09052c5a28cc6e6 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -574,7 +574,7 @@ _multibytecodec.MultibyteCodec.encode
|
||||||
input: object
|
input: object
|
||||||
errors: str(accept={str, NoneType}) = None
|
errors: str(accept={str, NoneType}) = None
|
||||||
|
|
||||||
Return an encoded string version of `input'.
|
Return an encoded string version of 'input'.
|
||||||
|
|
||||||
'errors' may be given to set a different error handling scheme. Default is
|
'errors' may be given to set a different error handling scheme. Default is
|
||||||
'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible
|
'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible
|
||||||
|
@ -586,7 +586,7 @@ static PyObject *
|
||||||
_multibytecodec_MultibyteCodec_encode_impl(MultibyteCodecObject *self,
|
_multibytecodec_MultibyteCodec_encode_impl(MultibyteCodecObject *self,
|
||||||
PyObject *input,
|
PyObject *input,
|
||||||
const char *errors)
|
const char *errors)
|
||||||
/*[clinic end generated code: output=7b26652045ba56a9 input=606d0e128a577bae]*/
|
/*[clinic end generated code: output=7b26652045ba56a9 input=2841745b95ed338f]*/
|
||||||
{
|
{
|
||||||
MultibyteCodec_State state;
|
MultibyteCodec_State state;
|
||||||
PyObject *errorcb, *r, *ucvt;
|
PyObject *errorcb, *r, *ucvt;
|
||||||
|
|
|
@ -61,7 +61,7 @@ PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
"Parse XML data.\n"
|
"Parse XML data.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"`isfinal\' should be true at end of input.");
|
"\'isfinal\' should be true at end of input.");
|
||||||
|
|
||||||
#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
|
#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
|
||||||
{"Parse", _PyCFunction_CAST(pyexpat_xmlparser_Parse), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_Parse__doc__},
|
{"Parse", _PyCFunction_CAST(pyexpat_xmlparser_Parse), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_Parse__doc__},
|
||||||
|
@ -545,4 +545,4 @@ exit:
|
||||||
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
||||||
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
|
||||||
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
|
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
|
||||||
/*[clinic end generated code: output=892e48e41f9b6e4b input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=51874bfaf4992ba2 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -754,13 +754,13 @@ pyexpat.xmlparser.Parse
|
||||||
|
|
||||||
Parse XML data.
|
Parse XML data.
|
||||||
|
|
||||||
`isfinal' should be true at end of input.
|
'isfinal' should be true at end of input.
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
|
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
|
||||||
PyObject *data, int isfinal)
|
PyObject *data, int isfinal)
|
||||||
/*[clinic end generated code: output=8faffe07fe1f862a input=d0eb2a69fab3b9f1]*/
|
/*[clinic end generated code: output=8faffe07fe1f862a input=053e0f047e55c05a]*/
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
Py_ssize_t slen;
|
Py_ssize_t slen;
|
||||||
|
|
|
@ -52,25 +52,25 @@ static inline PyObject* bytes_get_empty(void)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
For PyBytes_FromString(), the parameter `str' points to a null-terminated
|
For PyBytes_FromString(), the parameter 'str' points to a null-terminated
|
||||||
string containing exactly `size' bytes.
|
string containing exactly 'size' bytes.
|
||||||
|
|
||||||
For PyBytes_FromStringAndSize(), the parameter `str' is
|
For PyBytes_FromStringAndSize(), the parameter 'str' is
|
||||||
either NULL or else points to a string containing at least `size' bytes.
|
either NULL or else points to a string containing at least 'size' bytes.
|
||||||
For PyBytes_FromStringAndSize(), the string in the `str' parameter does
|
For PyBytes_FromStringAndSize(), the string in the 'str' parameter does
|
||||||
not have to be null-terminated. (Therefore it is safe to construct a
|
not have to be null-terminated. (Therefore it is safe to construct a
|
||||||
substring by calling `PyBytes_FromStringAndSize(origstring, substrlen)'.)
|
substring by calling 'PyBytes_FromStringAndSize(origstring, substrlen)'.)
|
||||||
If `str' is NULL then PyBytes_FromStringAndSize() will allocate `size+1'
|
If 'str' is NULL then PyBytes_FromStringAndSize() will allocate 'size+1'
|
||||||
bytes (setting the last byte to the null terminating character) and you can
|
bytes (setting the last byte to the null terminating character) and you can
|
||||||
fill in the data yourself. If `str' is non-NULL then the resulting
|
fill in the data yourself. If 'str' is non-NULL then the resulting
|
||||||
PyBytes object must be treated as immutable and you must not fill in nor
|
PyBytes object must be treated as immutable and you must not fill in nor
|
||||||
alter the data yourself, since the strings may be shared.
|
alter the data yourself, since the strings may be shared.
|
||||||
|
|
||||||
The PyObject member `op->ob_size', which denotes the number of "extra
|
The PyObject member 'op->ob_size', which denotes the number of "extra
|
||||||
items" in a variable-size object, will contain the number of bytes
|
items" in a variable-size object, will contain the number of bytes
|
||||||
allocated for string data, not counting the null terminating character.
|
allocated for string data, not counting the null terminating character.
|
||||||
It is therefore equal to the `size' parameter (for
|
It is therefore equal to the 'size' parameter (for
|
||||||
PyBytes_FromStringAndSize()) or the length of the string in the `str'
|
PyBytes_FromStringAndSize()) or the length of the string in the 'str'
|
||||||
parameter (for PyBytes_FromString()).
|
parameter (for PyBytes_FromString()).
|
||||||
*/
|
*/
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
|
@ -200,7 +200,7 @@ Here are some ways to address this challenge:
|
||||||
Adding the checks to the concrete API would help make any interpreter
|
Adding the checks to the concrete API would help make any interpreter
|
||||||
switch to OrderedDict less painful for extension modules. However, this
|
switch to OrderedDict less painful for extension modules. However, this
|
||||||
won't work. The equivalent C API call to `dict.__setitem__(obj, k, v)`
|
won't work. The equivalent C API call to `dict.__setitem__(obj, k, v)`
|
||||||
is 'PyDict_SetItem(obj, k, v)`. This illustrates how subclasses in C call
|
is `PyDict_SetItem(obj, k, v)`. This illustrates how subclasses in C call
|
||||||
the base class's methods, since there is no equivalent of super() in the
|
the base class's methods, since there is no equivalent of super() in the
|
||||||
C API. Calling into Python for parent class API would work, but some
|
C API. Calling into Python for parent class API would work, but some
|
||||||
extension modules already rely on this feature of the concrete API.
|
extension modules already rely on this feature of the concrete API.
|
||||||
|
|
Loading…
Reference in New Issue