bpo-29919: Remove unused imports found by pyflakes (#137)

Make also minor PEP8 coding style fixes on modified imports.
This commit is contained in:
Victor Stinner 2017-03-27 16:05:26 +02:00 committed by GitHub
parent 604e74c6be
commit d6debb24e0
40 changed files with 30 additions and 55 deletions

View File

@ -46,7 +46,12 @@ internationalized, to the local language and cultural habits.
# find this format documented anywhere.
import locale, copy, io, os, re, struct, sys
import copy
import locale
import os
import re
import struct
import sys
from errno import ENOENT

View File

@ -29,7 +29,7 @@ from configparser import ConfigParser
import os
import sys
from tkinter.font import Font, nametofont
from tkinter.font import Font
class InvalidConfigType(Exception): pass
class InvalidConfigSet(Exception): pass

View File

@ -26,7 +26,6 @@ from idlelib import pyparse
from idlelib import query
from idlelib import replace
from idlelib import search
from idlelib import textview
from idlelib import windows
# The default tab setting for a Text widget, in average-width characters.

View File

@ -3,9 +3,7 @@
Much is tested by opening config dialog live or in test_configdialog.
Coverage: 27%
'''
from sys import modules
from test.support import captured_stderr
from tkinter import Tk
import unittest
from idlelib import config

View File

@ -6,7 +6,7 @@ from idlelib import config_key
from test.support import requires
requires('gui')
import unittest
from tkinter import Tk, Text
from tkinter import Tk
class GetKeysTest(unittest.TestCase):

View File

@ -1,7 +1,5 @@
import unittest
from tkinter import Tk, Text
from idlelib.editor import EditorWindow
from test.support import requires
class Editor_func_test(unittest.TestCase):
def test_filename_to_unicode(self):

View File

@ -5,7 +5,7 @@ testing skipping of suite when self.needwrapbutton is false.
'''
import unittest
from test.support import requires
from tkinter import Tk, Toplevel, Frame ##, BooleanVar, StringVar
from tkinter import Tk, Frame ##, BooleanVar, StringVar
from idlelib import searchengine as se
from idlelib import searchbase as sdb
from idlelib.idle_test.mock_idle import Func

View File

@ -19,7 +19,6 @@ if TkVersion < 8.5:
from code import InteractiveInterpreter
import getopt
import io
import linecache
import os
import os.path

View File

@ -24,7 +24,7 @@ import importlib
import os
from sys import executable, platform # Platform is set for one test.
from tkinter import Toplevel, StringVar, W, E, N, S
from tkinter import Toplevel, StringVar, W, E, S
from tkinter.ttk import Frame, Button, Entry, Label
from tkinter import filedialog
from tkinter.font import Font

View File

@ -17,7 +17,7 @@ import collections
import pickle
# Local imports
from . import token, tokenize
from . import token
class Grammar(object):

View File

@ -7,7 +7,7 @@
# Licensed to PSF under a Contributor Agreement.
#
from abc import ABCMeta, abstractmethod
from abc import ABCMeta
import copyreg
import functools
import io

View File

@ -7,7 +7,6 @@ import posixpath
import re
import sys
from collections import Sequence
from contextlib import contextmanager
from errno import EINVAL, ENOENT, ENOTDIR
from operator import attrgetter
from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO

View File

@ -83,13 +83,12 @@ __all__ = [ 'StatisticsError',
]
import collections
import decimal
import math
import numbers
from fractions import Fraction
from decimal import Decimal
from itertools import groupby, chain
from itertools import groupby
from bisect import bisect_left, bisect_right

View File

@ -2,7 +2,6 @@ import os
import sys
import ssl
import pprint
import socket
import urllib.parse
# Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer.
from http.server import (HTTPServer as _HTTPServer,

View File

@ -4,7 +4,6 @@
"""Unit tests for abc.py."""
import unittest
from test import support
import abc
from inspect import isabstract

View File

@ -2,8 +2,6 @@ import inspect
import types
import unittest
from unittest import mock
from test.support import import_module
asyncio = import_module("asyncio")

View File

@ -1,6 +1,5 @@
"""Tests support for new syntax introduced by PEP 492."""
import collections.abc
import types
import unittest

View File

@ -1,7 +1,6 @@
"""Tests for binary operators on subtypes of built-in types."""
import unittest
from test import support
from operator import eq, le, ne
from abc import ABCMeta

View File

@ -18,7 +18,7 @@ import types
import unittest
import warnings
from operator import neg
from test.support import TESTFN, unlink, run_unittest, check_warnings
from test.support import TESTFN, unlink, check_warnings
from test.support.script_helper import assert_python_ok
try:
import pty, signal

View File

@ -3,7 +3,6 @@
import collections
import copy
import doctest
import inspect
import keyword
import operator
import pickle

View File

@ -34,7 +34,7 @@ import numbers
import locale
from test.support import (run_unittest, run_doctest, is_resource_enabled,
requires_IEEE_754, requires_docstrings)
from test.support import (check_warnings, import_fresh_module, TestFailed,
from test.support import (import_fresh_module, TestFailed,
run_with_locale, cpython_only)
import random
import inspect
@ -1170,7 +1170,6 @@ class FormatTest(unittest.TestCase):
@run_with_locale('LC_ALL', 'ps_AF')
def test_wide_char_separator_decimal_point(self):
# locale with wide char separator and decimal point
import locale
Decimal = self.decimal.Decimal
decimal_point = locale.localeconv()['decimal_point']

View File

@ -5,7 +5,6 @@ import gc
import weakref
import copy
import pickle
from io import StringIO
import random
import struct

View File

@ -6,7 +6,6 @@ import unittest
import warnings
import weakref
import inspect
import types
from test import support

View File

@ -1,11 +1,11 @@
# Simple test suite for http/cookies.py
import copy
from test.support import run_unittest, run_doctest, check_warnings
from test.support import run_unittest, run_doctest
import unittest
from http import cookies
import pickle
import warnings
class CookieTests(unittest.TestCase):

View File

@ -10,7 +10,6 @@ import os.path
import socketserver
import time
import calendar
import inspect
from test.support import (reap_threads, verbose, transient_internet,
run_with_tz, run_with_locale)

View File

@ -1,5 +1,5 @@
import decimal
from io import StringIO, BytesIO
from io import StringIO
from collections import OrderedDict
from test.test_json import PyTest, CTest

View File

@ -1,6 +1,5 @@
import os
import sys
import builtins
import contextlib
import importlib.util
import inspect

View File

@ -1,5 +1,5 @@
from test.support import verbose, run_unittest, gc_collect, bigmemtest, _2G, \
cpython_only, captured_stdout
from test.support import (gc_collect, bigmemtest, _2G,
cpython_only, captured_stdout)
import locale
import re
import sre_compile

View File

@ -11,7 +11,6 @@ import os.path
import errno
import functools
import subprocess
from contextlib import ExitStack
from shutil import (make_archive,
register_archive_format, unregister_archive_format,
get_archive_formats, Error, unpack_archive,
@ -22,8 +21,7 @@ import tarfile
import zipfile
from test import support
from test.support import (TESTFN, check_warnings, captured_stdout,
android_not_root)
from test.support import TESTFN, android_not_root
TESTFN2 = TESTFN + "2"

View File

@ -1,12 +1,11 @@
import unittest
from test import support
from contextlib import closing
import select
import os
import signal
import socket
import struct
import subprocess
import sys, os, time, errno
import sys
import time
import unittest
from test import support
from test.support.script_helper import assert_python_ok, spawn_python
try:
import threading

View File

@ -9,7 +9,6 @@ import operator
import codecs
import gc
import sysconfig
import platform
import locale
# count the number of test runs, used to create unique

View File

@ -10,7 +10,6 @@ import codecs
import itertools
import operator
import struct
import string
import sys
import unittest
import warnings

View File

@ -16,7 +16,7 @@ from random import randint, random, getrandbits
from test.support import script_helper
from test.support import (TESTFN, findfile, unlink, rmtree, temp_dir, temp_cwd,
requires_zlib, requires_bz2, requires_lzma,
captured_stdout, check_warnings)
captured_stdout)
TESTFN2 = TESTFN + "2"
TESTFNDIR = TESTFN + "d"

View File

@ -15,7 +15,6 @@ import zipfile, os, unittest
import time
import sys
from io import StringIO
from tempfile import TemporaryFile
from test.support import TESTFN, requires_zlib

View File

@ -13,6 +13,6 @@ if sys.argv[0].endswith("__main__.py"):
__unittest = True
from .main import main, TestProgram
from .main import main
main(module=None)

View File

@ -7,7 +7,6 @@
import time
from math import log, ceil
try:
from test.support import import_fresh_module
except ImportError:

View File

@ -21,7 +21,6 @@
from __future__ import print_function
import os
import re
import sys
import subprocess
from shutil import copy

View File

@ -7,7 +7,6 @@
import abc
import ast
import atexit
import collections
import contextlib
import copy
@ -27,7 +26,6 @@ import tempfile
import textwrap
import traceback
import types
import uuid
from types import *
NoneType = type(None)

View File

@ -10,7 +10,7 @@ import tempfile
from itertools import chain
from pathlib import Path
from zipfile import ZipFile, ZIP_DEFLATED
import subprocess
TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE)
DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe|pdb|lib)$', re.IGNORECASE)

View File

@ -3,7 +3,7 @@ import os
import struct
from array import array
from collections import namedtuple
from datetime import datetime, timedelta
from datetime import datetime
ttinfo = namedtuple('ttinfo', ['tt_gmtoff', 'tt_isdst', 'tt_abbrind'])