Skip to content

[3.9] Fix typos in the Lib directory (GH-28775) #28803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/asyncio/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ async def connect_read_pipe(self, protocol_factory, pipe):
# The reason to accept file-like object instead of just file descriptor
# is: we need to own pipe and close it at transport finishing
# Can got complicated errors if pass f.fileno(),
# close fd in pipe transport then close f and vise versa.
# close fd in pipe transport then close f and vice versa.
raise NotImplementedError

async def connect_write_pipe(self, protocol_factory, pipe):
Expand All @@ -478,7 +478,7 @@ async def connect_write_pipe(self, protocol_factory, pipe):
# The reason to accept file-like object instead of just file descriptor
# is: we need to own pipe and close it at transport finishing
# Can got complicated errors if pass f.fileno(),
# close fd in pipe transport then close f and vise versa.
# close fd in pipe transport then close f and vice versa.
raise NotImplementedError

async def subprocess_shell(self, protocol_factory, cmd, *,
Expand Down
2 changes: 1 addition & 1 deletion Lib/asyncio/unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ def add_child_handler(self, pid, callback, *args):
def remove_child_handler(self, pid):
# asyncio never calls remove_child_handler() !!!
# The method is no-op but is implemented because
# abstract base classe requires it
# abstract base classes requires it
return True

def attach_loop(self, loop):
Expand Down
2 changes: 1 addition & 1 deletion Lib/ctypes/_aix.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_legacy(members):
return member
else:
# 32-bit legacy names - both shr.o and shr4.o exist.
# shr.o is the preffered name so we look for shr.o first
# shr.o is the preferred name so we look for shr.o first
# i.e., shr4.o is returned only when shr.o does not exist
for name in ['shr.o', 'shr4.o']:
member = get_one_match(re.escape(name), members)
Expand Down
4 changes: 2 additions & 2 deletions Lib/ctypes/test/test_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ def __del__(self):

s = Test(1, 2, 3)
# Test the StructUnionType_paramfunc() code path which copies the
# structure: if the stucture is larger than sizeof(void*).
# structure: if the structure is larger than sizeof(void*).
self.assertGreater(sizeof(s), sizeof(c_void_p))

dll = CDLL(_ctypes_test.__file__)
func = dll._testfunc_large_struct_update_value
func.argtypes = (Test,)
func.restype = None
func(s)
# bpo-37140: Passing the structure by refrence must not call
# bpo-37140: Passing the structure by reference must not call
# its finalizer!
self.assertEqual(finalizer_calls, [])
self.assertEqual(s.first, 1)
Expand Down
2 changes: 1 addition & 1 deletion Lib/difflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SequenceMatcher:
notion, pairing up elements that appear uniquely in each sequence.
That, and the method here, appear to yield more intuitive difference
reports than does diff. This method appears to be the least vulnerable
to synching up on blocks of "junk lines", though (like blank lines in
to syncing up on blocks of "junk lines", though (like blank lines in
ordinary text files, or maybe "<P>" lines in HTML files). That may be
because this is the only method of the 3 that has a *concept* of
"junk" <wink>.
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _fix_compile_args(self, output_dir, macros, include_dirs):
return output_dir, macros, include_dirs

def _prep_compile(self, sources, output_dir, depends=None):
"""Decide which souce files must be recompiled.
"""Decide which source files must be recompiled.

Determine the list of object files corresponding to 'sources',
and figure out which ones really need to be recompiled.
Expand Down
2 changes: 1 addition & 1 deletion Lib/html/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def parse_endtag(self, i):
tagname = namematch.group(1).lower()
# consume and ignore other stuff between the name and the >
# Note: this is not 100% correct, since we might have things like
# </tag attr=">">, but looking for > after tha name should cover
# </tag attr=">">, but looking for > after the name should cover
# most of the cases and is much simpler
gtpos = rawdata.find('>', namematch.end())
self.handle_endtag(tagname)
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ Wed Mar 10 05:18:02 1999 Guido van Rossum <[email protected]>
classes in selected module
methods of selected class

Sinlge clicking in a directory, module or class item updates the next
Single clicking in a directory, module or class item updates the next
column with info about the selected item. Double clicking in a
module, class or method item opens the file (and selects the clicked
item if it is a class or method).
Expand Down
6 changes: 3 additions & 3 deletions Lib/idlelib/idle_test/htest.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _wrapper(parent): # htest #
_object_browser_spec = {
'file': 'debugobj',
'kwds': {},
'msg': "Double click on items upto the lowest level.\n"
'msg': "Double click on items up to the lowest level.\n"
"Attributes of the objects and related information "
"will be displayed side-by-side at each level."
}
Expand All @@ -255,7 +255,7 @@ def _wrapper(parent): # htest #
'file': 'pathbrowser',
'kwds': {},
'msg': "Test for correct display of all paths in sys.path.\n"
"Toggle nested items upto the lowest level.\n"
"Toggle nested items up to the lowest level.\n"
"Double clicking on an item prints a traceback\n"
"for an exception that is ignored."
}
Expand Down Expand Up @@ -341,7 +341,7 @@ def _wrapper(parent): # htest #
'file': 'tree',
'kwds': {},
'msg': "The canvas is scrollable.\n"
"Click on folders upto to the lowest level."
"Click on folders up to to the lowest level."
}

_undo_delegator_spec = {
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/idle_test/mock_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def tearDownClass(cls):
---
For 'ask' functions, set func.result return value before calling the method
that uses the message function. When messagebox functions are the
only gui alls in a method, this replacement makes the method gui-free,
only GUI calls in a method, this replacement makes the method GUI-free,
"""
askokcancel = Mbox_func() # True or False
askquestion = Mbox_func() # 'yes' or 'no'
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/idle_test/test_multicall.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_init(self):

def test_yview(self):
# Added for tree.wheel_event
# (it depends on yview to not be overriden)
# (it depends on yview to not be overridden)
mc = self.mc
self.assertIs(mc.yview, Text.yview)
mctext = self.mc(self.root)
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/idle_test/test_pyparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_get_num_lines_in_stmt(self):
tests = (
TestInfo('[x for x in a]\n', 1), # Closed on one line.
TestInfo('[x\nfor x in a\n', 2), # Not closed.
TestInfo('[x\\\nfor x in a\\\n', 2), # "", uneeded backslashes.
TestInfo('[x\\\nfor x in a\\\n', 2), # "", unneeded backslashes.
TestInfo('[x\nfor x in a\n]\n', 3), # Closed on multi-line.
TestInfo('\n"""Docstring comment L1"""\nL2\nL3\nL4\n', 1),
TestInfo('\n"""Docstring comment L1\nL2"""\nL3\nL4\n', 1),
Expand Down
2 changes: 1 addition & 1 deletion Lib/lib2to3/fixes/fix_metaclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def fixup_parse_tree(cls_node):
# already in the preferred format, do nothing
return

# !%@#! oneliners have no suite node, we have to fake one up
# !%@#! one-liners have no suite node, we have to fake one up
for i, node in enumerate(cls_node.children):
if node.type == token.COLON:
break
Expand Down
2 changes: 1 addition & 1 deletion Lib/lib2to3/fixes/fix_paren.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Fixer that addes parentheses where they are required
"""Fixer that adds parentheses where they are required

This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``."""

Expand Down
2 changes: 1 addition & 1 deletion Lib/linecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def lazycache(filename, module_globals):

:return: True if a lazy load is registered in the cache,
otherwise False. To register such a load a module loader with a
get_source method must be found, the filename must be a cachable
get_source method must be found, the filename must be a cacheable
filename, and the filename must not be already cached.
"""
if filename in cache:
Expand Down
2 changes: 1 addition & 1 deletion Lib/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ def __init__(self, file, *, fix_imports=True,
used in Python 3. The *encoding* and *errors* tell pickle how
to decode 8-bit string instances pickled by Python 2; these
default to 'ASCII' and 'strict', respectively. *encoding* can be
'bytes' to read theses 8-bit string instances as bytes objects.
'bytes' to read these 8-bit string instances as bytes objects.
"""
self._buffers = iter(buffers) if buffers is not None else None
self._file_readline = file.readline
Expand Down
4 changes: 2 additions & 2 deletions Lib/sqlite3/test/dbapi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#-*- coding: iso-8859-1 -*-
# pysqlite2/test/dbapi.py: tests for DB-API compliance
#
# Copyright (C) 2004-2010 Gerhard H�ring <[email protected]>
# Copyright (C) 2004-2010 Gerhard Häring <[email protected]>
#
# This file is part of pysqlite.
#
Expand Down Expand Up @@ -451,7 +451,7 @@ def CheckFetchoneNoStatement(self):
self.assertEqual(row, None)

def CheckArraySize(self):
# must default ot 1
# must default to 1
self.assertEqual(self.cu.arraysize, 1)

# now set to 2
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -4064,7 +4064,7 @@ def test_even_more_compare(self):
self.assertEqual(t1, t1)
self.assertEqual(t2, t2)

# Equal afer adjustment.
# Equal after adjustment.
t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""))
t2 = self.theclass(2, 1, 1, 3, 13, tzinfo=FixedOffset(3*60+13+2, ""))
self.assertEqual(t1, t2)
Expand Down Expand Up @@ -4903,7 +4903,7 @@ def test_easy(self):
# OTOH, these fail! Don't enable them. The difficulty is that
# the edge case tests assume that every hour is representable in
# the "utc" class. This is always true for a fixed-offset tzinfo
# class (lke utc_real and utc_fake), but not for Eastern or Central.
# class (like utc_real and utc_fake), but not for Eastern or Central.
# For these adjacent DST-aware time zones, the range of time offsets
# tested ends up creating hours in the one that aren't representable
# in the other. For the same reason, we would see failures in the
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/decimaltestdata/abs.decTest
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
version: 2.59

-- This set of tests primarily tests the existence of the operator.
-- Additon, subtraction, rounding, and more overflows are tested
-- Addition, subtraction, rounding, and more overflows are tested
-- elsewhere.

precision: 9
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/decimaltestdata/extra.decTest
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ extr1302 fma -Inf 0E-456 sNaN148 -> NaN Invalid_operation

-- max/min/max_mag/min_mag bug in 2.5.2/2.6/3.0: max(NaN, finite) gave
-- incorrect answers when the finite number required rounding; similarly
-- for the other thre functions
-- for the other three functions
maxexponent: 999
minexponent: -999
precision: 6
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/libregrtest/refleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_pooled_int(value):

# These checkers return False on success, True on failure
def check_rc_deltas(deltas):
# Checker for reference counters and memomry blocks.
# Checker for reference counters and memory blocks.
#
# bpo-30776: Try to ignore false positives:
#
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/pickletester.py
Original file line number Diff line number Diff line change
Expand Up @@ -3711,7 +3711,7 @@ class MyClass:

self.assertEqual(new_f, 5)
self.assertEqual(some_str, 'some str')
# math.log does not have its usual reducer overriden, so the
# math.log does not have its usual reducer overridden, so the
# custom reduction callback should silently direct the pickler
# to the default pickling by attribute, by returning
# NotImplemented
Expand All @@ -3728,7 +3728,7 @@ class MyClass:
def test_reducer_override_no_reference_cycle(self):
# bpo-39492: reducer_override used to induce a spurious reference cycle
# inside the Pickler object, that could prevent all serialized objects
# from being garbage-collected without explicity invoking gc.collect.
# from being garbage-collected without explicitly invoking gc.collect.

for proto in range(0, pickle.HIGHEST_PROTOCOL + 1):
with self.subTest(proto=proto):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test__xxsubinterpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ def test_channel_list_interpreters_basic(self):
import _xxsubinterpreters as _interpreters
obj = _interpreters.channel_recv({cid})
"""))
# Test for channel that has boths ends associated to an interpreter.
# Test for channel that has both ends associated to an interpreter.
send_interps = interpreters.channel_list_interpreters(cid, send=True)
recv_interps = interpreters.channel_list_interpreters(cid, send=False)
self.assertEqual(send_interps, [interp0])
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def test_read_all_from_pipe_reader(self):
# See asyncio issue 168. This test is derived from the example
# subprocess_attach_read_pipe.py, but we configure the
# StreamReader's limit so that twice it is less than the size
# of the data writter. Also we must explicitly attach a child
# of the data writer. Also we must explicitly attach a child
# watcher to the event loop.

code = """\
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def prepare_broken_pipe_test(self):
# buffer large enough to feed the whole pipe buffer
large_data = b'x' * support.PIPE_MAX_SIZE

# the program ends before the stdin can be feeded
# the program ends before the stdin can be fed
proc = self.loop.run_until_complete(
asyncio.create_subprocess_exec(
sys.executable, '-c', 'pass',
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_asyncio/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3568,15 +3568,15 @@ def test_run_coroutine_threadsafe_with_timeout(self):
self.assertTrue(task.done())

def test_run_coroutine_threadsafe_task_cancelled(self):
"""Test coroutine submission from a tread to an event loop
"""Test coroutine submission from a thread to an event loop
when the task is cancelled."""
callback = lambda: self.target(cancel=True)
future = self.loop.run_in_executor(None, callback)
with self.assertRaises(asyncio.CancelledError):
self.loop.run_until_complete(future)

def test_run_coroutine_threadsafe_task_factory_exception(self):
"""Test coroutine submission from a tread to an event loop
"""Test coroutine submission from a thread to an event loop
when the task factory raise an exception."""

def task_factory(loop, coro):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ def assertSameSet(self, s1, s2):
self.assertSetEqual(set(s1), set(s2))

def test_Set_from_iterable(self):
"""Verify _from_iterable overriden to an instance method works."""
"""Verify _from_iterable overridden to an instance method works."""
class SetUsingInstanceFromIterable(MutableSet):
def __init__(self, values, created_by):
if not created_by:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5672,7 +5672,7 @@ class A(metaclass=M):

def test_incomplete_super(self):
"""
Attrubute lookup on a super object must be aware that
Attribute lookup on a super object must be aware that
its target type can be uninitialized (type->tp_mro == NULL).
"""
class M(DebugHelperMeta):
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ def test_splittable_pop(self):

@support.cpython_only
def test_splittable_pop_pending(self):
"""pop a pending key in a splitted table should not crash"""
"""pop a pending key in a split table should not crash"""
a, b = self.make_shared_key_dict(2)

a['a'] = 4
Expand Down Expand Up @@ -1368,7 +1368,7 @@ def test_reversed(self):
self.assertRaises(StopIteration, next, r)

def test_reverse_iterator_for_empty_dict(self):
# bpo-38525: revered iterator should work properly
# bpo-38525: reversed iterator should work properly

# empty dict is directly used for reference count test
self.assertEqual(list(reversed({})), [])
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dict_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Test implementation of the PEP 509: dictionary versionning.
Test implementation of the PEP 509: dictionary versioning.
"""
import unittest
from test import support
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dtrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def normalize_trace_output(output):
return "\n".join(result)
except (IndexError, ValueError):
raise AssertionError(
"tracer produced unparseable output:\n{}".format(output)
"tracer produced unparsable output:\n{}".format(output)
)


Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_email/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class TestEmailMessageBase:
--===
Content-Type: text/plain

Your message has bounced, ser.
Your message has bounced, sir.

--===
Content-Type: message/rfc822
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def test_forced_io_encoding(self):

def test_pre_initialization_api(self):
"""
Checks some key parts of the C-API that need to work before the runtine
Checks some key parts of the C-API that need to work before the runtime
is initialized (via Py_Initialize()).
"""
env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
Expand Down Expand Up @@ -1106,7 +1106,7 @@ def test_init_setpath_config(self):
'base_prefix': '',
'exec_prefix': '',
'base_exec_prefix': '',
# overriden by PyConfig
# overridden by PyConfig
'program_name': 'conf_program_name',
'base_executable': 'conf_executable',
'executable': 'conf_executable',
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def test_annotations(self):

def test_fstring_debug_annotations(self):
# f-strings with '=' don't round trip very well, so set the expected
# result explicitely.
# result explicitly.
self.assertAnnotationEqual("f'{x=!r}'", expected="f'x={x!r}'")
self.assertAnnotationEqual("f'{x=:}'", expected="f'x={x:}'")
self.assertAnnotationEqual("f'{x=:.2f}'", expected="f'x={x:.2f}'")
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_lltrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_lltrace_does_not_crash_on_subscript_operator(self):
# If this test fails, it will reproduce a crash reported as
# bpo-34113. The crash happened at the command line console of
# debug Python builds with __ltrace__ enabled (only possible in console),
# when the interal Python stack was negatively adjusted
# when the internal Python stack was negatively adjusted
with open(support.TESTFN, 'w') as fd:
self.addCleanup(os.unlink, support.TESTFN)
fd.write(textwrap.dedent("""\
Expand Down
Loading