Skip to content

Commit 4346b81

Browse files
authored
[3.9] Fix typos in the Lib directory (GH-28775) (GH-28803)
Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <[email protected]> (cherry picked from commit 745c9d9) Automerge-Triggered-By: GH:JulienPalard
1 parent da56601 commit 4346b81

Some content is hidden

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

53 files changed

+67
-67
lines changed

Lib/asyncio/events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ async def connect_read_pipe(self, protocol_factory, pipe):
465465
# The reason to accept file-like object instead of just file descriptor
466466
# is: we need to own pipe and close it at transport finishing
467467
# Can got complicated errors if pass f.fileno(),
468-
# close fd in pipe transport then close f and vise versa.
468+
# close fd in pipe transport then close f and vice versa.
469469
raise NotImplementedError
470470

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

484484
async def subprocess_shell(self, protocol_factory, cmd, *,

Lib/asyncio/unix_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ def add_child_handler(self, pid, callback, *args):
13831383
def remove_child_handler(self, pid):
13841384
# asyncio never calls remove_child_handler() !!!
13851385
# The method is no-op but is implemented because
1386-
# abstract base classe requires it
1386+
# abstract base classes requires it
13871387
return True
13881388

13891389
def attach_loop(self, loop):

Lib/ctypes/_aix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def get_legacy(members):
163163
return member
164164
else:
165165
# 32-bit legacy names - both shr.o and shr4.o exist.
166-
# shr.o is the preffered name so we look for shr.o first
166+
# shr.o is the preferred name so we look for shr.o first
167167
# i.e., shr4.o is returned only when shr.o does not exist
168168
for name in ['shr.o', 'shr4.o']:
169169
member = get_one_match(re.escape(name), members)

Lib/ctypes/test/test_structures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,15 @@ def __del__(self):
443443

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

449449
dll = CDLL(_ctypes_test.__file__)
450450
func = dll._testfunc_large_struct_update_value
451451
func.argtypes = (Test,)
452452
func.restype = None
453453
func(s)
454-
# bpo-37140: Passing the structure by refrence must not call
454+
# bpo-37140: Passing the structure by reference must not call
455455
# its finalizer!
456456
self.assertEqual(finalizer_calls, [])
457457
self.assertEqual(s.first, 1)

Lib/difflib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class SequenceMatcher:
6262
notion, pairing up elements that appear uniquely in each sequence.
6363
That, and the method here, appear to yield more intuitive difference
6464
reports than does diff. This method appears to be the least vulnerable
65-
to synching up on blocks of "junk lines", though (like blank lines in
65+
to syncing up on blocks of "junk lines", though (like blank lines in
6666
ordinary text files, or maybe "<P>" lines in HTML files). That may be
6767
because this is the only method of the 3 that has a *concept* of
6868
"junk" <wink>.

Lib/distutils/ccompiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def _fix_compile_args(self, output_dir, macros, include_dirs):
392392
return output_dir, macros, include_dirs
393393

394394
def _prep_compile(self, sources, output_dir, depends=None):
395-
"""Decide which souce files must be recompiled.
395+
"""Decide which source files must be recompiled.
396396
397397
Determine the list of object files corresponding to 'sources',
398398
and figure out which ones really need to be recompiled.

Lib/html/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def parse_endtag(self, i):
405405
tagname = namematch.group(1).lower()
406406
# consume and ignore other stuff between the name and the >
407407
# Note: this is not 100% correct, since we might have things like
408-
# </tag attr=">">, but looking for > after tha name should cover
408+
# </tag attr=">">, but looking for > after the name should cover
409409
# most of the cases and is much simpler
410410
gtpos = rawdata.find('>', namematch.end())
411411
self.handle_endtag(tagname)

Lib/idlelib/ChangeLog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ Wed Mar 10 05:18:02 1999 Guido van Rossum <[email protected]>
11751175
classes in selected module
11761176
methods of selected class
11771177

1178-
Sinlge clicking in a directory, module or class item updates the next
1178+
Single clicking in a directory, module or class item updates the next
11791179
column with info about the selected item. Double clicking in a
11801180
module, class or method item opens the file (and selects the clicked
11811181
item if it is a class or method).

Lib/idlelib/idle_test/htest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def _wrapper(parent): # htest #
246246
_object_browser_spec = {
247247
'file': 'debugobj',
248248
'kwds': {},
249-
'msg': "Double click on items upto the lowest level.\n"
249+
'msg': "Double click on items up to the lowest level.\n"
250250
"Attributes of the objects and related information "
251251
"will be displayed side-by-side at each level."
252252
}
@@ -255,7 +255,7 @@ def _wrapper(parent): # htest #
255255
'file': 'pathbrowser',
256256
'kwds': {},
257257
'msg': "Test for correct display of all paths in sys.path.\n"
258-
"Toggle nested items upto the lowest level.\n"
258+
"Toggle nested items up to the lowest level.\n"
259259
"Double clicking on an item prints a traceback\n"
260260
"for an exception that is ignored."
261261
}
@@ -341,7 +341,7 @@ def _wrapper(parent): # htest #
341341
'file': 'tree',
342342
'kwds': {},
343343
'msg': "The canvas is scrollable.\n"
344-
"Click on folders upto to the lowest level."
344+
"Click on folders up to to the lowest level."
345345
}
346346

347347
_undo_delegator_spec = {

Lib/idlelib/idle_test/mock_tk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def tearDownClass(cls):
7979
---
8080
For 'ask' functions, set func.result return value before calling the method
8181
that uses the message function. When messagebox functions are the
82-
only gui alls in a method, this replacement makes the method gui-free,
82+
only GUI calls in a method, this replacement makes the method GUI-free,
8383
"""
8484
askokcancel = Mbox_func() # True or False
8585
askquestion = Mbox_func() # 'yes' or 'no'

Lib/idlelib/idle_test/test_multicall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_init(self):
3737

3838
def test_yview(self):
3939
# Added for tree.wheel_event
40-
# (it depends on yview to not be overriden)
40+
# (it depends on yview to not be overridden)
4141
mc = self.mc
4242
self.assertIs(mc.yview, Text.yview)
4343
mctext = self.mc(self.root)

Lib/idlelib/idle_test/test_pyparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def test_get_num_lines_in_stmt(self):
284284
tests = (
285285
TestInfo('[x for x in a]\n', 1), # Closed on one line.
286286
TestInfo('[x\nfor x in a\n', 2), # Not closed.
287-
TestInfo('[x\\\nfor x in a\\\n', 2), # "", uneeded backslashes.
287+
TestInfo('[x\\\nfor x in a\\\n', 2), # "", unneeded backslashes.
288288
TestInfo('[x\nfor x in a\n]\n', 3), # Closed on multi-line.
289289
TestInfo('\n"""Docstring comment L1"""\nL2\nL3\nL4\n', 1),
290290
TestInfo('\n"""Docstring comment L1\nL2"""\nL3\nL4\n', 1),

Lib/lib2to3/fixes/fix_metaclass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def fixup_parse_tree(cls_node):
5151
# already in the preferred format, do nothing
5252
return
5353

54-
# !%@#! oneliners have no suite node, we have to fake one up
54+
# !%@#! one-liners have no suite node, we have to fake one up
5555
for i, node in enumerate(cls_node.children):
5656
if node.type == token.COLON:
5757
break

Lib/lib2to3/fixes/fix_paren.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Fixer that addes parentheses where they are required
1+
"""Fixer that adds parentheses where they are required
22
33
This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``."""
44

Lib/linecache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def lazycache(filename, module_globals):
154154
155155
:return: True if a lazy load is registered in the cache,
156156
otherwise False. To register such a load a module loader with a
157-
get_source method must be found, the filename must be a cachable
157+
get_source method must be found, the filename must be a cacheable
158158
filename, and the filename must not be already cached.
159159
"""
160160
if filename in cache:

Lib/pickle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ def __init__(self, file, *, fix_imports=True,
11721172
used in Python 3. The *encoding* and *errors* tell pickle how
11731173
to decode 8-bit string instances pickled by Python 2; these
11741174
default to 'ASCII' and 'strict', respectively. *encoding* can be
1175-
'bytes' to read theses 8-bit string instances as bytes objects.
1175+
'bytes' to read these 8-bit string instances as bytes objects.
11761176
"""
11771177
self._buffers = iter(buffers) if buffers is not None else None
11781178
self._file_readline = file.readline

Lib/sqlite3/test/dbapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#-*- coding: iso-8859-1 -*-
22
# pysqlite2/test/dbapi.py: tests for DB-API compliance
33
#
4-
# Copyright (C) 2004-2010 Gerhard Häring <[email protected]>
4+
# Copyright (C) 2004-2010 Gerhard Häring <[email protected]>
55
#
66
# This file is part of pysqlite.
77
#
@@ -451,7 +451,7 @@ def CheckFetchoneNoStatement(self):
451451
self.assertEqual(row, None)
452452

453453
def CheckArraySize(self):
454-
# must default ot 1
454+
# must default to 1
455455
self.assertEqual(self.cu.arraysize, 1)
456456

457457
# now set to 2

Lib/test/datetimetester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4064,7 +4064,7 @@ def test_even_more_compare(self):
40644064
self.assertEqual(t1, t1)
40654065
self.assertEqual(t2, t2)
40664066

4067-
# Equal afer adjustment.
4067+
# Equal after adjustment.
40684068
t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""))
40694069
t2 = self.theclass(2, 1, 1, 3, 13, tzinfo=FixedOffset(3*60+13+2, ""))
40704070
self.assertEqual(t1, t2)
@@ -4903,7 +4903,7 @@ def test_easy(self):
49034903
# OTOH, these fail! Don't enable them. The difficulty is that
49044904
# the edge case tests assume that every hour is representable in
49054905
# the "utc" class. This is always true for a fixed-offset tzinfo
4906-
# class (lke utc_real and utc_fake), but not for Eastern or Central.
4906+
# class (like utc_real and utc_fake), but not for Eastern or Central.
49074907
# For these adjacent DST-aware time zones, the range of time offsets
49084908
# tested ends up creating hours in the one that aren't representable
49094909
# in the other. For the same reason, we would see failures in the

Lib/test/decimaltestdata/abs.decTest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
version: 2.59
2121

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

2626
precision: 9

Lib/test/decimaltestdata/extra.decTest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ extr1302 fma -Inf 0E-456 sNaN148 -> NaN Invalid_operation
156156

157157
-- max/min/max_mag/min_mag bug in 2.5.2/2.6/3.0: max(NaN, finite) gave
158158
-- incorrect answers when the finite number required rounding; similarly
159-
-- for the other thre functions
159+
-- for the other three functions
160160
maxexponent: 999
161161
minexponent: -999
162162
precision: 6

Lib/test/libregrtest/refleak.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def get_pooled_int(value):
109109

110110
# These checkers return False on success, True on failure
111111
def check_rc_deltas(deltas):
112-
# Checker for reference counters and memomry blocks.
112+
# Checker for reference counters and memory blocks.
113113
#
114114
# bpo-30776: Try to ignore false positives:
115115
#

Lib/test/pickletester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3711,7 +3711,7 @@ class MyClass:
37113711

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

37333733
for proto in range(0, pickle.HIGHEST_PROTOCOL + 1):
37343734
with self.subTest(proto=proto):

Lib/test/test__xxsubinterpreters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ def test_channel_list_interpreters_basic(self):
12311231
import _xxsubinterpreters as _interpreters
12321232
obj = _interpreters.channel_recv({cid})
12331233
"""))
1234-
# Test for channel that has boths ends associated to an interpreter.
1234+
# Test for channel that has both ends associated to an interpreter.
12351235
send_interps = interpreters.channel_list_interpreters(cid, send=True)
12361236
recv_interps = interpreters.channel_list_interpreters(cid, send=False)
12371237
self.assertEqual(send_interps, [interp0])

Lib/test/test_asyncio/test_streams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def test_read_all_from_pipe_reader(self):
736736
# See asyncio issue 168. This test is derived from the example
737737
# subprocess_attach_read_pipe.py, but we configure the
738738
# StreamReader's limit so that twice it is less than the size
739-
# of the data writter. Also we must explicitly attach a child
739+
# of the data writer. Also we must explicitly attach a child
740740
# watcher to the event loop.
741741

742742
code = """\

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def prepare_broken_pipe_test(self):
227227
# buffer large enough to feed the whole pipe buffer
228228
large_data = b'x' * support.PIPE_MAX_SIZE
229229

230-
# the program ends before the stdin can be feeded
230+
# the program ends before the stdin can be fed
231231
proc = self.loop.run_until_complete(
232232
asyncio.create_subprocess_exec(
233233
sys.executable, '-c', 'pass',

Lib/test/test_asyncio/test_tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3568,15 +3568,15 @@ def test_run_coroutine_threadsafe_with_timeout(self):
35683568
self.assertTrue(task.done())
35693569

35703570
def test_run_coroutine_threadsafe_task_cancelled(self):
3571-
"""Test coroutine submission from a tread to an event loop
3571+
"""Test coroutine submission from a thread to an event loop
35723572
when the task is cancelled."""
35733573
callback = lambda: self.target(cancel=True)
35743574
future = self.loop.run_in_executor(None, callback)
35753575
with self.assertRaises(asyncio.CancelledError):
35763576
self.loop.run_until_complete(future)
35773577

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

35823582
def task_factory(loop, coro):

Lib/test/test_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ def assertSameSet(self, s1, s2):
15841584
self.assertSetEqual(set(s1), set(s2))
15851585

15861586
def test_Set_from_iterable(self):
1587-
"""Verify _from_iterable overriden to an instance method works."""
1587+
"""Verify _from_iterable overridden to an instance method works."""
15881588
class SetUsingInstanceFromIterable(MutableSet):
15891589
def __init__(self, values, created_by):
15901590
if not created_by:

Lib/test/test_descr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5672,7 +5672,7 @@ class A(metaclass=M):
56725672

56735673
def test_incomplete_super(self):
56745674
"""
5675-
Attrubute lookup on a super object must be aware that
5675+
Attribute lookup on a super object must be aware that
56765676
its target type can be uninitialized (type->tp_mro == NULL).
56775677
"""
56785678
class M(DebugHelperMeta):

Lib/test/test_dict.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ def test_splittable_pop(self):
10211021

10221022
@support.cpython_only
10231023
def test_splittable_pop_pending(self):
1024-
"""pop a pending key in a splitted table should not crash"""
1024+
"""pop a pending key in a split table should not crash"""
10251025
a, b = self.make_shared_key_dict(2)
10261026

10271027
a['a'] = 4
@@ -1368,7 +1368,7 @@ def test_reversed(self):
13681368
self.assertRaises(StopIteration, next, r)
13691369

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

13731373
# empty dict is directly used for reference count test
13741374
self.assertEqual(list(reversed({})), [])

Lib/test/test_dict_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Test implementation of the PEP 509: dictionary versionning.
2+
Test implementation of the PEP 509: dictionary versioning.
33
"""
44
import unittest
55
from test import support

Lib/test/test_dtrace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def normalize_trace_output(output):
3434
return "\n".join(result)
3535
except (IndexError, ValueError):
3636
raise AssertionError(
37-
"tracer produced unparseable output:\n{}".format(output)
37+
"tracer produced unparsable output:\n{}".format(output)
3838
)
3939

4040

Lib/test/test_email/test_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ class TestEmailMessageBase:
433433
--===
434434
Content-Type: text/plain
435435
436-
Your message has bounced, ser.
436+
Your message has bounced, sir.
437437
438438
--===
439439
Content-Type: message/rfc822

Lib/test/test_embed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_forced_io_encoding(self):
247247

248248
def test_pre_initialization_api(self):
249249
"""
250-
Checks some key parts of the C-API that need to work before the runtine
250+
Checks some key parts of the C-API that need to work before the runtime
251251
is initialized (via Py_Initialize()).
252252
"""
253253
env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
@@ -1106,7 +1106,7 @@ def test_init_setpath_config(self):
11061106
'base_prefix': '',
11071107
'exec_prefix': '',
11081108
'base_exec_prefix': '',
1109-
# overriden by PyConfig
1109+
# overridden by PyConfig
11101110
'program_name': 'conf_program_name',
11111111
'base_executable': 'conf_executable',
11121112
'executable': 'conf_executable',

Lib/test/test_future.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_annotations(self):
322322

323323
def test_fstring_debug_annotations(self):
324324
# f-strings with '=' don't round trip very well, so set the expected
325-
# result explicitely.
325+
# result explicitly.
326326
self.assertAnnotationEqual("f'{x=!r}'", expected="f'x={x!r}'")
327327
self.assertAnnotationEqual("f'{x=:}'", expected="f'x={x:}'")
328328
self.assertAnnotationEqual("f'{x=:.2f}'", expected="f'x={x:.2f}'")

Lib/test/test_lltrace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def test_lltrace_does_not_crash_on_subscript_operator(self):
1212
# If this test fails, it will reproduce a crash reported as
1313
# bpo-34113. The crash happened at the command line console of
1414
# debug Python builds with __ltrace__ enabled (only possible in console),
15-
# when the interal Python stack was negatively adjusted
15+
# when the internal Python stack was negatively adjusted
1616
with open(support.TESTFN, 'w') as fd:
1717
self.addCleanup(os.unlink, support.TESTFN)
1818
fd.write(textwrap.dedent("""\

0 commit comments

Comments
 (0)