[3.7] bpo-32746: Fix multiple typos (GH-5144) (GH-5520)

Fix typos found by codespell in docs, docstrings, and comments.
(cherry picked from commit c3d9508ff22ece9a96892b628dd5813e2fb0cd80)

Co-authored-by: Leo Arias <leo.arias@canonical.com>
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index a0883b9..8f9ebdd 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -1861,7 +1861,7 @@
 
         # Make sure comparison doesn't forget microseconds, and isn't done
         # via comparing a float timestamp (an IEEE double doesn't have enough
-        # precision to span microsecond resolution across years 1 thru 9999,
+        # precision to span microsecond resolution across years 1 through 9999,
         # so comparing via timestamp necessarily calls some distinct values
         # equal).
         dt1 = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999998)
diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py
index 99a483b..96e0c30 100644
--- a/Lib/test/test_cmd.py
+++ b/Lib/test/test_cmd.py
@@ -51,7 +51,7 @@
 
     Test for the function completedefault():
     >>> mycmd.completedefault()
-    This is the completedefault methode
+    This is the completedefault method
     >>> mycmd.completenames("a")
     ['add']
 
@@ -140,7 +140,7 @@
         print("Hello from postloop")
 
     def completedefault(self, *ignored):
-        print("This is the completedefault methode")
+        print("This is the completedefault method")
 
     def complete_command(self):
         print("complete command")
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py
index 675cd7a..18d0265 100644
--- a/Lib/test/test_concurrent_futures.py
+++ b/Lib/test/test_concurrent_futures.py
@@ -398,7 +398,7 @@
         queue_management_thread = executor._queue_management_thread
         del executor
 
-        # Make sure that all the executor ressources were properly cleaned by
+        # Make sure that all the executor resources were properly cleaned by
         # the shutdown process
         queue_management_thread.join()
         for p in processes.values():
@@ -886,24 +886,24 @@
         # extensive testing for deadlock caused by crashes in a pool.
         self.executor.shutdown(wait=True)
         crash_cases = [
-            # Check problem occuring while pickling a task in
+            # Check problem occurring while pickling a task in
             # the task_handler thread
             (id, (ErrorAtPickle(),), PicklingError, "error at task pickle"),
-            # Check problem occuring while unpickling a task on workers
+            # Check problem occurring while unpickling a task on workers
             (id, (ExitAtUnpickle(),), BrokenProcessPool,
              "exit at task unpickle"),
             (id, (ErrorAtUnpickle(),), BrokenProcessPool,
              "error at task unpickle"),
             (id, (CrashAtUnpickle(),), BrokenProcessPool,
              "crash at task unpickle"),
-            # Check problem occuring during func execution on workers
+            # Check problem occurring during func execution on workers
             (_crash, (), BrokenProcessPool,
              "crash during func execution on worker"),
             (_exit, (), SystemExit,
              "exit during func execution on worker"),
             (_raise_error, (RuntimeError, ), RuntimeError,
              "error during func execution on worker"),
-            # Check problem occuring while pickling a task result
+            # Check problem occurring while pickling a task result
             # on workers
             (_return_instance, (CrashAtPickle,), BrokenProcessPool,
              "crash during result pickle on worker"),
@@ -911,7 +911,7 @@
              "exit during result pickle on worker"),
             (_return_instance, (ErrorAtPickle,), PicklingError,
              "error during result pickle on worker"),
-            # Check problem occuring while unpickling a task in
+            # Check problem occurring while unpickling a task in
             # the result_handler thread
             (_return_instance, (ErrorAtUnpickle,), BrokenProcessPool,
              "error during result unpickle in result_handler"),
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 3461f20..7360b34 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1500,7 +1500,7 @@
                 succs[final].remove(corner)
                 add_to_successors(this)
 
-        # Generate moves 3 thru m*n-1.
+        # Generate moves 3 through m*n-1.
         def advance(len=len):
             # If some successor has only one exit, must take it.
             # Else favor successors with fewer exits.
@@ -1522,7 +1522,7 @@
                         yield i
                     add_to_successors(i)
 
-        # Generate moves 3 thru m*n-1.  Alternative version using a
+        # Generate moves 3 through m*n-1.  Alternative version using a
         # stronger (but more expensive) heuristic to order successors.
         # Since the # of backtracking levels is m*n, a poor move early on
         # can take eons to undo.  Smallest square board for which this
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 0384a9f..9fa0bbd 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -1637,7 +1637,7 @@
         # has to keep looping to find the first object we delete.
         objs.reverse()
 
-        # Turn on mutation in C.__eq__.  The first time thru the loop,
+        # Turn on mutation in C.__eq__.  The first time through the loop,
         # under the iterkeys() business the first comparison will delete
         # the last item iterkeys() would see, and that causes a
         #     RuntimeError: dictionary changed size during iteration