diff --git a/Lib/_pyrepl/historical_reader.py b/Lib/_pyrepl/historical_reader.py index 121de33da50..dd90912d1d6 100644 --- a/Lib/_pyrepl/historical_reader.py +++ b/Lib/_pyrepl/historical_reader.py @@ -27,7 +27,7 @@ from .reader import Reader 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 1ac733ed357..66dcd99111a 100644 --- a/Lib/_pyrepl/pager.py +++ b/Lib/_pyrepl/pager.py @@ -8,7 +8,7 @@ import sys # 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 af9290819c2..c4dedd97d1e 100644 --- a/Lib/_pyrepl/unix_console.py +++ b/Lib/_pyrepl/unix_console.py @@ -27,7 +27,6 @@ import re 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 f691ca3fbb0..9e97b1524e2 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 aeafbfbbe6e..74011b7e28b 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -7,7 +7,6 @@ import keyword import itertools import abc from reprlib import recursive_repr -from types import FunctionType, GenericAlias __all__ = ['dataclass', @@ -333,7 +332,7 @@ class Field: # 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 74c9d9b7e2f..7e0ae2a29e3 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 ef14349960b..42048ff2395 100644 --- a/Lib/idlelib/grep.py +++ b/Lib/idlelib/grep.py @@ -190,7 +190,7 @@ class GrepDialog(SearchDialogBase): 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 37fef357fe2..16b96266b51 100644 --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -13,7 +13,6 @@ except ImportError: _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 83e2d3b8657..1b1873f08b6 100644 --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -19,7 +19,6 @@ devnull = 'nul' import os import sys -import stat import genericpath from genericpath import * diff --git a/Lib/pydoc.py b/Lib/pydoc.py index cd890a7e299..085f8edbee0 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -76,7 +76,7 @@ from collections import deque 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 9167ab18594..1b4ed1ebc94 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()