https://github.com/python/cpython/commit/51724620e868512bbedb1547aca441bcd27bbe0c
commit: 51724620e868512bbedb1547aca441bcd27bbe0c
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2024-06-12T19:27:32Z
summary:

[3.13] gh-120417: Remove unused imports in the stdlib (GH-120420) (#120429)

gh-120417: Remove unused imports in the stdlib (GH-120420)
(cherry picked from commit 4c6d4f5cb33e48519922d635894eef356faddba2)

Co-authored-by: Victor Stinner <[email protected]>

files:
M Lib/_pyrepl/historical_reader.py
M Lib/_pyrepl/pager.py
M Lib/_pyrepl/unix_console.py
M Lib/_pyrepl/windows_console.py
M Lib/dataclasses.py
M Lib/dbm/sqlite3.py
M Lib/idlelib/grep.py
M Lib/importlib/abc.py
M Lib/ntpath.py
M Lib/pydoc.py
M Lib/stat.py

diff --git a/Lib/_pyrepl/historical_reader.py b/Lib/_pyrepl/historical_reader.py
index 121de33da5052f..dd90912d1d67f8 100644
--- a/Lib/_pyrepl/historical_reader.py
+++ b/Lib/_pyrepl/historical_reader.py
@@ -27,7 +27,7 @@
 
 
 if False:
-    from .types import Callback, SimpleContextManager, KeySpec, CommandName
+    from .types import SimpleContextManager, KeySpec, CommandName
 
 
 isearch_keymap: tuple[tuple[KeySpec, CommandName], ...] = tuple(
diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py
index 1ac733ed3573a4..66dcd99111adfc 100644
--- a/Lib/_pyrepl/pager.py
+++ b/Lib/_pyrepl/pager.py
@@ -8,7 +8,7 @@
 
 # types
 if False:
-    from typing import Protocol, Any
+    from typing import Protocol
     class Pager(Protocol):
         def __call__(self, text: str, title: str = "") -> None:
             ...
diff --git a/Lib/_pyrepl/unix_console.py b/Lib/_pyrepl/unix_console.py
index af9290819c2c78..c4dedd97d1e13d 100644
--- a/Lib/_pyrepl/unix_console.py
+++ b/Lib/_pyrepl/unix_console.py
@@ -27,7 +27,6 @@
 import select
 import signal
 import struct
-import sys
 import termios
 import time
 from fcntl import ioctl
diff --git a/Lib/_pyrepl/windows_console.py b/Lib/_pyrepl/windows_console.py
index f691ca3fbb07b8..9e97b1524e29a0 100644
--- a/Lib/_pyrepl/windows_console.py
+++ b/Lib/_pyrepl/windows_console.py
@@ -20,15 +20,12 @@
 from __future__ import annotations
 
 import io
-from multiprocessing import Value
 import os
 import sys
 import time
 import msvcrt
 
-from abc import ABC, abstractmethod
 from collections import deque
-from dataclasses import dataclass, field
 import ctypes
 from ctypes.wintypes import (
     _COORD,
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index aeafbfbbe6e9c4..74011b7e28b9f3 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -7,7 +7,6 @@
 import itertools
 import abc
 from reprlib import recursive_repr
-from types import FunctionType, GenericAlias
 
 
 __all__ = ['dataclass',
@@ -333,7 +332,7 @@ def __set_name__(self, owner, name):
             # it.
             func(self.default, owner, name)
 
-    __class_getitem__ = classmethod(GenericAlias)
+    __class_getitem__ = classmethod(types.GenericAlias)
 
 
 class _DataclassParams:
diff --git a/Lib/dbm/sqlite3.py b/Lib/dbm/sqlite3.py
index 74c9d9b7e2f1d8..7e0ae2a29e3a64 100644
--- a/Lib/dbm/sqlite3.py
+++ b/Lib/dbm/sqlite3.py
@@ -1,6 +1,5 @@
 import os
 import sqlite3
-import sys
 from pathlib import Path
 from contextlib import suppress, closing
 from collections.abc import MutableMapping
diff --git a/Lib/idlelib/grep.py b/Lib/idlelib/grep.py
index ef14349960bfa2..42048ff2395fe1 100644
--- a/Lib/idlelib/grep.py
+++ b/Lib/idlelib/grep.py
@@ -190,7 +190,7 @@ def grep_it(self, prog, path):
 
 
 def _grep_dialog(parent):  # htest #
-    from tkinter import Toplevel, Text, SEL, END
+    from tkinter import Toplevel, Text, SEL
     from tkinter.ttk import Frame, Button
     from idlelib.pyshell import PyShellFileList
 
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
index 37fef357fe2c0c..16b96266b51be0 100644
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -13,7 +13,6 @@
     _frozen_importlib_external = _bootstrap_external
 from ._abc import Loader
 import abc
-import warnings
 
 from .resources import abc as _resources_abc
 
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 83e2d3b865757c..1b1873f08b608b 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -19,7 +19,6 @@
 
 import os
 import sys
-import stat
 import genericpath
 from genericpath import *
 
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index cd890a7e299548..085f8edbee06df 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -76,7 +76,7 @@ class or function within a module or module in a package.  If 
the
 from reprlib import Repr
 from traceback import format_exception_only
 
-from _pyrepl.pager import (get_pager, plain, escape_less, pipe_pager,
+from _pyrepl.pager import (get_pager, plain, pipe_pager,
                            plain_pager, tempfile_pager, tty_pager)
 
 
diff --git a/Lib/stat.py b/Lib/stat.py
index 9167ab185944fb..1b4ed1ebc940ef 100644
--- a/Lib/stat.py
+++ b/Lib/stat.py
@@ -2,7 +2,6 @@
 
 Suggested usage: from stat import *
 """
-import sys
 
 # Indices for stat struct members in the tuple returned by os.stat()
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to