Skip to content

Commit 5822ca6

Browse files
committed
Style corrections after Sandor's work
1 parent aa70a6f commit 5822ca6

26 files changed

+27
-57
lines changed

spyderlib/plugins/__init__.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@
1818
# pylint: disable=R0911
1919
# pylint: disable=R0201
2020

21+
# Qt imports
22+
from spyderlib.qt import PYQT5
2123
from spyderlib.qt.QtGui import (QDockWidget, QWidget, QShortcut, QCursor,
2224
QKeySequence, QMainWindow, QApplication)
2325
from spyderlib.qt.QtCore import Qt, Signal
2426

27+
# Stdlib imports
28+
import sys
29+
2530
# Local imports
2631
from spyderlib.utils.qthelpers import toggle_actions, get_icon, create_action
2732
from spyderlib.baseconfig import _
@@ -30,8 +35,6 @@
3035
from spyderlib.guiconfig import get_font, set_font
3136
from spyderlib.plugins.configdialog import SpyderConfigPage
3237
from spyderlib.py3compat import configparser, is_text_string
33-
import sys
34-
from spyderlib.qt import PYQT5
3538

3639

3740
class PluginConfigPage(SpyderConfigPage):
@@ -182,8 +185,7 @@ def __init__(self, main = None, **kwds):
182185
# We decided to create our own toggle action instead of using
183186
# the one that comes with dockwidget because it's not possible
184187
# to raise and focus the plugin with it.
185-
self.toggle_view_action = None
186-
188+
self.toggle_view_action = None
187189

188190
def initialize_plugin(self):
189191
"""Initialize plugin: connect signals, setup actions, ..."""
@@ -354,7 +356,6 @@ def set_plugin_font(self, font, option=None):
354356
"""Set plugin font option"""
355357
set_font(font, self.CONF_SECTION, option)
356358

357-
358359
def __show_message(self, message, timeout=0):
359360
"""Show message in main window's status bar"""
360361
self.main.statusBar().showMessage(message, timeout)
@@ -418,14 +419,14 @@ class SpyderPluginWidget(QWidget, SpyderPluginMixin):
418419
sig_option_changed = Signal(str, object)
419420
show_message = Signal(str, int)
420421
update_plugin_title = Signal()
422+
421423
if PYQT5:
422424
def __init__(self, parent, **kwds):
423425
super().__init__(**kwds)
424426
else:
425427
def __init__(self, parent):
426428
QWidget.__init__(self, parent)
427429
SpyderPluginMixin.__init__(self, parent)
428-
429430

430431
def get_plugin_title(self):
431432
"""

spyderlib/plugins/console.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# pylint: disable=R0911
1212
# pylint: disable=R0201
1313

14+
from spyderlib.qt import PYQT5
1415
from spyderlib.qt.QtGui import (QVBoxLayout, QFontDialog, QInputDialog,
1516
QLineEdit, QMenu)
1617
from spyderlib.qt.QtCore import Signal, Slot
@@ -34,8 +35,7 @@
3435
from spyderlib.plugins import SpyderPluginWidget
3536
from spyderlib.py3compat import to_text_string, getcwd
3637

37-
from spyderlib.qt import PYQT5
38-
38+
3939
class Console(SpyderPluginWidget):
4040
"""
4141
Console widget
@@ -47,7 +47,6 @@ class Console(SpyderPluginWidget):
4747
show_message = Signal(str, int)
4848
update_plugin_title = Signal()
4949

50-
5150
def __init__(self, parent=None, namespace=None, commands=[], message=None,
5251
exitfunc=None, profile=False, multithreaded=False):
5352
if PYQT5:
@@ -69,7 +68,6 @@ def __init__(self, parent=None, namespace=None, commands=[], message=None,
6968
self.shell.go_to_error.connect(self.go_to_error)
7069
self.shell.focus_changed.connect(lambda: self.focus_changed.emit())
7170

72-
7371
# Redirecting some signals:
7472
self.shell.redirect_stdio.connect(lambda state:
7573
self.redirect_stdio.emit(state))
@@ -94,7 +92,6 @@ def __init__(self, parent=None, namespace=None, commands=[], message=None,
9492

9593
# Accepting drops
9694
self.setAcceptDrops(True)
97-
9895

9996
#------ Private API --------------------------------------------------------
10097
def set_historylog(self, historylog):

spyderlib/plugins/editor.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# pylint: disable=R0911
1212
# pylint: disable=R0201
1313

14+
from spyderlib.qt import PYQT5
1415
from spyderlib.qt.QtGui import (QVBoxLayout, QPrintDialog, QSplitter, QToolBar,
1516
QAction, QApplication, QDialog, QWidget,
1617
QPrinter, QActionGroup, QInputDialog, QMenu,
@@ -45,7 +46,6 @@
4546
get_run_configuration,
4647
ALWAYS_OPEN_FIRST_RUN_OPTION)
4748
from spyderlib.py3compat import to_text_string, getcwd, qbytearray_to_str
48-
from spyderlib.qt import PYQT5
4949

5050

5151
def _load_all_breakpoints():
@@ -342,7 +342,6 @@ class Editor(SpyderPluginWidget):
342342
run_in_current_extconsole = Signal(str, str, str, bool)
343343
show_message = Signal(str, int)
344344
update_plugin_title = Signal()
345-
346345

347346
def __init__(self, parent, ignore_last_opened_files=False):
348347
if PYQT5:
@@ -2000,12 +1999,9 @@ def debug_command(self, command):
20001999
self.main.extconsole.execute_python_code(command)
20012000
else:
20022001
self.main.ipyconsole.write_to_stdin(command)
2003-
20042002
focus_widget = self.main.ipyconsole.get_focus_widget()
2005-
20062003
if focus_widget:
20072004
focus_widget.setFocus()
2008-
20092005
else:
20102006
self.main.extconsole.execute_python_code(command)
20112007

spyderlib/plugins/explorer.py

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class Explorer(ExplorerWidget, SpyderPluginMixin):
3737
open_dir = Signal(str)
3838
show_message = Signal(str, int)
3939
update_plugin_title = Signal()
40-
4140

4241
def __init__(self, parent=None):
4342
ExplorerWidget.__init__(self, parent=parent,

spyderlib/plugins/externalconsole.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# pylint: disable=R0201
1313

1414
# Qt imports
15+
from spyderlib.qt import PYQT5
1516
from spyderlib.qt.QtGui import (QVBoxLayout, QMessageBox, QInputDialog,
1617
QLineEdit, QPushButton, QGroupBox, QLabel,
1718
QTabWidget, QFontComboBox, QHBoxLayout,
@@ -41,7 +42,6 @@
4142
from spyderlib.plugins.runconfig import get_run_configuration
4243
from spyderlib.py3compat import to_text_string, is_text_string, getcwd
4344
from spyderlib import dependencies
44-
from spyderlib.qt import PYQT5
4545

4646
MPL_REQVER = '>=1.0'
4747
dependencies.add("matplotlib", _("Interactive data plotting in the consoles"),
@@ -453,7 +453,6 @@ class ExternalConsole(SpyderPluginWidget):
453453
show_message = Signal(str, int)
454454
update_plugin_title = Signal()
455455
go_to_error = Signal(str)
456-
457456

458457
def __init__(self, parent, light_mode):
459458
if PYQT5:

spyderlib/plugins/findinfiles.py

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class FindInFiles(FindInFilesWidget, SpyderPluginMixin):
3131
redirect_stdio = Signal(bool)
3232
show_message = Signal(str, int)
3333
update_plugin_title = Signal()
34-
3534

3635
def __init__(self, parent=None):
3736
supported_encodings = self.get_option('supported_encodings')

spyderlib/plugins/history.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
"""Console History Plugin"""
88

9+
from spyderlib.qt import PYQT5
910
from spyderlib.qt.QtGui import (QVBoxLayout, QFontDialog, QInputDialog,
1011
QToolButton, QMenu, QFontComboBox, QGroupBox)
1112
from spyderlib.qt.QtCore import Signal, Slot
@@ -24,7 +25,6 @@
2425
from spyderlib.widgets.findreplace import FindReplace
2526
from spyderlib.plugins import SpyderPluginWidget, PluginConfigPage
2627
from spyderlib.py3compat import to_text_string, is_text_string
27-
from spyderlib.qt import PYQT5
2828

2929

3030
class HistoryConfigPage(PluginConfigPage):

spyderlib/plugins/inspector.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
"""Object Inspector Plugin"""
88

9+
from spyderlib.qt import PYQT5
910
from spyderlib.qt.QtGui import (QHBoxLayout, QVBoxLayout, QLabel, QSizePolicy,
1011
QMenu, QToolButton, QGroupBox, QFontComboBox,
1112
QActionGroup, QFontDialog, QWidget, QComboBox,
@@ -34,7 +35,6 @@
3435
from spyderlib.widgets.externalshell.pythonshell import ExtPythonShellWidget
3536
from spyderlib.plugins import SpyderPluginWidget, PluginConfigPage
3637
from spyderlib.py3compat import to_text_string, get_meth_class_inst
37-
from spyderlib.qt import PYQT5
3838

3939
#XXX: Hardcoded dependency on optional IPython plugin component
4040
# that requires the hack to make this work without IPython
@@ -352,12 +352,11 @@ class ObjectInspector(SpyderPluginWidget):
352352
CONF_SECTION = 'inspector'
353353
CONFIGWIDGET_CLASS = ObjectInspectorConfigPage
354354
LOG_PATH = get_conf_path(CONF_SECTION)
355-
# Signals
355+
356356
focus_changed = Signal()
357357
show_message = Signal(str, int)
358358
update_plugin_title = Signal()
359-
focus_changed = Signal()
360-
359+
focus_changed = Signal()
361360

362361
def __init__(self, parent):
363362
if PYQT5:
@@ -378,7 +377,6 @@ def __init__(self, parent):
378377
self.set_default_color_scheme()
379378

380379
self.plain_text = PlainText(self)
381-
382380
self.rich_text = RichText(self)
383381

384382
color_scheme = get_color_scheme(self.get_option('color_scheme_name'))

spyderlib/plugins/ipythonconsole.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import sys
2222

2323
# Qt imports
24+
from spyderlib.qt import PYQT5
2425
from spyderlib.qt.QtGui import (QVBoxLayout, QHBoxLayout, QFormLayout,
2526
QMessageBox, QGroupBox, QDialogButtonBox,
2627
QDialog, QTabWidget, QFontComboBox,
@@ -59,7 +60,6 @@
5960
from spyderlib.widgets.findreplace import FindReplace
6061
from spyderlib.plugins import SpyderPluginWidget, PluginConfigPage
6162
from spyderlib.py3compat import to_text_string, u
62-
from spyderlib.qt import PYQT5
6363

6464

6565
SYMPY_REQVER = '>=0.7.0'

spyderlib/plugins/projectexplorer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
class ProjectExplorer(ProjectExplorerWidget, SpyderPluginMixin):
2121
"""Project explorer plugin"""
2222
CONF_SECTION = 'project_explorer'
23+
2324
open_terminal = Signal(str)
2425
open_interpreter = Signal(str)
2526
pythonpath_changed = Signal()
@@ -32,7 +33,6 @@ class ProjectExplorer(ProjectExplorerWidget, SpyderPluginMixin):
3233
redirect_stdio = Signal(bool)
3334
show_message = Signal(str, int)
3435
update_plugin_title = Signal()
35-
3636

3737
def __init__(self, parent=None):
3838
ProjectExplorerWidget.__init__(self, parent=parent,

spyderlib/plugins/shortcuts.py

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ def reset(self):
216216
self.endResetModel()
217217

218218

219-
220219
class ShortcutsDelegate(QItemDelegate):
221220
def __init__(self, parent=None):
222221
QItemDelegate.__init__(self, parent)

spyderlib/plugins/workingdirectory.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# pylint: disable=R0911
1212
# pylint: disable=R0201
1313

14+
from spyderlib.qt import PYQT5
1415
from spyderlib.qt.QtGui import (QToolBar, QLabel, QGroupBox, QVBoxLayout,
1516
QHBoxLayout, QButtonGroup)
1617
from spyderlib.qt.QtCore import Signal, Slot
@@ -29,7 +30,6 @@
2930
from spyderlib.plugins import SpyderPluginMixin, PluginConfigPage
3031
from spyderlib.py3compat import to_text_string, getcwd
3132

32-
from spyderlib.qt import PYQT5
3333

3434
class WorkingDirectoryConfigPage(PluginConfigPage):
3535
def setup_page(self):
@@ -141,6 +141,7 @@ class WorkingDirectory(QToolBar, SpyderPluginMixin):
141141
CONF_SECTION = 'workingdir'
142142
CONFIGWIDGET_CLASS = WorkingDirectoryConfigPage
143143
LOG_PATH = get_conf_path(CONF_SECTION)
144+
144145
sig_option_changed = Signal(str, object)
145146
set_previous_enabled = Signal(bool)
146147
set_next_enabled = Signal(bool)
@@ -150,7 +151,6 @@ class WorkingDirectory(QToolBar, SpyderPluginMixin):
150151
set_current_console_wd = Signal(str)
151152
show_message = Signal(str, int)
152153
update_plugin_title = Signal()
153-
154154

155155
def __init__(self, parent, workdir=None, **kwds):
156156
if PYQT5:
@@ -159,7 +159,6 @@ def __init__(self, parent, workdir=None, **kwds):
159159
QToolBar.__init__(self, parent)
160160
SpyderPluginMixin.__init__(self, parent)
161161

162-
163162
# Initialize plugin
164163
self.initialize_plugin()
165164

spyderlib/widgets/arrayeditor.py

-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ def reset(self):
321321
self.endResetModel()
322322

323323

324-
325324
class ArrayDelegate(QItemDelegate):
326325
"""Array Editor Item Delegate"""
327326
def __init__(self, dtype, parent=None):

spyderlib/widgets/dataframeeditor.py

-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ def reset(self):
360360
self.endResetModel()
361361

362362

363-
364363
class DataFrameView(QTableView):
365364
"""Data Frame view class"""
366365
def __init__(self, parent, model):

spyderlib/widgets/dependencies.py

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def reset(self):
9595
self.endResetModel()
9696

9797

98-
9998
class DependenciesDelegate(QItemDelegate):
10099
def __init__(self, parent=None):
101100
QItemDelegate.__init__(self, parent)

spyderlib/widgets/dicteditor.py

-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ def sort(self, column, order=Qt.AscendingOrder):
218218
self.beginResetModel()
219219
self.endResetModel()
220220

221-
222221
def columnCount(self, qindex=QModelIndex()):
223222
"""Array column number"""
224223
return 4
@@ -319,7 +318,6 @@ def reset(self):
319318
self.beginResetModel()
320319
self.endResetModel()
321320

322-
323321
class DictModel(ReadOnlyDictModel):
324322
"""DictEditor Table Model"""
325323

spyderlib/widgets/externalshell/pythonshell.py

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class ExtPythonShellWidget(PythonShellWidget):
4040
wait_for_ready_read = Signal()
4141
go_to_error = Signal(str)
4242
focus_changed = Signal()
43-
4443

4544
def __init__(self, parent, history_filename, profile=False):
4645
PythonShellWidget.__init__(self, parent, history_filename, profile)

spyderlib/widgets/externalshell/sitecustomize.py

-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ def __init__(self, *args, **kwargs):
362362
kwargs['testRunner'] = kwargs.pop('testRunner', test_runner)
363363
kwargs['exit'] = False
364364
TestProgram.__init__(self, *args, **kwargs)
365-
366365
unittest.main = IPyTesProgram
367366

368367
# Pandas monkey-patches

spyderlib/widgets/externalshell/systemshell.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import os
1010

1111
from spyderlib.qt.QtGui import QMessageBox
12-
from spyderlib.qt.QtCore import QProcess, Signal, QTextCodec
13-
from spyderlib.qt.QtCore import QProcessEnvironment
12+
from spyderlib.qt.QtCore import (QProcess, Signal, QTextCodec,
13+
QProcessEnvironment)
1414
LOCALE_CODEC = QTextCodec.codecForLocale()
1515
CP850_CODEC = QTextCodec.codecForName('cp850')
1616

spyderlib/widgets/projectexplorer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from __future__ import print_function
1212

13+
from spyderlib.qt import PYQT5
1314
from spyderlib.qt.QtGui import (QVBoxLayout, QLabel, QHBoxLayout, QWidget,
1415
QFileIconProvider, QMessageBox, QInputDialog,
1516
QLineEdit, QPushButton, QHeaderView,
@@ -31,7 +32,6 @@
3132
from spyderlib.widgets.formlayout import fedit
3233
from spyderlib.widgets.pathmanager import PathManager
3334
from spyderlib.py3compat import to_text_string, getcwd, pickle
34-
from spyderlib.qt import PYQT5
3535

3636

3737
def has_children_files(path, include, exclude, show_all):

0 commit comments

Comments
 (0)