Skip to content

Commit 5172462

Browse files
[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 4c6d4f5) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 7c6b342 commit 5172462

File tree

11 files changed

+5
-14
lines changed

11 files changed

+5
-14
lines changed

Lib/_pyrepl/historical_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
if False:
30-
from .types import Callback, SimpleContextManager, KeySpec, CommandName
30+
from .types import SimpleContextManager, KeySpec, CommandName
3131

3232

3333
isearch_keymap: tuple[tuple[KeySpec, CommandName], ...] = tuple(

Lib/_pyrepl/pager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# types
1010
if False:
11-
from typing import Protocol, Any
11+
from typing import Protocol
1212
class Pager(Protocol):
1313
def __call__(self, text: str, title: str = "") -> None:
1414
...

Lib/_pyrepl/unix_console.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import select
2828
import signal
2929
import struct
30-
import sys
3130
import termios
3231
import time
3332
from fcntl import ioctl

Lib/_pyrepl/windows_console.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@
2020
from __future__ import annotations
2121

2222
import io
23-
from multiprocessing import Value
2423
import os
2524
import sys
2625
import time
2726
import msvcrt
2827

29-
from abc import ABC, abstractmethod
3028
from collections import deque
31-
from dataclasses import dataclass, field
3229
import ctypes
3330
from ctypes.wintypes import (
3431
_COORD,

Lib/dataclasses.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import itertools
88
import abc
99
from reprlib import recursive_repr
10-
from types import FunctionType, GenericAlias
1110

1211

1312
__all__ = ['dataclass',
@@ -333,7 +332,7 @@ def __set_name__(self, owner, name):
333332
# it.
334333
func(self.default, owner, name)
335334

336-
__class_getitem__ = classmethod(GenericAlias)
335+
__class_getitem__ = classmethod(types.GenericAlias)
337336

338337

339338
class _DataclassParams:

Lib/dbm/sqlite3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import sqlite3
3-
import sys
43
from pathlib import Path
54
from contextlib import suppress, closing
65
from collections.abc import MutableMapping

Lib/idlelib/grep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def grep_it(self, prog, path):
190190

191191

192192
def _grep_dialog(parent): # htest #
193-
from tkinter import Toplevel, Text, SEL, END
193+
from tkinter import Toplevel, Text, SEL
194194
from tkinter.ttk import Frame, Button
195195
from idlelib.pyshell import PyShellFileList
196196

Lib/importlib/abc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
_frozen_importlib_external = _bootstrap_external
1414
from ._abc import Loader
1515
import abc
16-
import warnings
1716

1817
from .resources import abc as _resources_abc
1918

Lib/ntpath.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import os
2121
import sys
22-
import stat
2322
import genericpath
2423
from genericpath import *
2524

Lib/pydoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class or function within a module or module in a package. If the
7676
from reprlib import Repr
7777
from traceback import format_exception_only
7878

79-
from _pyrepl.pager import (get_pager, plain, escape_less, pipe_pager,
79+
from _pyrepl.pager import (get_pager, plain, pipe_pager,
8080
plain_pager, tempfile_pager, tty_pager)
8181

8282

Lib/stat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
Suggested usage: from stat import *
44
"""
5-
import sys
65

76
# Indices for stat struct members in the tuple returned by os.stat()
87

0 commit comments

Comments
 (0)