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. # 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 from errno import ENOENT

View File

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

View File

@ -26,7 +26,6 @@ from idlelib import pyparse
from idlelib import query from idlelib import query
from idlelib import replace from idlelib import replace
from idlelib import search from idlelib import search
from idlelib import textview
from idlelib import windows from idlelib import windows
# The default tab setting for a Text widget, in average-width characters. # 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. Much is tested by opening config dialog live or in test_configdialog.
Coverage: 27% Coverage: 27%
''' '''
from sys import modules
from test.support import captured_stderr from test.support import captured_stderr
from tkinter import Tk
import unittest import unittest
from idlelib import config from idlelib import config

View File

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

View File

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

View File

@ -5,7 +5,7 @@ testing skipping of suite when self.needwrapbutton is false.
''' '''
import unittest import unittest
from test.support import requires 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 searchengine as se
from idlelib import searchbase as sdb from idlelib import searchbase as sdb
from idlelib.idle_test.mock_idle import Func from idlelib.idle_test.mock_idle import Func

View File

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

View File

@ -24,7 +24,7 @@ import importlib
import os import os
from sys import executable, platform # Platform is set for one test. 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.ttk import Frame, Button, Entry, Label
from tkinter import filedialog from tkinter import filedialog
from tkinter.font import Font from tkinter.font import Font

View File

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

View File

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

View File

@ -7,7 +7,6 @@ import posixpath
import re import re
import sys import sys
from collections import Sequence from collections import Sequence
from contextlib import contextmanager
from errno import EINVAL, ENOENT, ENOTDIR from errno import EINVAL, ENOENT, ENOTDIR
from operator import attrgetter from operator import attrgetter
from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO 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 collections
import decimal
import math import math
import numbers import numbers
from fractions import Fraction from fractions import Fraction
from decimal import Decimal from decimal import Decimal
from itertools import groupby, chain from itertools import groupby
from bisect import bisect_left, bisect_right from bisect import bisect_left, bisect_right

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ import types
import unittest import unittest
import warnings import warnings
from operator import neg 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 from test.support.script_helper import assert_python_ok
try: try:
import pty, signal import pty, signal

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,11 @@
import unittest import os
from test import support
from contextlib import closing
import select
import signal import signal
import socket import socket
import struct
import subprocess 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 from test.support.script_helper import assert_python_ok, spawn_python
try: try:
import threading import threading

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ import tempfile
from itertools import chain from itertools import chain
from pathlib import Path from pathlib import Path
from zipfile import ZipFile, ZIP_DEFLATED from zipfile import ZipFile, ZIP_DEFLATED
import subprocess
TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE) TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE)
DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe|pdb|lib)$', 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 import struct
from array import array from array import array
from collections import namedtuple from collections import namedtuple
from datetime import datetime, timedelta from datetime import datetime
ttinfo = namedtuple('ttinfo', ['tt_gmtoff', 'tt_isdst', 'tt_abbrind']) ttinfo = namedtuple('ttinfo', ['tt_gmtoff', 'tt_isdst', 'tt_abbrind'])