Skip to content

Commit

Permalink
Remove almost all unpaired backticks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
geofft committed May 20, 2024
1 parent 642b25b commit de783c3
Show file tree
Hide file tree
Showing 69 changed files with 215 additions and 215 deletions.
8 changes: 4 additions & 4 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ALLSPHINXOPTS = -b $(BUILDER) \

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

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

.PHONY: epub
epub: BUILDER = epub
Expand Down Expand Up @@ -167,7 +167,7 @@ clean-venv:
venv:
@if [ -d $(VENVDIR) ] ; then \
echo "venv already exists."; \
echo "To recreate it, remove it first with \`make clean-venv'."; \
echo "To recreate it, remove it first with 'make clean-venv'."; \
else \
echo "Creating venv in $(VENVDIR)"; \
$(PYTHON) -m venv $(VENVDIR); \
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ _PyEval_IsGILEnabled(PyThreadState *tstate)
// Enable or disable the GIL used by the interpreter that owns tstate, which
// must be the current thread. This may affect other interpreters, if the GIL
// is shared. All three functions will be no-ops (and return 0) if the
// interpreter's `enable_gil' config is not _PyConfig_GIL_DEFAULT.
// interpreter's 'enable_gil' config is not _PyConfig_GIL_DEFAULT.
//
// Every call to _PyEval_EnableGILTransient() must be paired with exactly one
// call to either _PyEval_EnableGILPermanent() or
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_obmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ typedef unsigned int pymem_uint; /* assuming >= 16 bits */
* things simpler, we assume that it is 4K, which is OK for most systems.
* It is probably better if this is the native page size, but it doesn't
* have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page
* size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation
* size, then 'POOL_ADDR(p)->arenaindex' could rarely cause a segmentation
* violation fault. 4K is apparently OK for all the platforms that python
* currently targets.
*/
Expand Down
2 changes: 1 addition & 1 deletion Lib/_pylong.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def inner(n, w):
if w <= BYTELIM:
# XXX Stefan Pochmann discovered that, for 1024-bit ints,
# `int(Decimal)` took 2.5x longer than `int(str(Decimal))`.
# Worse, `int(Decimal) is still quadratic-time for much
# Worse, `int(Decimal)` is still quadratic-time for much
# larger ints. So unless/until all that is repaired, the
# seemingly redundant `str(Decimal)` is crucial to speed.
result.extend(int(str(n)).to_bytes(w)) # big-endian default
Expand Down
4 changes: 2 additions & 2 deletions Lib/_pyrepl/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,13 @@ class invalid_key(Command):
def do(self) -> None:
pending = self.reader.console.getpending()
s = "".join(self.event) + pending.data
self.reader.error("`%r' not bound" % s)
self.reader.error("'%r' not bound" % s)


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


class show_history(Command):
Expand Down
2 changes: 1 addition & 1 deletion Lib/_pyrepl/historical_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def prepare(self) -> None:
def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
if cursor_on_line and self.isearch_direction != ISEARCH_DIRECTION_NONE:
d = "rf"[self.isearch_direction == ISEARCH_DIRECTION_FORWARDS]
return "(%s-search `%s') " % (d, self.isearch_term)
return "(%s-search '%s') " % (d, self.isearch_term)
else:
return super().get_prompt(lineno, cursor_on_line)

Expand Down
26 changes: 13 additions & 13 deletions Lib/_pyrepl/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
that if you can come up with a spec readline accepts that this
doesn't, you've found a bug and should tell me about it).
Note that this is the `\\C-o' style of readline keyspec, not the
`Control-o' sort.
Note that this is the '\\C-o' style of readline keyspec, not the
'Control-o' sort.
A keyspec is a string representing a sequence of keypresses that can
be bound to a command.
Expand All @@ -42,14 +42,14 @@
Examples:
`a' - what you get when you hit the `a' key
`\\EOA' - Escape - O - A (up, on my terminal)
`\\<UP>' - the up arrow key
`\\<up>' - ditto (keynames are case insensitive)
`\\C-o', `\\c-o' - control-o
`\\M-.' - meta-period
`\\E.' - ditto (that's how meta works for pyrepl)
`\\<tab>', `\\<TAB>', `\\t', `\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
'a' - what you get when you hit the 'a' key
'\\EOA' - Escape - O - A (up, on my terminal)
'\\<UP>' - the up arrow key
'\\<up>' - ditto (keynames are case insensitive)
'\\C-o', '\\c-o' - control-o
'\\M-.' - meta-period
'\\E.' - ditto (that's how meta works for pyrepl)
'\\<tab>', '\\<TAB>', '\\t', '\\011', '\\x09', '\\X09', '\\C-i', '\\C-I'
- all of these are the tab character. Can you think of any more?
"""

Expand Down Expand Up @@ -124,7 +124,7 @@ def _parse_key1(key, s):
elif c == "c":
if key[s + 2] != "-":
raise KeySpecError(
"\\C must be followed by `-' (char %d of %s)"
"\\C must be followed by '-' (char %d of %s)"
% (s + 2, repr(key))
)
if ctrl:
Expand All @@ -136,7 +136,7 @@ def _parse_key1(key, s):
elif c == "m":
if key[s + 2] != "-":
raise KeySpecError(
"\\M must be followed by `-' (char %d of %s)"
"\\M must be followed by '-' (char %d of %s)"
% (s + 2, repr(key))
)
if meta:
Expand All @@ -163,7 +163,7 @@ def _parse_key1(key, s):
ret = key[s + 2 : t].lower()
if ret not in _keynames:
raise KeySpecError(
"unrecognised keyname `%s' at char %d of %s"
"unrecognised keyname '%s' at char %d of %s"
% (ret, s + 2, repr(key))
)
ret = _keynames[ret]
Expand Down
8 changes: 4 additions & 4 deletions Lib/_pyrepl/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ class Reader:
* console:
Hopefully encapsulates the OS dependent stuff.
* pos:
A 0-based index into `buffer' for where the insertion point
A 0-based index into 'buffer' for where the insertion point
is.
* screeninfo:
Ahem. This list contains some info needed to move the
insertion point around reasonably efficiently.
* cxy, lxy:
the position of the insertion point in screen ...
* syntax_table:
Dictionary mapping characters to `syntax class'; read the
Dictionary mapping characters to 'syntax class'; read the
emacs docs to see what this means :-)
* commands:
Dictionary mapping command names to command classes.
Expand Down Expand Up @@ -403,7 +403,7 @@ def max_row(self) -> int:

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

def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
"""Return what should be in the left-hand margin for line
`lineno'."""
'lineno'."""
if self.arg is not None and cursor_on_line:
prompt = "(arg: %s) " % self.arg
elif self.paste_mode:
Expand Down
24 changes: 12 additions & 12 deletions Lib/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
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
Expand All @@ -23,21 +23,21 @@
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
The data member 'self.ruler' sets the character used to draw separator lines
in the help messages. If empty, no ruler line is drawn. It defaults to "=".
If the value of `self.intro' is nonempty when the cmdloop method is called,
If the value of 'self.intro' is nonempty when the cmdloop method is called,
it is printed out on interpreter startup. This value may be overridden
via an optional argument to the cmdloop() method.
The data members `self.doc_header', `self.misc_header', and
`self.undoc_header' set the headers used for the help function's
The data members 'self.doc_header', 'self.misc_header', and
'self.undoc_header' set the headers used for the help function's
listings of documented functions, miscellaneous topics, and undocumented
functions respectively.
"""
Expand Down
2 changes: 1 addition & 1 deletion Lib/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ def write(self, fp, space_around_delimiters=True):
self._sections[section].items(), d)

def _write_section(self, fp, section_name, section_items, delimiter, unnamed=False):
"""Write a single section to the specified `fp'."""
"""Write a single section to the specified 'fp'."""
if not unnamed:
fp.write("[{}]\n".format(section_name))
for key, value in section_items:
Expand Down
2 changes: 1 addition & 1 deletion Lib/difflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def get_matching_blocks(self):
# This is most naturally expressed as a recursive algorithm, but
# at least one user bumped into extreme use cases that exceeded
# the recursion limit on their box. So, now we maintain a list
# ('queue`) of blocks we still need to look at, and append partial
# ('queue') of blocks we still need to look at, and append partial
# results to `matching_blocks` in a loop; the matches are sorted
# at the end.
queue = [(0, la, 0, lb)]
Expand Down
4 changes: 2 additions & 2 deletions Lib/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ class DocTestRunner:
`OutputChecker` to the constructor.
The test runner's display output can be controlled in two ways.
First, an output function (`out) can be passed to
First, an output function (`out`) can be passed to
`TestRunner.run`; this function will be called with strings that
should be displayed. It defaults to `sys.stdout.write`. If
capturing the output is not sufficient, then the display output
Expand Down Expand Up @@ -2734,7 +2734,7 @@ def testsource(module, name):
return testsrc

def debug_src(src, pm=False, globs=None):
"""Debug a single doctest docstring, in argument `src`'"""
"""Debug a single doctest docstring, in argument `src`"""
testsrc = script_from_examples(src)
debug_script(testsrc, pm, globs)

Expand Down
14 changes: 7 additions & 7 deletions Lib/email/_parseaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,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 = '()<>@,:;.\"[]'
Expand All @@ -233,7 +233,7 @@ def __init__(self, field):
self.CR = '\r\n'
self.FWS = self.LWS + self.CR
self.atomends = self.specials + self.LWS + self.CR
# Note that RFC 2822 now specifies `.' as obs-phrase, meaning that it
# Note that RFC 2822 now specifies '.' as obs-phrase, meaning that it
# is obsolete syntax. RFC 2822 requires that we recognize obsolete
# syntax, so allow dots in phrases.
self.phraseends = self.atomends.replace('.', '')
Expand Down Expand Up @@ -423,14 +423,14 @@ def getdomain(self):
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:
Expand Down Expand Up @@ -474,7 +474,7 @@ def getatom(self, atomends=None):
Optional atomends specifies a different set of end token delimiters
(the default is to use self.atomends). This is used e.g. in
getphraselist() since phrase endings must not include the `.' (which
getphraselist() since phrase endings must not include the '.' (which
is legal in phrases)."""
atomlist = ['']
if atomends is None:
Expand Down
2 changes: 1 addition & 1 deletion Lib/email/_policybase.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class Policy(_PolicyBase, metaclass=abc.ABCMeta):
wrapping is done. Default is 78.
mangle_from_ -- a flag that, when True escapes From_ lines in the
body of the message by putting a `>' in front of
body of the message by putting a '>' in front of
them. This is used when the message is being
serialized by a generator. Default: False.
Expand Down
2 changes: 1 addition & 1 deletion Lib/email/base64mime.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
with Base64 encoding.
RFC 2045 defines a method for including character set information in an
`encoded-word' in a header. This method is commonly used for 8-bit real names
'encoded-word' in a header. This method is commonly used for 8-bit real names
in To:, From:, Cc:, etc. fields, as well as Subject: lines.
This module does not do the line wrapping or end-of-line character conversion
Expand Down
4 changes: 2 additions & 2 deletions Lib/email/charset.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,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
Expand Down Expand Up @@ -245,7 +245,7 @@ def __eq__(self, other):
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
Expand Down
6 changes: 3 additions & 3 deletions Lib/email/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, *,
Optional mangle_from_ is a flag that, when True (the default if policy
is not set), escapes From_ lines in the body of the message by putting
a `>' in front of them.
a '>' in front of them.
Optional maxheaderlen specifies the longest length for a non-continued
header. When a header line is longer (in characters, with tabs
Expand Down Expand Up @@ -74,7 +74,7 @@ def flatten(self, msg, unixfrom=False, linesep=None):
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.
Expand Down Expand Up @@ -456,7 +456,7 @@ def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, fmt=None, *,
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
Expand Down
Loading

0 comments on commit de783c3

Please sign in to comment.