Skip to content

Commit 678a269

Browse files
committed
Remove almost all unpaired backticks
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, error messages, etc. I've left ./configure and friends alone because that isn't going to impact downstream tools and feels like a lot of churn.
1 parent 642b25b commit 678a269

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+212
-212
lines changed

Doc/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ALLSPHINXOPTS = -b $(BUILDER) \
2828

2929
.PHONY: help
3030
help:
31-
@echo "Please use \`make <target>' where <target> is one of"
31+
@echo "Please use 'make <target>' where <target> is one of"
3232
@echo " clean to remove build files"
3333
@echo " venv to create a venv with necessary tools"
3434
@echo " html to make standalone HTML files"
@@ -90,7 +90,7 @@ htmlhelp: build
9090
latex: BUILDER = latex
9191
latex: build
9292
@echo "Build finished; the LaTeX files are in build/latex."
93-
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
93+
@echo "Run 'make all-pdf' or 'make all-ps' in that directory to" \
9494
"run these through (pdf)latex."
9595

9696
.PHONY: text
@@ -102,7 +102,7 @@ text: build
102102
texinfo: BUILDER = texinfo
103103
texinfo: build
104104
@echo "Build finished; the python.texi file is in build/texinfo."
105-
@echo "Run \`make info' in that directory to run it through makeinfo."
105+
@echo "Run 'make info' in that directory to run it through makeinfo."
106106

107107
.PHONY: epub
108108
epub: BUILDER = epub
@@ -167,7 +167,7 @@ clean-venv:
167167
venv:
168168
@if [ -d $(VENVDIR) ] ; then \
169169
echo "venv already exists."; \
170-
echo "To recreate it, remove it first with \`make clean-venv'."; \
170+
echo "To recreate it, remove it first with 'make clean-venv'."; \
171171
else \
172172
echo "Creating venv in $(VENVDIR)"; \
173173
$(PYTHON) -m venv $(VENVDIR); \

Include/internal/pycore_ceval.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ _PyEval_IsGILEnabled(PyThreadState *tstate)
152152
// Enable or disable the GIL used by the interpreter that owns tstate, which
153153
// must be the current thread. This may affect other interpreters, if the GIL
154154
// is shared. All three functions will be no-ops (and return 0) if the
155-
// interpreter's `enable_gil' config is not _PyConfig_GIL_DEFAULT.
155+
// interpreter's 'enable_gil' config is not _PyConfig_GIL_DEFAULT.
156156
//
157157
// Every call to _PyEval_EnableGILTransient() must be paired with exactly one
158158
// call to either _PyEval_EnableGILPermanent() or

Include/internal/pycore_obmalloc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ typedef unsigned int pymem_uint; /* assuming >= 16 bits */
163163
* things simpler, we assume that it is 4K, which is OK for most systems.
164164
* It is probably better if this is the native page size, but it doesn't
165165
* have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page
166-
* size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation
166+
* size, then 'POOL_ADDR(p)->arenaindex' could rarely cause a segmentation
167167
* violation fault. 4K is apparently OK for all the platforms that python
168168
* currently targets.
169169
*/

Lib/_pylong.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def inner(n, w):
285285
if w <= BYTELIM:
286286
# XXX Stefan Pochmann discovered that, for 1024-bit ints,
287287
# `int(Decimal)` took 2.5x longer than `int(str(Decimal))`.
288-
# Worse, `int(Decimal) is still quadratic-time for much
288+
# Worse, `int(Decimal)` is still quadratic-time for much
289289
# larger ints. So unless/until all that is repaired, the
290290
# seemingly redundant `str(Decimal)` is crucial to speed.
291291
result.extend(int(str(n)).to_bytes(w)) # big-endian default

Lib/_pyrepl/commands.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,13 @@ class invalid_key(Command):
437437
def do(self) -> None:
438438
pending = self.reader.console.getpending()
439439
s = "".join(self.event) + pending.data
440-
self.reader.error("`%r' not bound" % s)
440+
self.reader.error("'%r' not bound" % s)
441441

442442

443443
class invalid_command(Command):
444444
def do(self) -> None:
445445
s = self.event_name
446-
self.reader.error("command `%s' not known" % s)
446+
self.reader.error("command '%s' not known" % s)
447447

448448

449449
class show_history(Command):

Lib/_pyrepl/historical_reader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def prepare(self) -> None:
300300
def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
301301
if cursor_on_line and self.isearch_direction != ISEARCH_DIRECTION_NONE:
302302
d = "rf"[self.isearch_direction == ISEARCH_DIRECTION_FORWARDS]
303-
return "(%s-search `%s') " % (d, self.isearch_term)
303+
return "(%s-search '%s') " % (d, self.isearch_term)
304304
else:
305305
return super().get_prompt(lineno, cursor_on_line)
306306

Lib/_pyrepl/keymap.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
that if you can come up with a spec readline accepts that this
2929
doesn't, you've found a bug and should tell me about it).
3030
31-
Note that this is the `\\C-o' style of readline keyspec, not the
32-
`Control-o' sort.
31+
Note that this is the '\\C-o' style of readline keyspec, not the
32+
'Control-o' sort.
3333
3434
A keyspec is a string representing a sequence of keypresses that can
3535
be bound to a command.
@@ -42,14 +42,14 @@
4242
4343
Examples:
4444
45-
`a' - what you get when you hit the `a' key
46-
`\\EOA' - Escape - O - A (up, on my terminal)
47-
`\\<UP>' - the up arrow key
48-
`\\<up>' - ditto (keynames are case insensitive)
49-
`\\C-o', `\\c-o' - control-o
50-
`\\M-.' - meta-period
51-
`\\E.' - ditto (that's how meta works for pyrepl)
52-
`\\<tab>', `\\<TAB>', `\\t', `\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
45+
'a' - what you get when you hit the 'a' key
46+
'\\EOA' - Escape - O - A (up, on my terminal)
47+
'\\<UP>' - the up arrow key
48+
'\\<up>' - ditto (keynames are case insensitive)
49+
'\\C-o', '\\c-o' - control-o
50+
'\\M-.' - meta-period
51+
'\\E.' - ditto (that's how meta works for pyrepl)
52+
'\\<tab>', '\\<TAB>', '\\t', '\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
5353
- all of these are the tab character. Can you think of any more?
5454
"""
5555

@@ -124,7 +124,7 @@ def _parse_key1(key, s):
124124
elif c == "c":
125125
if key[s + 2] != "-":
126126
raise KeySpecError(
127-
"\\C must be followed by `-' (char %d of %s)"
127+
"\\C must be followed by '-' (char %d of %s)"
128128
% (s + 2, repr(key))
129129
)
130130
if ctrl:
@@ -136,7 +136,7 @@ def _parse_key1(key, s):
136136
elif c == "m":
137137
if key[s + 2] != "-":
138138
raise KeySpecError(
139-
"\\M must be followed by `-' (char %d of %s)"
139+
"\\M must be followed by '-' (char %d of %s)"
140140
% (s + 2, repr(key))
141141
)
142142
if meta:
@@ -163,7 +163,7 @@ def _parse_key1(key, s):
163163
ret = key[s + 2 : t].lower()
164164
if ret not in _keynames:
165165
raise KeySpecError(
166-
"unrecognised keyname `%s' at char %d of %s"
166+
"unrecognised keyname '%s' at char %d of %s"
167167
% (ret, s + 2, repr(key))
168168
)
169169
ret = _keynames[ret]

Lib/_pyrepl/reader.py

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

404404
def get_arg(self, default: int = 1) -> int:
405405
"""Return any prefix argument that the user has supplied,
406-
returning `default' if there is None. Defaults to 1.
406+
returning 'default' if there is None. Defaults to 1.
407407
"""
408408
if self.arg is None:
409409
return default
@@ -412,7 +412,7 @@ def get_arg(self, default: int = 1) -> int:
412412

413413
def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
414414
"""Return what should be in the left-hand margin for line
415-
`lineno'."""
415+
'lineno'."""
416416
if self.arg is not None and cursor_on_line:
417417
prompt = "(arg: %s) " % self.arg
418418
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/difflib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def get_matching_blocks(self):
444444
# This is most naturally expressed as a recursive algorithm, but
445445
# at least one user bumped into extreme use cases that exceeded
446446
# the recursion limit on their box. So, now we maintain a list
447-
# ('queue`) of blocks we still need to look at, and append partial
447+
# ('queue') of blocks we still need to look at, and append partial
448448
# results to `matching_blocks` in a loop; the matches are sorted
449449
# at the end.
450450
queue = [(0, la, 0, lb)]

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

0 commit comments

Comments
 (0)