Skip to content

Commit

Permalink
Merge pull request #9904 from oscargus/unusedimports2
Browse files Browse the repository at this point in the history
PR: Remove unused imports
  • Loading branch information
ccordoba12 authored Jul 28, 2019
2 parents c44da36 + 59eded5 commit b67cf68
Show file tree
Hide file tree
Showing 55 changed files with 75 additions and 112 deletions.
2 changes: 1 addition & 1 deletion spyder/api/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import logging
from qtpy.QtWidgets import QWidget, QApplication
from qtpy.QtGui import QBrush, QColor, QPen, QPainter
from qtpy.QtCore import Qt, QPoint, QRect
from qtpy.QtCore import Qt, QRect

# Local imports
from spyder.api.editorextension import EditorExtension
Expand Down
2 changes: 1 addition & 1 deletion spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
from qtpy.QtGui import QColor, QDesktopServices, QIcon, QKeySequence, QPixmap
from qtpy.QtWidgets import (QAction, QApplication, QDesktopWidget, QDockWidget,
QMainWindow, QMenu, QMessageBox, QShortcut,
QSplashScreen, QStyle, QStyleFactory, QWidget)
QSplashScreen, QStyleFactory, QWidget)

# Avoid a "Cannot mix incompatible Qt library" error on Windows platforms
from qtpy import QtSvg # analysis:ignore
Expand Down
3 changes: 1 addition & 2 deletions spyder/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
# Local imports
from spyder import __version__
from spyder.utils import encoding
from spyder.py3compat import (is_unicode, TEXT_TYPES, INT_TYPES, PY3,
to_text_string, is_text_string)
from spyder.py3compat import is_unicode, PY3, to_text_string, is_text_string


#==============================================================================
Expand Down
1 change: 0 additions & 1 deletion spyder/config/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

# Local imports
from spyder.config.manager import CONF
from spyder.config.user import NoDefault
from spyder.py3compat import to_text_string
from spyder.utils import syntaxhighlighters as sh

Expand Down
2 changes: 0 additions & 2 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
"""

import os
import os.path as osp
import sys

# Local import
from spyder.config.base import CHECK_ALL, EXCLUDED_NAMES
from spyder.config.fonts import MEDIUM, SANS_SERIF
from spyder.config.user import UserConfig
from spyder.config.utils import IMPORT_EXT
from spyder.config.appearance import APPEARANCE
from spyder.plugins.editor.utils.findtasks import TASKS_PATTERN
Expand Down
2 changes: 1 addition & 1 deletion spyder/config/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import os.path as osp

# Local imports
from spyder.config.base import get_conf_path, get_conf_subfolder, get_home_dir
from spyder.config.base import get_conf_path, get_home_dir
from spyder.config.main import CONF_VERSION, DEFAULTS, NAME_MAP
from spyder.config.user import MultiUserConfig, NoDefault

Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from qtpy.QtCore import Qt, Slot
from qtpy.QtGui import QCursor, QKeySequence
from qtpy.QtWidgets import (QApplication, QDockWidget, QMainWindow, QMenu,
QMessageBox, QShortcut, QToolButton, QWidget)
QMessageBox, QShortcut, QToolButton)

# Local imports
from spyder.config.base import _
Expand Down
2 changes: 0 additions & 2 deletions spyder/plugins/completion/fallback/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
"""

# Standard library imports
import re
import logging

# Qt imports
from qtpy.QtCore import QObject, QThread, QMutex, QMutexLocker, Signal, Slot

# Other imports
import pygments
from pygments.lexers import get_lexer_by_name
from diff_match_patch import diff_match_patch

Expand Down
5 changes: 3 additions & 2 deletions spyder/plugins/completion/fallback/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
Utilities needed by the fallback completion engine.
"""

# Standard imports
import imp
import os
import pickle
import os.path as osp
import re

# Local imports
from spyder.utils.misc import memoize

from spyder.utils.syntaxhighlighters import (
custom_extension_lexer_mapping
)

# Other imports
from pygments.lexer import words
from pygments.lexers import (get_lexer_for_filename, get_lexer_by_name,
TextLexer)
from pygments.token import Token


# CamelCase and snake_case regex:
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/completion/languageserver/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import functools

# Third-party imports
from qtpy.QtCore import QObject, Slot
from qtpy.QtCore import Slot

# Local imports
from spyder.config.base import get_conf_path, running_under_pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

"""Spyder Language Server Protocol Client document handler routines."""

# Standard library imports
import logging
import os.path as osp

from spyder.py3compat import PY2
# Local imports
from spyder.plugins.completion.languageserver import (
LSPRequestTypes, InsertTextFormat, CompletionItemKind,
ClientConstants)
Expand Down
9 changes: 1 addition & 8 deletions spyder/plugins/completion/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,12 @@

# Standard library imports
import logging
import os
import os.path as osp
import functools

# Third-party imports
from qtpy.QtCore import QObject, Slot
from qtpy.QtCore import Slot

# Local imports
from spyder.config.base import get_conf_path, running_under_pytest
from spyder.config.lsp import PYTHON_CONFIG
from spyder.config.manager import CONF
from spyder.api.completion import SpyderCompletionPlugin
from spyder.utils.misc import select_port, getcwd_or_home
from spyder.plugins.completion.languageserver.plugin import (
LanguageServerPlugin)
from spyder.plugins.completion.fallback.plugin import FallbackPlugin
Expand Down
3 changes: 2 additions & 1 deletion spyder/plugins/editor/extensions/closequotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# (see spyder/__init__.py for details)
"""This module contains the close quotes editor extension."""

from qtpy.QtCore import Qt
# Third party imports
from qtpy.QtGui import QTextCursor

# Local imports
from spyder.api.editorextension import EditorExtension


Expand Down
2 changes: 2 additions & 0 deletions spyder/plugins/editor/panels/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"""
This module contains the DebuggerPanel panel
"""
# Third party imports
from qtpy.QtCore import QSize, Qt, QRect, Slot
from qtpy.QtGui import QPainter, QFontMetrics

# Local imports
from spyder.utils import icon_manager as ima
from spyder.api.panel import Panel
from spyder.config.base import debug_print
Expand Down
4 changes: 3 additions & 1 deletion spyder/plugins/editor/panels/edgeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
This module contains the edge line panel
"""

# Third party imports
from qtpy.QtCore import Qt
from qtpy.QtGui import QPainter, QColor, QPen
from qtpy.QtGui import QPainter, QColor

# Local imports
from spyder.py3compat import is_text_string
from spyder.api.panel import Panel

Expand Down
5 changes: 3 additions & 2 deletions spyder/plugins/editor/panels/indentationguides.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"""
This module contains the indentation guide panel.
"""

from qtpy.QtCore import Qt, QRect, QPoint
# Third party imports
from qtpy.QtCore import Qt
from qtpy.QtGui import QPainter, QColor

# Local imports
from spyder.plugins.editor.utils.editor import TextBlockHelper
from spyder.api.panel import Panel

Expand Down
4 changes: 2 additions & 2 deletions spyder/plugins/editor/panels/linenumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"""
This module contains the Line Number panel
"""
import sys

# Third party imports
from qtpy import QT_VERSION
from qtpy.QtCore import QSize, Qt
from qtpy.QtGui import QPainter, QColor

# Local imports
from spyder.py3compat import to_text_string
from spyder.utils import icon_manager as ima
from spyder.utils.programs import check_version
Expand Down
14 changes: 0 additions & 14 deletions spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
# Third party imports
from qtpy.compat import from_qvariant, getopenfilenames, to_qvariant
from qtpy.QtCore import QByteArray, Qt, Signal, Slot
from qtpy.QtGui import QKeySequence
from qtpy.QtPrintSupport import QAbstractPrintDialog, QPrintDialog, QPrinter
from qtpy.QtWidgets import (QAction, QActionGroup, QApplication, QDialog,
QFileDialog, QInputDialog, QMenu, QSplitter,
Expand Down Expand Up @@ -368,7 +367,6 @@ def closing_plugin(self, cancelable=False):
"""Perform actions before parent main window is closed"""
state = self.splitter.saveState()
self.set_option('splitter_state', qbytearray_to_str(state))
filenames = []
editorstack = self.editorstacks[0]

active_project_path = None
Expand Down Expand Up @@ -1579,18 +1577,6 @@ def update_active_languages(self, languages):
self.main.completions.update_client_status(languages)


#------ Breakpoints
def save_breakpoints(self, filename, breakpoints):
filename = to_text_string(filename)
breakpoints = to_text_string(breakpoints)
filename = osp.normpath(osp.abspath(filename))
if breakpoints:
breakpoints = eval(breakpoints)
else:
breakpoints = []
save_breakpoints(filename, breakpoints)
self.breakpoints_saved.emit()

# ------ Bookmarks
def save_bookmarks(self, filename, bookmarks):
"""Receive bookmark changes and save them."""
Expand Down
5 changes: 2 additions & 3 deletions spyder/plugins/editor/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@

# Standard library imports
import os
import os.path as osp
import sys

# Third party imports
from qtpy.compat import to_qvariant
from qtpy.QtCore import QEvent, QEventLoop, QPoint, Qt, Signal, Slot
from qtpy.QtGui import (QClipboard, QColor, QMouseEvent, QPalette, QTextFormat,
from qtpy.QtCore import QEvent, QPoint, Qt, Signal, Slot
from qtpy.QtGui import (QClipboard, QColor, QMouseEvent, QTextFormat,
QTextOption, QTextCursor)
from qtpy.QtWidgets import (QAbstractItemView, QApplication, QListWidget,
QListWidgetItem, QMainWindow, QPlainTextEdit,
Expand Down
1 change: 0 additions & 1 deletion spyder/plugins/editor/widgets/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,6 @@ def hide_tooltip(self):

def show_code_analysis_results(self, line_number, block_data):
"""Show warning/error messages."""
from spyder.config.base import get_image_path
# Diagnostic severity
icons = {
DiagnosticSeverity.ERROR: 'error',
Expand Down
4 changes: 1 addition & 3 deletions spyder/plugins/explorer/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"""File explorer configuration page."""

# Third party imports
from qtpy.QtCore import Qt
from qtpy.QtWidgets import (QGroupBox, QHBoxLayout, QLabel, QListWidget,
QPushButton, QTabWidget, QVBoxLayout, QWidget)
from qtpy.QtWidgets import QTabWidget, QVBoxLayout, QWidget

# Local imports
from spyder.api.preferences import PluginConfigPage
Expand Down
1 change: 0 additions & 1 deletion spyder/plugins/explorer/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# Local imports
from spyder.config.base import _
from spyder.api.plugins import SpyderPluginWidget
from spyder.utils.qthelpers import add_actions, MENU_SEPARATOR
from spyder.plugins.explorer.widgets.explorer import ExplorerWidget
from spyder.plugins.explorer.confpage import ExplorerConfigPage

Expand Down
7 changes: 3 additions & 4 deletions spyder/plugins/explorer/widgets/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from __future__ import with_statement

# Standard library imports
import mimetypes as mime
import os
import os.path as osp
import re
Expand All @@ -26,15 +25,15 @@
from qtpy.compat import getexistingdirectory, getsavefilename
from qtpy.QtCore import (QDir, QFileInfo, QMimeData, QSize,
QSortFilterProxyModel, Qt, QTimer, QUrl, Signal, Slot)
from qtpy.QtGui import QDrag, QIcon, QKeySequence
from qtpy.QtGui import QDrag, QKeySequence
from qtpy.QtWidgets import (QApplication, QFileIconProvider, QFileSystemModel,
QHBoxLayout, QInputDialog, QLabel, QLineEdit,
QMenu, QMessageBox, QToolButton, QTreeView,
QVBoxLayout, QWidget)

# Local imports
from spyder.config.base import _, get_home_dir, get_image_path
from spyder.config.gui import config_shortcut, get_shortcut, is_dark_interface
from spyder.config.base import _, get_home_dir
from spyder.config.gui import config_shortcut, get_shortcut
from spyder.py3compat import str_lower, to_binary_string, to_text_string
from spyder.utils import encoding
from spyder.utils import icon_manager as ima
Expand Down
3 changes: 1 addition & 2 deletions spyder/plugins/explorer/widgets/fileassociations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
from qtpy.QtCore import QRegExp, QSize, Qt, Signal
from qtpy.QtGui import QCursor, QRegExpValidator
from qtpy.QtWidgets import (QApplication, QDialog, QDialogButtonBox,
QHBoxLayout, QInputDialog, QLabel, QLineEdit,
QHBoxLayout, QLabel, QLineEdit,
QListWidget, QListWidgetItem, QPushButton,
QVBoxLayout, QWidget)
# Local imports
from spyder.config.base import _
from spyder.utils import icon_manager as ima
from spyder.utils.encoding import is_text_file
from spyder.utils.programs import (get_application_icon,
get_installed_applications,
Expand Down
3 changes: 1 addition & 2 deletions spyder/plugins/findinfiles/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
import sys

# Third party imports
from qtpy.QtCore import Signal, Slot, Qt
from qtpy.QtCore import Signal, Qt
from qtpy.QtGui import QKeySequence
from qtpy.QtWidgets import QApplication, QVBoxLayout

# Local imports
from spyder.api.plugins import SpyderPluginWidget
from spyder.config.base import _
from spyder.config.utils import get_edit_extensions
from spyder.utils.misc import getcwd_or_home
from spyder.utils import icon_manager as ima
from spyder.utils.qthelpers import create_action, MENU_SEPARATOR
Expand Down
1 change: 0 additions & 1 deletion spyder/plugins/findinfiles/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from spyder.py3compat import to_text_string, PY2
from spyder.utils import icon_manager as ima
from spyder.utils.encoding import is_text_file, to_unicode_from_fs
from spyder.utils.misc import getcwd_or_home
from spyder.widgets.comboboxes import PatternComboBox
from spyder.widgets.onecolumntree import OneColumnTree
from spyder.utils.misc import regexp_error_msg
Expand Down
3 changes: 1 addition & 2 deletions spyder/plugins/help/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# Third party imports
from qtpy.QtCore import QUrl, Signal, Slot
from qtpy.QtWidgets import (QActionGroup, QComboBox, QHBoxLayout,
QLabel, QLineEdit, QMenu, QMessageBox,
QToolButton, QVBoxLayout)
QLabel, QLineEdit, QMessageBox)
from qtpy.QtWebEngineWidgets import QWebEnginePage, WEBENGINE

# Local imports
Expand Down
3 changes: 3 additions & 0 deletions spyder/plugins/ipythonconsole/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

"""IPython Console config page."""

# Standard library imports
import sys

# Third party imports
from qtpy.QtCore import Qt
from qtpy.QtWidgets import (QGridLayout, QGroupBox, QHBoxLayout, QLabel,
QTabWidget, QVBoxLayout)

# Local imports
from spyder.api.preferences import PluginConfigPage
from spyder.config.base import _
from spyder.py3compat import PY2
Expand Down
5 changes: 2 additions & 3 deletions spyder/plugins/ipythonconsole/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
from qtpy.QtCore import Qt, Signal, Slot
from qtpy.QtGui import QColor
from qtpy.QtWebEngineWidgets import WEBENGINE
from qtpy.QtWidgets import (QActionGroup, QApplication, QGridLayout,
QGroupBox, QHBoxLayout, QLabel, QMenu, QMessageBox,
QTabWidget, QVBoxLayout, QWidget)
from qtpy.QtWidgets import (QActionGroup, QApplication, QHBoxLayout, QMenu,
QMessageBox, QVBoxLayout, QWidget)
from traitlets.config.loader import Config, load_pyconfig_files
from zmq.ssh import tunnel as zmqtunnel

Expand Down
Loading

0 comments on commit b67cf68

Please sign in to comment.