diff --git a/Lib/cmd.py b/Lib/cmd.py index 859e910..9790b17 100644 --- a/Lib/cmd.py +++ b/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'. 2. A command is parsed out of each line by collecting the prefix composed 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. 4. Typing an empty line repeats the last command. (Actually, it calls the - method `emptyline', which may be overridden in a subclass.) -5. There is a predefined `help' method. Given an argument `topic', it - calls the command `help_topic'. With no arguments, it lists all topics + method ``emptyline``, which may be overridden in a subclass.) +5. There is a predefined ``help`` method. Given an argument ``topic``, it + calls the command ``help_topic``. With no arguments, it lists all topics with defined help_ functions, broken into up to three topics; documented commands, miscellaneous help topics, and undocumented commands. -6. The command '?' is a synonym for `help'. The command '!' is a synonym - for `shell', if a do_shell method exists. +6. The command '?' is a synonym for ``help``. The command '!' is a synonym + for ``shell``, if a do_shell method exists. 7. If completion is enabled, completing commands will be done automatically, and completing of commands args is done by calling complete_foo() with arguments text, line, begidx, endidx. text is string we are matching @@ -23,10 +23,10 @@ Interpreters constructed with this class obey the following conventions: indexes of the text being matched, which could be used to provide 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. -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. The data member `self.ruler' sets the character used to draw separator lines diff --git a/Lib/configparser.py b/Lib/configparser.py index 3a9fb56..2489f57 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -19,36 +19,36 @@ ConfigParser -- responsible for parsing a list of inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section='DEFAULT', interpolation=, converters=): - Create the parser. When `defaults' is given, it is initialized into the + Create the parser. When ``defaults`` is given, it is initialized into the dictionary or intrinsic defaults. The keys must be strings, the values must be appropriate for %()s string interpolation. - When `dict_type' is given, it will be used to create the dictionary + When ``dict_type`` is given, it will be used to create the dictionary objects for the list of sections, for the options within a section, and for the default values. - When `delimiters' is given, it will be used as the set of substrings + When ``delimiters`` is given, it will be used as the set of substrings that divide keys from values. - When `comment_prefixes' is given, it will be used as the set of + When ``comment_prefixes`` is given, it will be used as the set of substrings that prefix comments in empty lines. Comments can be indented. - When `inline_comment_prefixes' is given, it will be used as the set of + When ``inline_comment_prefixes`` is given, it will be used as the set of substrings that prefix comments in non-empty lines. When `strict` is True, the parser won't allow for any section or option duplicates while reading from a single source (file, string or dictionary). Default is True. - When `empty_lines_in_values' is False (default: True), each empty line + When ``empty_lines_in_values`` is False (default: True), each empty line marks the end of an option. Otherwise, internal empty lines of a multiline option are kept as part of the value. - When `allow_no_value' is True (default: False), options without + When ``allow_no_value`` is True (default: False), options without values are accepted; the value presented for these is None. - When `default_section' is given, the name of the special section is + When ``default_section`` is given, the name of the special section is named accordingly. By default it is called ``"DEFAULT"`` but this can be customized to point to any other valid section name. Its current value can be retrieved using the ``parser_instance.default_section`` @@ -87,7 +87,7 @@ ConfigParser -- responsible for parsing a list of read_file(f, filename=None) Read and parse one configuration file, given as a file object. The filename defaults to f.name; it is only used in error - messages (if f has no `name' attribute, the string `' is used). + messages (if f has no ``name`` attribute, the string `' is used). read_string(string) Read configuration from a given string. @@ -103,9 +103,9 @@ ConfigParser -- responsible for parsing a list of Return a string value for the named option. All % interpolations are expanded in the return values, based on the defaults passed into the constructor and the DEFAULT section. Additional substitutions may be - provided using the `vars' argument, which must be a dictionary whose - contents override any pre-existing defaults. If `option' is a key in - `vars', the value from `vars' is used. + provided using the ``vars`` argument, which must be a dictionary whose + contents override any pre-existing defaults. If ``option`` is a key in + ``vars``, the value from ``vars`` is used. getint(section, options, raw=False, vars=None, fallback=_UNSET) Like get(), but convert value to an integer. @@ -134,7 +134,7 @@ ConfigParser -- responsible for parsing a list of write(fp, space_around_delimiters=True) Write the configuration state in .ini format. If - `space_around_delimiters' is True (the default), delimiters + ``space_around_delimiters`` is True (the default), delimiters between keys and values are surrounded by spaces. """ @@ -296,13 +296,13 @@ class ParsingError(Error): """Raised when a configuration file does not follow legal syntax.""" def __init__(self, source=None, filename=None): - # Exactly one of `source'/`filename' arguments has to be given. - # `filename' kept for compatibility. + # Exactly one of ``source``/``filename`` arguments has to be given. + # ``filename`` kept for compatibility. if filename and source: - raise ValueError("Cannot specify both `filename' and `source'. " - "Use `source'.") + raise ValueError("Cannot specify both 'filename' and 'source'. " + "Use 'source'.") elif not filename and not source: - raise ValueError("Required argument `source' not given.") + raise ValueError("Required argument 'source' not given.") elif filename: source = filename Error.__init__(self, 'Source contains parsing errors: %r' % source) @@ -312,7 +312,7 @@ class ParsingError(Error): @property def filename(self): - """Deprecated, use `source'.""" + """Deprecated, use ``source``.""" warnings.warn( "The 'filename' attribute will be removed in future versions. " "Use 'source' instead.", @@ -322,7 +322,7 @@ class ParsingError(Error): @filename.setter def filename(self, value): - """Deprecated, user `source'.""" + """Deprecated, user ``source``.""" warnings.warn( "The 'filename' attribute will be removed in future versions. " "Use 'source' instead.", @@ -350,7 +350,7 @@ class MissingSectionHeaderError(ParsingError): # Used in parser getters to indicate the default behaviour when a specific -# option is not found it to raise an exception. Created to enable `None' as +# option is not found it to raise an exception. Created to enable ``None`` as # a valid fallback value. _UNSET = object() @@ -384,7 +384,7 @@ class BasicInterpolation(Interpolation): would resolve the "%(dir)s" to the value of dir. All reference expansions are done late, on demand. If a user needs to use a bare % in a configuration file, she can escape it by writing %%. Other % usage - is considered a user error and raises `InterpolationSyntaxError'.""" + is considered a user error and raises ``InterpolationSyntaxError``.""" _KEYCRE = re.compile(r"%\(([^)]+)\)s") @@ -702,10 +702,10 @@ class RawConfigParser(MutableMapping): def read_file(self, f, source=None): """Like read() but the argument must be a file-like object. - The `f' argument must be iterable, returning one line at a time. - Optional second argument is the `source' specifying the name of the - file being read. If not given, it is taken from f.name. If `f' has no - `name' attribute, `' is used. + The ``f`` argument must be iterable, returning one line at a time. + Optional second argument is the ``source`` specifying the name of the + file being read. If not given, it is taken from f.name. If ``f`` has no + ``name`` attribute, `' is used. """ if source is None: try: @@ -729,7 +729,7 @@ class RawConfigParser(MutableMapping): All types held in the dictionary are converted to strings during reading, including section names, option names and keys. - Optional second argument is the `source' specifying the name of the + Optional second argument is the ``source`` specifying the name of the dictionary being read. """ elements_added = set() @@ -762,15 +762,15 @@ class RawConfigParser(MutableMapping): def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET): """Get an option value for a given section. - If `vars' is provided, it must be a dictionary. The option is looked up - in `vars' (if provided), `section', and in `DEFAULTSECT' in that order. - If the key is not found and `fallback' is provided, it is used as - a fallback value. `None' can be provided as a `fallback' value. + If ``vars`` is provided, it must be a dictionary. The option is looked up + in ``vars`` (if provided), ``section``, and in ``DEFAULTSECT`` in that order. + If the key is not found and ``fallback`` is provided, it is used as + a fallback value. ``None`` can be provided as a ``fallback`` value. - If interpolation is enabled and the optional argument `raw' is False, + If interpolation is enabled and the optional argument ``raw`` is False, all interpolations are expanded in the return values. - Arguments `raw', `vars', and `fallback' are keyword only. + Arguments ``raw``, ``vars``, and ``fallback`` are keyword only. The section DEFAULT is special. """ @@ -830,8 +830,8 @@ class RawConfigParser(MutableMapping): All % interpolations are expanded in the return values, based on the defaults passed into the constructor, unless the optional argument - `raw' is true. Additional substitutions may be provided using the - `vars' argument, which must be a dictionary whose contents overrides + ``raw`` is true. Additional substitutions may be provided using the + ``vars`` argument, which must be a dictionary whose contents overrides any pre-existing defaults. The section DEFAULT is special. @@ -872,8 +872,8 @@ class RawConfigParser(MutableMapping): def has_option(self, section, option): """Check for the existence of a given option in a given section. - If the specified `section' is None or an empty string, DEFAULT is - assumed. If the specified `section' does not exist, returns False.""" + If the specified ``section`` is None or an empty string, DEFAULT is + assumed. If the specified ``section`` does not exist, returns False.""" if not section or section == self.default_section: option = self.optionxform(option) return option in self._defaults @@ -901,7 +901,7 @@ class RawConfigParser(MutableMapping): def write(self, fp, space_around_delimiters=True): """Write an .ini-format representation of the configuration state. - If `space_around_delimiters' is True (the default), delimiters + If ``space_around_delimiters`` is True (the default), delimiters between keys and values are surrounded by spaces. """ if space_around_delimiters: @@ -916,7 +916,7 @@ class RawConfigParser(MutableMapping): self._sections[section].items(), d) def _write_section(self, fp, section_name, section_items, delimiter): - """Write a single section to the specified `fp'.""" + """Write a single section to the specified ``fp``.""" fp.write("[{}]\n".format(section_name)) for key, value in section_items: value = self._interpolation.before_write(self, section_name, key, @@ -990,7 +990,7 @@ class RawConfigParser(MutableMapping): Each section in a configuration file contains a header, indicated by a name in square brackets (`[]'), plus key/value options, indicated by - `name' and `value' delimited with a specific substring (`=' or `:' by + ``name`` and ``value`` delimited with a specific substring (`=' or `:' by default). Values can span multiple lines, as long as they are indented deeper diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 1c36990..b29d6fb 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -308,7 +308,7 @@ class Mingw32CCompiler(CygwinCCompiler): entry_point)) # Maybe we should also append -mthreads, but then the finished # dlls need another dll (mingwm10.dll see Mingw32 docs) - # (-mthreads: Support thread-safe exception handling on `Mingw32') + # (-mthreads: Support thread-safe exception handling on ``Mingw32``) # no additional libraries needed self.dll_libraries=[] diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py index cdfa372..a12202d 100644 --- a/Lib/email/_parseaddr.py +++ b/Lib/email/_parseaddr.py @@ -213,7 +213,7 @@ class AddrlistClass: def __init__(self, field): """Initialize a new instance. - `field' is an unparsed address header field, containing + ``field`` is an unparsed address header field, containing one or more addresses. """ self.specials = '()<>@,:;.\"[]' @@ -403,14 +403,14 @@ class AddrlistClass: def getdelimited(self, beginchar, endchars, allowcomments=True): """Parse a header fragment delimited by special characters. - `beginchar' is the start character for the fragment. - If self is not looking at an instance of `beginchar' then + ``beginchar`` is the start character for the fragment. + If self is not looking at an instance of ``beginchar`` then 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. - 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. """ if self.field[self.pos] != beginchar: diff --git a/Lib/email/charset.py b/Lib/email/charset.py index ee56404..c7d812a 100644 --- a/Lib/email/charset.py +++ b/Lib/email/charset.py @@ -180,7 +180,7 @@ class Charset: module expose the following information about a character set: 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. header_encoding: If the character set must be encoded before it can be @@ -252,7 +252,7 @@ class Charset: def get_body_encoding(self): """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 function with a single argument, the Message object being encoded. The function should then set the Content-Transfer-Encoding diff --git a/Lib/email/generator.py b/Lib/email/generator.py index ae670c2..bbb1d84 100644 --- a/Lib/email/generator.py +++ b/Lib/email/generator.py @@ -75,7 +75,7 @@ class Generator: 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 - 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. Note that for subobjects, no From_ line is printed. @@ -454,7 +454,7 @@ class DecodedGenerator(Generator): argument is allowed. 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 payload. fmt is expanded with the following keywords (in diff --git a/Lib/email/header.py b/Lib/email/header.py index c7b2dd9..8aebe2d 100644 --- a/Lib/email/header.py +++ b/Lib/email/header.py @@ -196,7 +196,7 @@ class Header: The maximum line length can be specified explicitly via maxlinelen. For 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 by RFC 2822. @@ -280,7 +280,7 @@ class Header: output codec of the charset. If the string cannot be encoded to the 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. """ if charset is None: diff --git a/Lib/email/iterators.py b/Lib/email/iterators.py index b5502ee..139b75e 100644 --- a/Lib/email/iterators.py +++ b/Lib/email/iterators.py @@ -45,8 +45,8 @@ def body_line_iterator(msg, decode=False): def typed_subpart_iterator(msg, maintype='text', subtype=None): """Iterate over the subparts with a given MIME type. - Use `maintype' as the main MIME type to match against; this defaults to - "text". Optional `subtype' is the MIME subtype to match against; if + Use ``maintype`` as the main MIME type to match against; this defaults to + "text". Optional ``subtype`` is the MIME subtype to match against; if omitted, only the main type is matched. """ for subpart in msg.walk(): diff --git a/Lib/email/message.py b/Lib/email/message.py index b6512f2..9cae374 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -21,7 +21,7 @@ Charset = _charset.Charset 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. tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]') @@ -111,7 +111,7 @@ class Message: multipart or a message/rfc822), then the payload is a list of Message 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 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 @@ -222,7 +222,7 @@ class Message: (default is False). When True and the message is not a multipart, the payload will be - decoded if this header's value is `quoted-printable' or `base64'. If + decoded if this header's value is `quoted-printable' or ``base64``. If some other encoding is used, or the header is missing, or if the payload has bogus data (i.e. bogus base64 or uuencoded data), the payload is returned as-is. @@ -588,7 +588,7 @@ class Message: def get_content_maintype(self): """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(). """ ctype = self.get_content_type() @@ -597,14 +597,14 @@ class Message: def get_content_subtype(self): """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(). """ ctype = self.get_content_type() return ctype.split('/')[1] 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 messages that are subparts of multipart/digest containers. Such @@ -613,7 +613,7 @@ class Message: return self._default_type 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 is not enforced. The default content type is not stored in the @@ -807,9 +807,9 @@ class Message: """Return the filename associated with the payload if present. The filename is extracted from the Content-Disposition header's - `filename' parameter, and it is unquoted. If that header is missing - the `filename' parameter, this method falls back to looking for the - `name' parameter. + ``filename`` parameter, and it is unquoted. If that header is missing + the ``filename`` parameter, this method falls back to looking for the + ``name`` parameter. """ missing = object() filename = self.get_param('filename', missing, 'content-disposition') @@ -822,7 +822,7 @@ class Message: def get_boundary(self, failobj=None): """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. """ missing = object() diff --git a/Lib/email/mime/audio.py b/Lib/email/mime/audio.py index 4bcd7b2..fb87780 100644 --- a/Lib/email/mime/audio.py +++ b/Lib/email/mime/audio.py @@ -47,7 +47,7 @@ class MIMEAudio(MIMENonMultipart): """Create an audio/* type MIME document. _audiodata is a string containing the raw audio data. If this data - can be decoded by the standard Python `sndhdr' module, then the + can be decoded by the standard Python ``sndhdr`` module, then the subtype will be automatically included in the Content-Type header. Otherwise, you can specify the specific audio subtype via the _subtype parameter. If _subtype is not given, and no subtype can be diff --git a/Lib/email/mime/image.py b/Lib/email/mime/image.py index 9272464..d99ff80 100644 --- a/Lib/email/mime/image.py +++ b/Lib/email/mime/image.py @@ -21,7 +21,7 @@ class MIMEImage(MIMENonMultipart): """Create an image/* type MIME document. _imagedata is a string containing the raw image data. If this data - can be decoded by the standard Python `imghdr' module, then the + can be decoded by the standard Python ``imghdr`` module, then the subtype will be automatically included in the Content-Type header. Otherwise, you can specify the specific image subtype via the _subtype parameter. diff --git a/Lib/email/mime/multipart.py b/Lib/email/mime/multipart.py index 2d3f288..d963b12 100644 --- a/Lib/email/mime/multipart.py +++ b/Lib/email/mime/multipart.py @@ -22,7 +22,7 @@ class MIMEMultipart(MIMEBase): Content-Type and MIME-Version headers. _subtype is the subtype of the multipart content type, defaulting to - `mixed'. + ``mixed``. boundary is the multipart boundary string. By default it is calculated as needed. diff --git a/Lib/email/quoprimime.py b/Lib/email/quoprimime.py index c543eb5..1903127 100644 --- a/Lib/email/quoprimime.py +++ b/Lib/email/quoprimime.py @@ -127,7 +127,7 @@ def quote(c): def header_encode(header_bytes, charset='iso-8859-1'): """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 bit characters (and some 8 bit) to remain more or less readable in non-RFC 2045 aware mail clients. @@ -289,7 +289,7 @@ def _unquote_match(match): # Header decoding is done a bit differently 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 quoted-printable (like =?iso-8859-1?q?Hello_World?=) -- please use diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 8f36f53..9775f10 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -347,7 +347,7 @@ class FTP: connection and the expected size of the transfer. The 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 marker used to tell the server to skip over any data up to the given marker. diff --git a/Lib/gettext.py b/Lib/gettext.py index 57d2c74..dbbc7f3 100644 --- a/Lib/gettext.py +++ b/Lib/gettext.py @@ -539,7 +539,7 @@ def install(domain, localedir=None, codeset=None, names=None): _localedirs = {} # a mapping b/w domains and codesets _localecodesets = {} -# current global domain, `messages' used for compatibility w/ GNU gettext +# current global domain, ``messages`` used for compatibility w/ GNU gettext _current_domain = 'messages' diff --git a/Lib/heapq.py b/Lib/heapq.py index 0b3e89a..85ca9bf 100644 --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -40,7 +40,7 @@ non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always its smallest element. 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 @@ -53,7 +53,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 -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 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 @@ -108,7 +108,7 @@ vanishes, you switch heaps and start a new run. Clever and quite effective! 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. :-) -------------------- diff --git a/Lib/http/client.py b/Lib/http/client.py index 59237a3..632f461 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -947,7 +947,7 @@ class HTTPConnection: response.close() 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 file-like object that supports a .read() method, or an iterable object. """ @@ -1065,10 +1065,10 @@ class HTTPConnection: skip_accept_encoding=False): """Send a request to the server. - `method' specifies an HTTP request method, e.g. 'GET'. - `url' specifies the object being requested, e.g. '/index.html'. - `skip_host' if True does not add automatically a 'Host:' header - `skip_accept_encoding' if True does not add automatically an + ``method`` specifies an HTTP request method, e.g. 'GET'. + ``url`` specifies the object being requested, e.g. '/index.html'. + ``skip_host`` if True does not add automatically a 'Host:' header + ``skip_accept_encoding`` if True does not add automatically an 'Accept-Encoding:' header """ diff --git a/Lib/imaplib.py b/Lib/imaplib.py index cad508a..25ab045 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -234,7 +234,7 @@ class IMAP4: if __debug__: self._cmd_log_len = 10 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: self._mesg('imaplib version %s' % __version__) self._mesg('new IMAP4 connection, tag=%s' % self.tagpre) @@ -374,7 +374,7 @@ class IMAP4: (typ, [data]) = .append(mailbox, flags, date_time, message) - All args except `message' can be None. + All args except ``message`` can be None. """ name = 'APPEND' if not mailbox: @@ -892,7 +892,7 @@ class IMAP4: (typ, [data]) = .xatom(name, arg, ...) - Returns response appropriate to extension command `name'. + Returns response appropriate to extension command ``name``. """ name = name.upper() #if not name in self.capabilities: # Let the server decide! @@ -1210,7 +1210,7 @@ class IMAP4: sys.stderr.flush() def _dump_ur(self, dict): - # Dump untagged responses (in `dict'). + # Dump untagged responses (in ``dict``). l = dict.items() if not l: return t = '\n\t\t' @@ -1218,7 +1218,7 @@ class IMAP4: self._mesg('untagged responses dump:%s%s' % (t, t.join(l))) 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_idx += 1 if self._cmd_log_idx >= self._cmd_log_len: diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index 9a88680..f6064b6 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -110,7 +110,7 @@ class MimeTypes: mapped to '.tar.gz'. (This is table-driven too, using the 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. """ scheme, url = urllib.parse.splittype(url) @@ -162,9 +162,9 @@ class MimeTypes: Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not 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. """ type = type.lower() @@ -181,11 +181,11 @@ class MimeTypes: Return value is a string giving a filename extension, including the leading dot ('.'). The extension is not guaranteed to have been 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 `type', None + stream, but would be mapped to the MIME type ``type`` by + guess_type(). If no extension can be guessed for ``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. """ extensions = self.guess_all_extensions(type, strict) @@ -283,7 +283,7 @@ def guess_type(url, strict=True): to ".tar.gz". (This is table-driven too, using the dictionary 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. """ if _db is None: @@ -297,11 +297,11 @@ def guess_all_extensions(type, strict=True): Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been 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 `type', None + stream, but would be mapped to the MIME type ``type`` by + guess_type(). If no extension can be guessed for ``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. """ if _db is None: @@ -314,10 +314,10 @@ def guess_extension(type, strict=True): Return value is a string giving a filename extension, including the leading dot ('.'). The extension is not guaranteed to have been 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 - `type', None is returned. + MIME type ``type`` by guess_type(). If no extension can be guessed for + ``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. """ if _db is None: diff --git a/Lib/nntplib.py b/Lib/nntplib.py index 28cd099..e64093a 100644 --- a/Lib/nntplib.py +++ b/Lib/nntplib.py @@ -320,7 +320,7 @@ class _NNTPBase: readermode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to call - reader-specific commands, such as `group'. If you get + reader-specific commands, such as ``group``. If you get unexpected NNTPPermanentErrors, you might need to set readermode. """ @@ -1034,7 +1034,7 @@ class NNTP(_NNTPBase): readermode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to call - reader-specific commands, such as `group'. If you get + reader-specific commands, such as ``group``. If you get unexpected NNTPPermanentErrors, you might need to set readermode. """ diff --git a/Lib/pstats.py b/Lib/pstats.py index d861413..d05966e 100644 --- a/Lib/pstats.py +++ b/Lib/pstats.py @@ -651,7 +651,7 @@ if __name__ == '__main__': return 0 def help_sort(self): print("Sort profile data according to specified keys.", file=self.stream) - print("(Typing `sort' without arguments lists valid keys.)", file=self.stream) + print("(Typing 'sort' without arguments lists valid keys.)", file=self.stream) def complete_sort(self, text, *args): return [a for a in Stats.sort_arg_dict_default if a.startswith(text)] diff --git a/Lib/smtpd.py b/Lib/smtpd.py index 8103ca9..aa832d9 100755 --- a/Lib/smtpd.py +++ b/Lib/smtpd.py @@ -7,7 +7,7 @@ Options: --nosetuid -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 which case, use this flag). @@ -17,7 +17,7 @@ Options: --class 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. --size limit @@ -39,8 +39,8 @@ Options: Version: %(__version__)s -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, +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, and if remoteport is not given, then 25 is used. """ diff --git a/Lib/smtplib.py b/Lib/smtplib.py index f7c2c77..ce67258 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -91,7 +91,7 @@ class SMTPResponseException(SMTPException): These exceptions are generated in some instances when the SMTP server returns an error code. The error code is stored in the - `smtp_code' attribute of the error, and the `smtp_error' attribute + ``smtp_code`` attribute of the error, and the ``smtp_error`` attribute is set to the error message. """ @@ -104,7 +104,7 @@ class SMTPSenderRefused(SMTPResponseException): """Sender address refused. 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): @@ -228,8 +228,8 @@ class SMTP: source_address=None): """Initialize a new instance. - If specified, `host' is the name of the remote host to which to - connect. If specified, `port' specifies the port to which to connect. + If specified, ``host`` is the name of the remote host to which to + connect. If specified, ``port`` specifies the port to which to connect. By default, smtplib.SMTP_PORT is used. If a host is specified the connect method is called, and if it returns anything other than a success code an SMTPConnectError is raised. If specified, @@ -340,7 +340,7 @@ class SMTP: return (code, msg) def send(self, s): - """Send `s' to the server.""" + """Send ``s`` to the server.""" if self.debuglevel > 0: self._print_debug('send:', repr(s)) if hasattr(self, 'sock') and self.sock: diff --git a/Lib/tarfile.py b/Lib/tarfile.py index b78b1b1..450737f 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -987,7 +987,7 @@ class TarInfo(object): for keyword, value in pax_headers.items(): keyword = keyword.encode("utf-8") 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. value = value.encode(encoding, "surrogateescape") else: @@ -1405,13 +1405,13 @@ class TarFile(object): tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, errors="surrogateescape", pax_headers=None, debug=None, errorlevel=None, copybufsize=None): - """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 - 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'. - If `fileobj' is given, it is used for reading or writing data. If it - can be determined, `mode' is overridden by `fileobj's mode. - `fileobj' is not closed, when TarFile is closed. + If ``fileobj`` is given, it is used for reading or writing data. If it + can be determined, ``mode`` is overridden by ``fileobj``s mode. + ``fileobj`` is not closed, when TarFile is closed. """ modes = {"r": "rb", "a": "r+b", "w": "wb", "x": "xb"} if mode not in modes: @@ -1735,7 +1735,7 @@ class TarFile(object): self.fileobj.close() 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 than once in the archive, its last occurrence is assumed to be the most up-to-date version. @@ -1763,9 +1763,9 @@ class TarFile(object): def gettarinfo(self, name=None, arcname=None, fileobj=None): """Create a TarInfo object from the result of os.stat or equivalent - on an existing file. The file is either named by `name', or - specified as a file object `fileobj' with a file descriptor. If - given, `arcname' specifies an alternative name for the file in the + on an existing file. The file is either named by ``name``, or + specified as a file object ``fileobj`` with a file descriptor. If + given, ``arcname`` specifies an alternative name for the file in the archive, otherwise, the name is taken from the 'name' attribute of 'fileobj', or the 'name' argument. The name should be a text string. @@ -1862,9 +1862,9 @@ class TarFile(object): return tarinfo 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 - 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(). """ self._check() @@ -1894,12 +1894,12 @@ class TarFile(object): print() def add(self, name, arcname=None, recursive=True, exclude=None, *, filter=None): - """Add the file `name' to the archive. `name' may be any type of file - (directory, fifo, symbolic link, etc.). If given, `arcname' + """Add the file ``name`` to the archive. ``name`` may be any type of file + (directory, fifo, symbolic link, etc.). If given, ``arcname`` specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by - setting `recursive' to False. `exclude' is a function that should - return True for each filename to be excluded. `filter' is a function + setting ``recursive`` to False. ``exclude`` is a function that should + return True for each filename to be excluded. ``filter`` is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. @@ -1955,7 +1955,7 @@ class TarFile(object): self.addfile(tarinfo) def addfile(self, tarinfo, fileobj=None): - """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is + """Add the TarInfo object ``tarinfo`` to the archive. If ``fileobj`` is given, it should be a binary file, and tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects directly, or by using gettarinfo(). @@ -1982,8 +1982,8 @@ class TarFile(object): def extractall(self, path=".", members=None, *, numeric_owner=False): """Extract all members from the archive to the current working directory and set owner, modification time and permissions on - directories afterwards. `path' specifies a different directory - to extract to. `members' is optional and must be a subset of the + directories afterwards. ``path`` specifies a different directory + to extract to. ``members`` is optional and must be a subset of the list returned by getmembers(). If `numeric_owner` is True, only the numbers for user/group names are used and not the names. """ @@ -2022,9 +2022,9 @@ class TarFile(object): def extract(self, member, path="", set_attrs=True, *, numeric_owner=False): """Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately - as possible. `member' may be a filename or a TarInfo object. You can - specify a different directory using `path'. File attributes (owner, - mtime, mode) are set unless `set_attrs' is False. If `numeric_owner` + as possible. ``member`` may be a filename or a TarInfo object. You can + specify a different directory using ``path``. File attributes (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 the names. """ @@ -2058,8 +2058,8 @@ class TarFile(object): self._dbg(1, "tarfile: %s" % e) def extractfile(self, member): - """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 + """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 link, an io.BufferedReader object is returned. Otherwise, None is returned. """ diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py index 2b08198..f7d2a1c 100644 --- a/Lib/test/test_configparser.py +++ b/Lib/test/test_configparser.py @@ -1523,12 +1523,12 @@ class CoverageOneHundredTestCase(unittest.TestCase): def test_parsing_error(self): with self.assertRaises(ValueError) as cm: configparser.ParsingError() - self.assertEqual(str(cm.exception), "Required argument `source' not " + self.assertEqual(str(cm.exception), "Required argument 'source' not " "given.") with self.assertRaises(ValueError) as cm: configparser.ParsingError(source='source', filename='filename') - self.assertEqual(str(cm.exception), "Cannot specify both `filename' " - "and `source'. Use `source'.") + self.assertEqual(str(cm.exception), "Cannot specify both 'filename' " + "and 'source'. Use 'source'.") error = configparser.ParsingError(filename='source') self.assertEqual(error.source, 'source') with warnings.catch_warnings(record=True) as w: diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py index 8f481bb..9de8833 100644 --- a/Lib/test/test_funcattrs.py +++ b/Lib/test/test_funcattrs.py @@ -56,7 +56,7 @@ class FunctionPropertiesTest(FuncAttrsTest): "implementations, should show up in next dir") def test_duplicate_function_equality(self): - # Body of `duplicate' is the exact same as self.b + # Body of ``duplicate`` is the exact same as self.b def duplicate(): 'my docstring' return 3 diff --git a/Lib/trace.py b/Lib/trace.py index ae15461..1460086 100755 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -416,7 +416,7 @@ class Trace: @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions 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 ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @@ -546,7 +546,7 @@ class Trace: def globaltrace_lt(self, frame, why, arg): """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. """ if why == 'call': diff --git a/Lib/wsgiref/headers.py b/Lib/wsgiref/headers.py index fab851c..91e81be 100644 --- a/Lib/wsgiref/headers.py +++ b/Lib/wsgiref/headers.py @@ -5,7 +5,7 @@ so portions are Copyright (C) 2001,2002 Python Software Foundation, and were 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. import re tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]') diff --git a/Lib/zipfile.py b/Lib/zipfile.py index d3661a3..52273db 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1466,8 +1466,8 @@ class ZipFile: def extract(self, member, path=None, pwd=None): """Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately - as possible. `member' may be a filename or a ZipInfo object. You can - specify a different directory using `path'. + as possible. ``member`` may be a filename or a ZipInfo object. You can + specify a different directory using ``path``. """ if not isinstance(member, ZipInfo): member = self.getinfo(member) @@ -1479,8 +1479,8 @@ class ZipFile: def extractall(self, path=None, members=None, pwd=None): """Extract all members from the archive to the current working - directory. `path' specifies a different directory to extract to. - `members' is optional and must be a subset of the list returned + directory. ``path`` specifies a different directory to extract to. + ``members`` is optional and must be a subset of the list returned by namelist(). """ if members is None: