Skip to content

Commit ef17252

Browse files
authored
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.
1 parent 8186500 commit ef17252

39 files changed

+172
-172
lines changed

Lib/_pyrepl/keymap.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
pyrepl uses its own keyspec format that is meant to be a strict superset of
3131
readline's KEYSEQ format. This means that if a spec is found that readline
3232
accepts that this doesn't, it should be logged as a bug. Note that this means
33-
we're using the `\\C-o' style of readline's keyspec, not the `Control-o' sort.
33+
we're using the '\\C-o' style of readline's keyspec, not the 'Control-o' sort.
3434
3535
The extension to readline is that the sequence \\<KEY> denotes the
3636
sequence of characters produced by hitting KEY.
3737
3838
Examples:
39-
`a' - what you get when you hit the `a' key
40-
`\\EOA' - Escape - O - A (up, on my terminal)
41-
`\\<UP>' - the up arrow key
42-
`\\<up>' - ditto (keynames are case-insensitive)
43-
`\\C-o', `\\c-o' - control-o
44-
`\\M-.' - meta-period
45-
`\\E.' - ditto (that's how meta works for pyrepl)
46-
`\\<tab>', `\\<TAB>', `\\t', `\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
39+
'a' - what you get when you hit the 'a' key
40+
'\\EOA' - Escape - O - A (up, on my terminal)
41+
'\\<UP>' - the up arrow key
42+
'\\<up>' - ditto (keynames are case-insensitive)
43+
'\\C-o', '\\c-o' - control-o
44+
'\\M-.' - meta-period
45+
'\\E.' - ditto (that's how meta works for pyrepl)
46+
'\\<tab>', '\\<TAB>', '\\t', '\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
4747
- all of these are the tab character.
4848
"""
4949

Lib/_pyrepl/reader.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ class Reader:
171171
* console:
172172
Hopefully encapsulates the OS dependent stuff.
173173
* pos:
174-
A 0-based index into `buffer' for where the insertion point
174+
A 0-based index into 'buffer' for where the insertion point
175175
is.
176176
* screeninfo:
177177
Ahem. This list contains some info needed to move the
178178
insertion point around reasonably efficiently.
179179
* cxy, lxy:
180180
the position of the insertion point in screen ...
181181
* syntax_table:
182-
Dictionary mapping characters to `syntax class'; read the
182+
Dictionary mapping characters to 'syntax class'; read the
183183
emacs docs to see what this means :-)
184184
* commands:
185185
Dictionary mapping command names to command classes.
@@ -431,7 +431,7 @@ def max_row(self) -> int:
431431

432432
def get_arg(self, default: int = 1) -> int:
433433
"""Return any prefix argument that the user has supplied,
434-
returning `default' if there is None. Defaults to 1.
434+
returning 'default' if there is None. Defaults to 1.
435435
"""
436436
if self.arg is None:
437437
return default
@@ -440,7 +440,7 @@ def get_arg(self, default: int = 1) -> int:
440440

441441
def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
442442
"""Return what should be in the left-hand margin for line
443-
`lineno'."""
443+
'lineno'."""
444444
if self.arg is not None and cursor_on_line:
445445
prompt = "(arg: %s) " % self.arg
446446
elif self.paste_mode:

Lib/cmd.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
1. End of file on input is processed as the command 'EOF'.
66
2. A command is parsed out of each line by collecting the prefix composed
77
of characters in the identchars member.
8-
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
8+
3. A command 'foo' is dispatched to a method 'do_foo()'; the do_ method
99
is passed a single argument consisting of the remainder of the line.
1010
4. Typing an empty line repeats the last command. (Actually, it calls the
11-
method `emptyline', which may be overridden in a subclass.)
12-
5. There is a predefined `help' method. Given an argument `topic', it
13-
calls the command `help_topic'. With no arguments, it lists all topics
11+
method 'emptyline', which may be overridden in a subclass.)
12+
5. There is a predefined 'help' method. Given an argument 'topic', it
13+
calls the command 'help_topic'. With no arguments, it lists all topics
1414
with defined help_ functions, broken into up to three topics; documented
1515
commands, miscellaneous help topics, and undocumented commands.
16-
6. The command '?' is a synonym for `help'. The command '!' is a synonym
17-
for `shell', if a do_shell method exists.
16+
6. The command '?' is a synonym for 'help'. The command '!' is a synonym
17+
for 'shell', if a do_shell method exists.
1818
7. If completion is enabled, completing commands will be done automatically,
1919
and completing of commands args is done by calling complete_foo() with
2020
arguments text, line, begidx, endidx. text is string we are matching
@@ -23,21 +23,21 @@
2323
indexes of the text being matched, which could be used to provide
2424
different completion depending upon which position the argument is in.
2525
26-
The `default' method may be overridden to intercept commands for which there
26+
The 'default' method may be overridden to intercept commands for which there
2727
is no do_ method.
2828
29-
The `completedefault' method may be overridden to intercept completions for
29+
The 'completedefault' method may be overridden to intercept completions for
3030
commands that have no complete_ method.
3131
32-
The data member `self.ruler' sets the character used to draw separator lines
32+
The data member 'self.ruler' sets the character used to draw separator lines
3333
in the help messages. If empty, no ruler line is drawn. It defaults to "=".
3434
35-
If the value of `self.intro' is nonempty when the cmdloop method is called,
35+
If the value of 'self.intro' is nonempty when the cmdloop method is called,
3636
it is printed out on interpreter startup. This value may be overridden
3737
via an optional argument to the cmdloop() method.
3838
39-
The data members `self.doc_header', `self.misc_header', and
40-
`self.undoc_header' set the headers used for the help function's
39+
The data members 'self.doc_header', 'self.misc_header', and
40+
'self.undoc_header' set the headers used for the help function's
4141
listings of documented functions, miscellaneous topics, and undocumented
4242
functions respectively.
4343
"""

Lib/configparser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ def write(self, fp, space_around_delimiters=True):
957957
self._sections[section].items(), d)
958958

959959
def _write_section(self, fp, section_name, section_items, delimiter, unnamed=False):
960-
"""Write a single section to the specified `fp'."""
960+
"""Write a single section to the specified 'fp'."""
961961
if not unnamed:
962962
fp.write("[{}]\n".format(section_name))
963963
for key, value in section_items:

Lib/doctest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ class DocTestRunner:
12271227
`OutputChecker` to the constructor.
12281228
12291229
The test runner's display output can be controlled in two ways.
1230-
First, an output function (`out) can be passed to
1230+
First, an output function (`out`) can be passed to
12311231
`TestRunner.run`; this function will be called with strings that
12321232
should be displayed. It defaults to `sys.stdout.write`. If
12331233
capturing the output is not sufficient, then the display output
@@ -2734,7 +2734,7 @@ def testsource(module, name):
27342734
return testsrc
27352735

27362736
def debug_src(src, pm=False, globs=None):
2737-
"""Debug a single doctest docstring, in argument `src`'"""
2737+
"""Debug a single doctest docstring, in argument `src`"""
27382738
testsrc = script_from_examples(src)
27392739
debug_script(testsrc, pm, globs)
27402740

Lib/email/_parseaddr.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class AddrlistClass:
224224
def __init__(self, field):
225225
"""Initialize a new instance.
226226
227-
`field' is an unparsed address header field, containing
227+
'field' is an unparsed address header field, containing
228228
one or more addresses.
229229
"""
230230
self.specials = '()<>@,:;.\"[]'
@@ -233,7 +233,7 @@ def __init__(self, field):
233233
self.CR = '\r\n'
234234
self.FWS = self.LWS + self.CR
235235
self.atomends = self.specials + self.LWS + self.CR
236-
# Note that RFC 2822 now specifies `.' as obs-phrase, meaning that it
236+
# Note that RFC 2822 now specifies '.' as obs-phrase, meaning that it
237237
# is obsolete syntax. RFC 2822 requires that we recognize obsolete
238238
# syntax, so allow dots in phrases.
239239
self.phraseends = self.atomends.replace('.', '')
@@ -423,14 +423,14 @@ def getdomain(self):
423423
def getdelimited(self, beginchar, endchars, allowcomments=True):
424424
"""Parse a header fragment delimited by special characters.
425425
426-
`beginchar' is the start character for the fragment.
427-
If self is not looking at an instance of `beginchar' then
426+
'beginchar' is the start character for the fragment.
427+
If self is not looking at an instance of 'beginchar' then
428428
getdelimited returns the empty string.
429429
430-
`endchars' is a sequence of allowable end-delimiting characters.
430+
'endchars' is a sequence of allowable end-delimiting characters.
431431
Parsing stops when one of these is encountered.
432432
433-
If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed
433+
If 'allowcomments' is non-zero, embedded RFC 2822 comments are allowed
434434
within the parsed fragment.
435435
"""
436436
if self.field[self.pos] != beginchar:
@@ -474,7 +474,7 @@ def getatom(self, atomends=None):
474474
475475
Optional atomends specifies a different set of end token delimiters
476476
(the default is to use self.atomends). This is used e.g. in
477-
getphraselist() since phrase endings must not include the `.' (which
477+
getphraselist() since phrase endings must not include the '.' (which
478478
is legal in phrases)."""
479479
atomlist = ['']
480480
if atomends is None:

Lib/email/_policybase.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class Policy(_PolicyBase, metaclass=abc.ABCMeta):
150150
wrapping is done. Default is 78.
151151
152152
mangle_from_ -- a flag that, when True escapes From_ lines in the
153-
body of the message by putting a `>' in front of
153+
body of the message by putting a '>' in front of
154154
them. This is used when the message is being
155155
serialized by a generator. Default: False.
156156

Lib/email/base64mime.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
with Base64 encoding.
1616
1717
RFC 2045 defines a method for including character set information in an
18-
`encoded-word' in a header. This method is commonly used for 8-bit real names
18+
'encoded-word' in a header. This method is commonly used for 8-bit real names
1919
in To:, From:, Cc:, etc. fields, as well as Subject: lines.
2020
2121
This module does not do the line wrapping or end-of-line character conversion

Lib/email/charset.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Charset:
175175
module expose the following information about a character set:
176176
177177
input_charset: The initial character set specified. Common aliases
178-
are converted to their `official' email names (e.g. latin_1
178+
are converted to their 'official' email names (e.g. latin_1
179179
is converted to iso-8859-1). Defaults to 7-bit us-ascii.
180180
181181
header_encoding: If the character set must be encoded before it can be
@@ -245,7 +245,7 @@ def __eq__(self, other):
245245
def get_body_encoding(self):
246246
"""Return the content-transfer-encoding used for body encoding.
247247
248-
This is either the string `quoted-printable' or `base64' depending on
248+
This is either the string 'quoted-printable' or 'base64' depending on
249249
the encoding used, or it is a function in which case you should call
250250
the function with a single argument, the Message object being
251251
encoded. The function should then set the Content-Transfer-Encoding

Lib/email/generator.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, *,
4141
4242
Optional mangle_from_ is a flag that, when True (the default if policy
4343
is not set), escapes From_ lines in the body of the message by putting
44-
a `>' in front of them.
44+
a '>' in front of them.
4545
4646
Optional maxheaderlen specifies the longest length for a non-continued
4747
header. When a header line is longer (in characters, with tabs
@@ -74,7 +74,7 @@ def flatten(self, msg, unixfrom=False, linesep=None):
7474
7575
unixfrom is a flag that forces the printing of a Unix From_ delimiter
7676
before the first object in the message tree. If the original message
77-
has no From_ delimiter, a `standard' one is crafted. By default, this
77+
has no From_ delimiter, a 'standard' one is crafted. By default, this
7878
is False to inhibit the printing of any From_ delimiter.
7979
8080
Note that for subobjects, no From_ line is printed.
@@ -456,7 +456,7 @@ def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, fmt=None, *,
456456
argument is allowed.
457457
458458
Walks through all subparts of a message. If the subpart is of main
459-
type `text', then it prints the decoded payload of the subpart.
459+
type 'text', then it prints the decoded payload of the subpart.
460460
461461
Otherwise, fmt is a format string that is used instead of the message
462462
payload. fmt is expanded with the following keywords (in

Lib/email/header.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def __init__(self, s=None, charset=None,
192192
193193
The maximum line length can be specified explicitly via maxlinelen. For
194194
splitting the first line to a shorter value (to account for the field
195-
header which isn't included in s, e.g. `Subject') pass in the name of
195+
header which isn't included in s, e.g. 'Subject') pass in the name of
196196
the field in header_name. The default maxlinelen is 78 as recommended
197197
by RFC 2822.
198198
@@ -276,7 +276,7 @@ def append(self, s, charset=None, errors='strict'):
276276
output codec of the charset. If the string cannot be encoded to the
277277
output codec, a UnicodeError will be raised.
278278
279-
Optional `errors' is passed as the errors argument to the decode
279+
Optional 'errors' is passed as the errors argument to the decode
280280
call if s is a byte string.
281281
"""
282282
if charset is None:
@@ -326,7 +326,7 @@ def encode(self, splitchars=';, \t', maxlinelen=None, linesep='\n'):
326326
327327
Optional splitchars is a string containing characters which should be
328328
given extra weight by the splitting algorithm during normal header
329-
wrapping. This is in very rough support of RFC 2822's `higher level
329+
wrapping. This is in very rough support of RFC 2822's 'higher level
330330
syntactic breaks': split points preceded by a splitchar are preferred
331331
during line splitting, with the characters preferred in the order in
332332
which they appear in the string. Space and tab may be included in the

Lib/email/iterators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def body_line_iterator(msg, decode=False):
4343
def typed_subpart_iterator(msg, maintype='text', subtype=None):
4444
"""Iterate over the subparts with a given MIME type.
4545
46-
Use `maintype' as the main MIME type to match against; this defaults to
47-
"text". Optional `subtype' is the MIME subtype to match against; if
46+
Use 'maintype' as the main MIME type to match against; this defaults to
47+
"text". Optional 'subtype' is the MIME subtype to match against; if
4848
omitted, only the main type is matched.
4949
"""
5050
for subpart in msg.walk():

Lib/email/message.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
SEMISPACE = '; '
2323

24-
# Regular expression that matches `special' characters in parameters, the
24+
# Regular expression that matches 'special' characters in parameters, the
2525
# existence of which force quoting of the parameter value.
2626
tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]')
2727

@@ -141,7 +141,7 @@ class Message:
141141
multipart or a message/rfc822), then the payload is a list of Message
142142
objects, otherwise it is a string.
143143
144-
Message objects implement part of the `mapping' interface, which assumes
144+
Message objects implement part of the 'mapping' interface, which assumes
145145
there is exactly one occurrence of the header per message. Some headers
146146
do in fact appear multiple times (e.g. Received) and for those headers,
147147
you must use the explicit API to set or get all the headers. Not all of
@@ -597,7 +597,7 @@ def get_content_type(self):
597597
"""Return the message's content type.
598598
599599
The returned string is coerced to lower case of the form
600-
`maintype/subtype'. If there was no Content-Type header in the
600+
'maintype/subtype'. If there was no Content-Type header in the
601601
message, the default type as given by get_default_type() will be
602602
returned. Since according to RFC 2045, messages always have a default
603603
type this will always return a value.
@@ -620,7 +620,7 @@ def get_content_type(self):
620620
def get_content_maintype(self):
621621
"""Return the message's main content type.
622622
623-
This is the `maintype' part of the string returned by
623+
This is the 'maintype' part of the string returned by
624624
get_content_type().
625625
"""
626626
ctype = self.get_content_type()
@@ -629,14 +629,14 @@ def get_content_maintype(self):
629629
def get_content_subtype(self):
630630
"""Returns the message's sub-content type.
631631
632-
This is the `subtype' part of the string returned by
632+
This is the 'subtype' part of the string returned by
633633
get_content_type().
634634
"""
635635
ctype = self.get_content_type()
636636
return ctype.split('/')[1]
637637

638638
def get_default_type(self):
639-
"""Return the `default' content type.
639+
"""Return the 'default' content type.
640640
641641
Most messages have a default content type of text/plain, except for
642642
messages that are subparts of multipart/digest containers. Such
@@ -645,7 +645,7 @@ def get_default_type(self):
645645
return self._default_type
646646

647647
def set_default_type(self, ctype):
648-
"""Set the `default' content type.
648+
"""Set the 'default' content type.
649649
650650
ctype should be either "text/plain" or "message/rfc822", although this
651651
is not enforced. The default content type is not stored in the
@@ -678,8 +678,8 @@ def get_params(self, failobj=None, header='content-type', unquote=True):
678678
"""Return the message's Content-Type parameters, as a list.
679679
680680
The elements of the returned list are 2-tuples of key/value pairs, as
681-
split on the `=' sign. The left hand side of the `=' is the key,
682-
while the right hand side is the value. If there is no `=' sign in
681+
split on the '=' sign. The left hand side of the '=' is the key,
682+
while the right hand side is the value. If there is no '=' sign in
683683
the parameter the value is the empty string. The value is as
684684
described in the get_param() method.
685685
@@ -839,9 +839,9 @@ def get_filename(self, failobj=None):
839839
"""Return the filename associated with the payload if present.
840840
841841
The filename is extracted from the Content-Disposition header's
842-
`filename' parameter, and it is unquoted. If that header is missing
843-
the `filename' parameter, this method falls back to looking for the
844-
`name' parameter.
842+
'filename' parameter, and it is unquoted. If that header is missing
843+
the 'filename' parameter, this method falls back to looking for the
844+
'name' parameter.
845845
"""
846846
missing = object()
847847
filename = self.get_param('filename', missing, 'content-disposition')
@@ -854,7 +854,7 @@ def get_filename(self, failobj=None):
854854
def get_boundary(self, failobj=None):
855855
"""Return the boundary associated with the payload if present.
856856
857-
The boundary is extracted from the Content-Type header's `boundary'
857+
The boundary is extracted from the Content-Type header's 'boundary'
858858
parameter, and it is unquoted.
859859
"""
860860
missing = object()

Lib/email/mime/multipart.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
2121
Content-Type and MIME-Version headers.
2222
2323
_subtype is the subtype of the multipart content type, defaulting to
24-
`mixed'.
24+
'mixed'.
2525
2626
boundary is the multipart boundary string. By default it is
2727
calculated as needed.

0 commit comments

Comments
 (0)