Skip to content

Commit 745c9d9

Browse files
cclaussterryjreedy
andauthored
Fix typos in the Lib directory (GH-28775)
Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent db693df commit 745c9d9

Some content is hidden

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

64 files changed

+83
-83
lines changed

Lib/asyncio/events.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ async def connect_read_pipe(self, protocol_factory, pipe):
479479
# The reason to accept file-like object instead of just file descriptor
480480
# is: we need to own pipe and close it at transport finishing
481481
# Can got complicated errors if pass f.fileno(),
482-
# close fd in pipe transport then close f and vise versa.
482+
# close fd in pipe transport then close f and vice versa.
483483
raise NotImplementedError
484484

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

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

Lib/asyncio/unix_events.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ def add_child_handler(self, pid, callback, *args):
13791379
def remove_child_handler(self, pid):
13801380
# asyncio never calls remove_child_handler() !!!
13811381
# The method is no-op but is implemented because
1382-
# abstract base classe requires it
1382+
# abstract base classes requires it
13831383
return True
13841384

13851385
def attach_loop(self, loop):

Lib/ctypes/_aix.py

+1-1
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

+2-2
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

+1-1
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

+1-1
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/distutils/command/install.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# while making the sysconfig module the single point of truth.
3232
# This makes it easier for OS distributions where they need to
3333
# alter locations for packages installations in a single place.
34-
# Note that this module is depracated (PEP 632); all consumers
34+
# Note that this module is deprecated (PEP 632); all consumers
3535
# of this information should switch to using sysconfig directly.
3636
INSTALL_SCHEMES = {"unix_prefix": {}, "unix_home": {}, "nt": {}}
3737

@@ -43,7 +43,7 @@
4343
sys_key = key
4444
sys_scheme = sysconfig._INSTALL_SCHEMES[sys_scheme_name]
4545
if key == "headers" and key not in sys_scheme:
46-
# On POSIX-y platofrms, Python will:
46+
# On POSIX-y platforms, Python will:
4747
# - Build from .h files in 'headers' (only there when
4848
# building CPython)
4949
# - Install .h files to 'include'

Lib/email/errors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ class NonASCIILocalPartDefect(HeaderDefect):
110110
# parsing messages decoded from binary.
111111

112112
class InvalidDateDefect(HeaderDefect):
113-
"""Header has unparseable or invalid date"""
113+
"""Header has unparsable or invalid date"""

Lib/html/parser.py

+1-1
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

+1-1
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

+3-3
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

+1-1
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

+1-1
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

+1-1
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/importlib/_adapters.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def _io_wrapper(file, mode='r', *args, **kwargs):
4141

4242
class CompatibilityFiles:
4343
"""
44-
Adapter for an existing or non-existant resource reader
45-
to provide a compability .files().
44+
Adapter for an existing or non-existent resource reader
45+
to provide a compatibility .files().
4646
"""
4747

4848
class SpecPath(abc.Traversable):
@@ -83,7 +83,7 @@ def open(self, mode='r', *args, **kwargs):
8383
class ChildPath(abc.Traversable):
8484
"""
8585
Path tied to a resource reader child.
86-
Can be read but doesn't expose any meaningfull children.
86+
Can be read but doesn't expose any meaningful children.
8787
"""
8888

8989
def __init__(self, reader, name):

Lib/lib2to3/fixes/fix_metaclass.py

+1-1
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

+1-1
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

+1-1
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

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

Lib/platform.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ def platform(aliased=0, terse=0):
12611261

12621262
def _parse_os_release(lines):
12631263
# These fields are mandatory fields with well-known defaults
1264-
# in pratice all Linux distributions override NAME, ID, and PRETTY_NAME.
1264+
# in practice all Linux distributions override NAME, ID, and PRETTY_NAME.
12651265
info = {
12661266
"NAME": "Linux",
12671267
"ID": "linux",

Lib/sqlite3/test/test_dbapi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ def test_fetchone_no_statement(self):
616616
self.assertEqual(row, None)
617617

618618
def test_array_size(self):
619-
# must default ot 1
619+
# must default to 1
620620
self.assertEqual(self.cu.arraysize, 1)
621621

622622
# now set to 2

Lib/sysconfig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def is_python_build(check_home=False):
184184

185185
if _PYTHON_BUILD:
186186
for scheme in ('posix_prefix', 'posix_home'):
187-
# On POSIX-y platofrms, Python will:
187+
# On POSIX-y platforms, Python will:
188188
# - Build from .h files in 'headers' (which is only added to the
189189
# scheme when building CPython)
190190
# - Install .h files to 'include'

Lib/test/datetimetester.py

+2-2
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

+1-1
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

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def get_pooled_int(value):
114114

115115
# These checkers return False on success, True on failure
116116
def check_rc_deltas(deltas):
117-
# Checker for reference counters and memomry blocks.
117+
# Checker for reference counters and memory blocks.
118118
#
119119
# bpo-30776: Try to ignore false positives:
120120
#

Lib/test/pickletester.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3723,7 +3723,7 @@ class MyClass:
37233723

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

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

Lib/test/support/threading_helper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class catch_threading_exception:
157157
Context manager catching threading.Thread exception using
158158
threading.excepthook.
159159
160-
Attributes set when an exception is catched:
160+
Attributes set when an exception is caught:
161161
162162
* exc_type
163163
* exc_value

Lib/test/test__xxsubinterpreters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ def test_channel_list_interpreters_basic(self):
12211221
import _xxsubinterpreters as _interpreters
12221222
obj = _interpreters.channel_recv({cid})
12231223
"""))
1224-
# Test for channel that has boths ends associated to an interpreter.
1224+
# Test for channel that has both ends associated to an interpreter.
12251225
send_interps = interpreters.channel_list_interpreters(cid, send=True)
12261226
recv_interps = interpreters.channel_list_interpreters(cid, send=False)
12271227
self.assertEqual(send_interps, [interp0])

Lib/test/test_asyncio/test_streams.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def test_read_all_from_pipe_reader(self):
711711
# See asyncio issue 168. This test is derived from the example
712712
# subprocess_attach_read_pipe.py, but we configure the
713713
# StreamReader's limit so that twice it is less than the size
714-
# of the data writter. Also we must explicitly attach a child
714+
# of the data writer. Also we must explicitly attach a child
715715
# watcher to the event loop.
716716

717717
code = """\

Lib/test/test_asyncio/test_subprocess.py

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

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

Lib/test/test_asyncio/test_tasks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3269,15 +3269,15 @@ def test_run_coroutine_threadsafe_with_timeout(self):
32693269
self.assertTrue(task.done())
32703270

32713271
def test_run_coroutine_threadsafe_task_cancelled(self):
3272-
"""Test coroutine submission from a tread to an event loop
3272+
"""Test coroutine submission from a thread to an event loop
32733273
when the task is cancelled."""
32743274
callback = lambda: self.target(cancel=True)
32753275
future = self.loop.run_in_executor(None, callback)
32763276
with self.assertRaises(asyncio.CancelledError):
32773277
self.loop.run_until_complete(future)
32783278

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

32833283
def task_factory(loop, coro):

Lib/test/test_capi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def test_return_result_with_error(self):
264264

265265
def test_getitem_with_error(self):
266266
# Test _Py_CheckSlotResult(). Raise an exception and then calls
267-
# PyObject_GetItem(): check that the assertion catchs the bug.
267+
# PyObject_GetItem(): check that the assertion catches the bug.
268268
# PyObject_GetItem() must not be called with an exception set.
269269
code = textwrap.dedent("""
270270
import _testcapi

Lib/test/test_collections.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@ def assertSameSet(self, s1, s2):
15941594
self.assertSetEqual(set(s1), set(s2))
15951595

15961596
def test_Set_from_iterable(self):
1597-
"""Verify _from_iterable overriden to an instance method works."""
1597+
"""Verify _from_iterable overridden to an instance method works."""
15981598
class SetUsingInstanceFromIterable(MutableSet):
15991599
def __init__(self, values, created_by):
16001600
if not created_by:

Lib/test/test_dataclasses.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3695,7 +3695,7 @@ class B:
36953695
with self.assertRaisesRegex(TypeError, msg):
36963696
B(3, 4, 5)
36973697

3698-
# Explicitely make a field that follows KW_ONLY be non-keyword-only.
3698+
# Explicitly make a field that follows KW_ONLY be non-keyword-only.
36993699
@dataclass
37003700
class C:
37013701
a: int

0 commit comments

Comments
 (0)