10000 Remove almost all unpaired backticks · geofft/cpython@678a269 · GitHub
[go: up one dir, main page]

Skip to content

Commit 678a269

Browse files
committed
Remove almost all unpaired backticks
As reported in python#117847 and python#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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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)
741A 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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 13 additions & 13 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 12 additions & 12 deletions
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

Lines changed: 1 addition & 1 deletion
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:

0 commit comments

Comments
 (0)
0