From ccd047ea4b92f09a84b67e69deb82ce42e510c4c Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 25 Apr 2016 00:12:32 +0300 Subject: Removed unused imports. --- Lib/distutils/command/config.py | 2 +- Lib/distutils/command/register.py | 2 +- Lib/distutils/command/sdist.py | 1 - Lib/distutils/extension.py | 1 - Lib/distutils/text_file.py | 2 +- Lib/ftplib.py | 2 -- Lib/idlelib/help.py | 4 ++-- Lib/idlelib/macosxSupport.py | 1 - Lib/lib2to3/fixer_util.py | 2 -- Lib/lib2to3/fixes/fix_dict.py | 3 +-- Lib/lib2to3/fixes/fix_exec.py | 1 - Lib/lib2to3/fixes/fix_filter.py | 1 - Lib/lib2to3/fixes/fix_has_key.py | 1 - Lib/lib2to3/fixes/fix_metaclass.py | 2 +- Lib/lib2to3/fixes/fix_nonzero.py | 2 +- Lib/lib2to3/fixes/fix_print.py | 2 +- Lib/lib2to3/fixes/fix_types.py | 1 - Lib/lib2to3/fixes/fix_urllib.py | 1 - Lib/lib2to3/refactor.py | 1 - Lib/pyclbr.py | 3 +-- Lib/re.py | 1 - Lib/turtledemo/__main__.py | 1 - Lib/turtledemo/bytedesign.py | 1 - Lib/turtledemo/planet_and_moon.py | 1 - Lib/uuid.py | 1 - Tools/scripts/diff.py | 2 +- 26 files changed, 11 insertions(+), 31 deletions(-) diff --git a/Lib/distutils/command/config.py b/Lib/distutils/command/config.py index 847e858..b1fd09e 100644 --- a/Lib/distutils/command/config.py +++ b/Lib/distutils/command/config.py @@ -9,7 +9,7 @@ configure-like tasks: "try to compile this C code", or "figure out where this header file lives". """ -import sys, os, re +import os, re from distutils.core import Command from distutils.errors import DistutilsExecError diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py index b49f86f..a3e0893 100644 --- a/Lib/distutils/command/register.py +++ b/Lib/distutils/command/register.py @@ -5,7 +5,7 @@ Implements the Distutils 'register' command (register with the repository). # created 2002/10/21, Richard Jones -import os, string, getpass +import getpass import io import urllib.parse, urllib.request from warnings import warn diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 7ea3d5f..35a06eb 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -3,7 +3,6 @@ Implements the Distutils 'sdist' command (create a source distribution).""" import os -import string import sys from types import * from glob import glob diff --git a/Lib/distutils/extension.py b/Lib/distutils/extension.py index 7efbb74..c507da3 100644 --- a/Lib/distutils/extension.py +++ b/Lib/distutils/extension.py @@ -4,7 +4,6 @@ Provides the Extension class, used to describe C/C++ extension modules in setup scripts.""" import os -import sys import warnings # This class is really only used by the "build_ext" command, so it might diff --git a/Lib/distutils/text_file.py b/Lib/distutils/text_file.py index 478336f..93abad3 100644 --- a/Lib/distutils/text_file.py +++ b/Lib/distutils/text_file.py @@ -4,7 +4,7 @@ provides the TextFile class, which gives an interface to text files that (optionally) takes care of stripping comments, ignoring blank lines, and joining lines with backslashes.""" -import sys, os, io +import sys, io class TextFile: diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 2afa19d..2ab1d56 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -36,10 +36,8 @@ python ftplib.py -d localhost -l -p -l # Modified by Giampaolo Rodola' to add TLS support. # -import os import sys import socket -import warnings from socket import _GLOBAL_DEFAULT_TIMEOUT __all__ = ["FTP", "error_reply", "error_temp", "error_perm", "error_proto", diff --git a/Lib/idlelib/help.py b/Lib/idlelib/help.py index d0c59c5..4cb8c76 100644 --- a/Lib/idlelib/help.py +++ b/Lib/idlelib/help.py @@ -25,8 +25,8 @@ copy_strip - Copy idle.html to help.html, rstripping each line. show_idlehelp - Create HelpWindow. Called in EditorWindow.help_dialog. """ from html.parser import HTMLParser -from os.path import abspath, dirname, isdir, isfile, join -from tkinter import Tk, Toplevel, Frame, Text, Scrollbar, Menu, Menubutton +from os.path import abspath, dirname, isfile, join +from tkinter import Toplevel, Frame, Text, Scrollbar, Menu, Menubutton from tkinter import font as tkfont from idlelib.configHandler import idleConf diff --git a/Lib/idlelib/macosxSupport.py b/Lib/idlelib/macosxSupport.py index b96bae1..268426f 100644 --- a/Lib/idlelib/macosxSupport.py +++ b/Lib/idlelib/macosxSupport.py @@ -3,7 +3,6 @@ A number of functions that enhance IDLE on Mac OSX. """ import sys import tkinter -from os import path import warnings def runningAsOSXApp(): diff --git a/Lib/lib2to3/fixer_util.py b/Lib/lib2to3/fixer_util.py index 44502bf..babe6cb 100644 --- a/Lib/lib2to3/fixer_util.py +++ b/Lib/lib2to3/fixer_util.py @@ -1,8 +1,6 @@ """Utility functions, node construction macros, etc.""" # Author: Collin Winter -from itertools import islice - # Local imports from .pgen2 import token from .pytree import Leaf, Node diff --git a/Lib/lib2to3/fixes/fix_dict.py b/Lib/lib2to3/fixes/fix_dict.py index 963f952..d3655c9 100644 --- a/Lib/lib2to3/fixes/fix_dict.py +++ b/Lib/lib2to3/fixes/fix_dict.py @@ -30,9 +30,8 @@ as an argument to a function that introspects the argument). # Local imports from .. import pytree from .. import patcomp -from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot +from ..fixer_util import Name, Call, Dot from .. import fixer_util diff --git a/Lib/lib2to3/fixes/fix_exec.py b/Lib/lib2to3/fixes/fix_exec.py index 2c9b72d..ab921ee 100644 --- a/Lib/lib2to3/fixes/fix_exec.py +++ b/Lib/lib2to3/fixes/fix_exec.py @@ -10,7 +10,6 @@ exec code in ns1, ns2 -> exec(code, ns1, ns2) """ # Local imports -from .. import pytree from .. import fixer_base from ..fixer_util import Comma, Name, Call diff --git a/Lib/lib2to3/fixes/fix_filter.py b/Lib/lib2to3/fixes/fix_filter.py index 391889f..bb6718c 100644 --- a/Lib/lib2to3/fixes/fix_filter.py +++ b/Lib/lib2to3/fixes/fix_filter.py @@ -14,7 +14,6 @@ Python 2.6 figure it out. """ # Local imports -from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, Call, ListComp, in_special_context diff --git a/Lib/lib2to3/fixes/fix_has_key.py b/Lib/lib2to3/fixes/fix_has_key.py index 18c560f..439708c 100644 --- a/Lib/lib2to3/fixes/fix_has_key.py +++ b/Lib/lib2to3/fixes/fix_has_key.py @@ -31,7 +31,6 @@ CAVEATS: # Local imports from .. import pytree -from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, parenthesize diff --git a/Lib/lib2to3/fixes/fix_metaclass.py b/Lib/lib2to3/fixes/fix_metaclass.py index f3f8708..eca3334 100644 --- a/Lib/lib2to3/fixes/fix_metaclass.py +++ b/Lib/lib2to3/fixes/fix_metaclass.py @@ -20,7 +20,7 @@ # Local imports from .. import fixer_base from ..pygram import token -from ..fixer_util import Name, syms, Node, Leaf +from ..fixer_util import syms, Node, Leaf def has_metaclass(parent): diff --git a/Lib/lib2to3/fixes/fix_nonzero.py b/Lib/lib2to3/fixes/fix_nonzero.py index ad91a29..c229596 100644 --- a/Lib/lib2to3/fixes/fix_nonzero.py +++ b/Lib/lib2to3/fixes/fix_nonzero.py @@ -3,7 +3,7 @@ # Local imports from .. import fixer_base -from ..fixer_util import Name, syms +from ..fixer_util import Name class FixNonzero(fixer_base.BaseFix): BM_compatible = True diff --git a/Lib/lib2to3/fixes/fix_print.py b/Lib/lib2to3/fixes/fix_print.py index a1fe2f5..8780322 100644 --- a/Lib/lib2to3/fixes/fix_print.py +++ b/Lib/lib2to3/fixes/fix_print.py @@ -18,7 +18,7 @@ from .. import patcomp from .. import pytree from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Name, Call, Comma, String, is_tuple +from ..fixer_util import Name, Call, Comma, String parend_expr = patcomp.compile_pattern( diff --git a/Lib/lib2to3/fixes/fix_types.py b/Lib/lib2to3/fixes/fix_types.py index 00327a7..67bf51f 100644 --- a/Lib/lib2to3/fixes/fix_types.py +++ b/Lib/lib2to3/fixes/fix_types.py @@ -20,7 +20,6 @@ There should be another fixer that handles at least the following constants: """ # Local imports -from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name diff --git a/Lib/lib2to3/fixes/fix_urllib.py b/Lib/lib2to3/fixes/fix_urllib.py index 1481cd9..5a36049 100644 --- a/Lib/lib2to3/fixes/fix_urllib.py +++ b/Lib/lib2to3/fixes/fix_urllib.py @@ -6,7 +6,6 @@ # Local imports from lib2to3.fixes.fix_imports import alternates, FixImports -from lib2to3 import fixer_base from lib2to3.fixer_util import (Name, Comma, FromImport, Newline, find_indentation, Node, syms) diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py index 0728083..b60b9de 100644 --- a/Lib/lib2to3/refactor.py +++ b/Lib/lib2to3/refactor.py @@ -26,7 +26,6 @@ from itertools import chain from .pgen2 import driver, tokenize, token from .fixer_util import find_root from . import pytree, pygram -from . import btm_utils as bu from . import btm_matcher as bm diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py index 4d40b87..d7dba97 100644 --- a/Lib/pyclbr.py +++ b/Lib/pyclbr.py @@ -40,12 +40,10 @@ Instances of this class have the following instance variables: """ import io -import os import sys import importlib.util import tokenize from token import NAME, DEDENT, OP -from operator import itemgetter __all__ = ["readmodule", "readmodule_ex", "Class", "Function"] @@ -328,6 +326,7 @@ def _getname(g): def _main(): # Main program for testing. import os + from operator import itemgetter mod = sys.argv[1] if os.path.exists(mod): path = [os.path.dirname(mod)] diff --git a/Lib/re.py b/Lib/re.py index dde8901..661929e 100644 --- a/Lib/re.py +++ b/Lib/re.py @@ -119,7 +119,6 @@ This module also defines an exception 'error'. """ -import sys import sre_compile import sre_parse try: diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py index 106d058..d9b3dd5 100644 --- a/Lib/turtledemo/__main__.py +++ b/Lib/turtledemo/__main__.py @@ -95,7 +95,6 @@ from idlelib.textView import view_text from turtledemo import __doc__ as about_turtledemo import turtle -import time demo_dir = os.path.dirname(os.path.abspath(__file__)) darwin = sys.platform == 'darwin' diff --git a/Lib/turtledemo/bytedesign.py b/Lib/turtledemo/bytedesign.py index 64b1d7d..b3b095b 100755 --- a/Lib/turtledemo/bytedesign.py +++ b/Lib/turtledemo/bytedesign.py @@ -22,7 +22,6 @@ to 0, this animation runs in "line per line" mode as fast as possible. """ -import math from turtle import Turtle, mainloop from time import clock diff --git a/Lib/turtledemo/planet_and_moon.py b/Lib/turtledemo/planet_and_moon.py index 26abfdb..021ff99 100755 --- a/Lib/turtledemo/planet_and_moon.py +++ b/Lib/turtledemo/planet_and_moon.py @@ -18,7 +18,6 @@ mouse over the scrollbar of the canvas. """ from turtle import Shape, Turtle, mainloop, Vec2D as Vec -from time import sleep G = 8 diff --git a/Lib/uuid.py b/Lib/uuid.py index e96e7e0..200c800 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -487,7 +487,6 @@ try: # Assume that the uuid_generate functions are broken from 10.5 onward, # the test can be adjusted when a later version is fixed. if sys.platform == 'darwin': - import os if int(os.uname().release.split('.')[0]) >= 9: _uuid_generate_time = None diff --git a/Tools/scripts/diff.py b/Tools/scripts/diff.py index 9720a43..96199b8 100755 --- a/Tools/scripts/diff.py +++ b/Tools/scripts/diff.py @@ -8,7 +8,7 @@ """ -import sys, os, time, difflib, argparse +import sys, os, difflib, argparse from datetime import datetime, timezone def file_mtime(path): -- cgit v0.12