Skip to content

Commit

Permalink
Merge pull request #276 from jitseniesen/drop-py2
Browse files Browse the repository at this point in the history
PR: Drop support for Python 2
  • Loading branch information
jitseniesen authored May 26, 2020
2 parents 00c3347 + 7ca8769 commit 9e6d82f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 29 deletions.
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def get_version(module='spyder_notebook'):
name='spyder-notebook',
version=get_version(),
keywords='spyder jupyter notebook',
python_requires='>=3.5',
url='https://github.com/spyder-ide/spyder-notebook',
license='MIT',
author='Spyder Development Team',
Expand All @@ -56,6 +57,5 @@ def get_version(module='spyder_notebook'):
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3']
)
2 changes: 1 addition & 1 deletion spyder_notebook/notebookplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def get_plugin_actions(self):

def register_plugin(self):
"""Register plugin in Spyder's main window."""
super(NotebookPlugin, self).register_plugin()
super().register_plugin()
self.focus_changed.connect(self.main.plugin_focus_changed)
self.ipyconsole = self.main.ipyconsole
self.create_new_client(give_focus=False)
Expand Down
2 changes: 1 addition & 1 deletion spyder_notebook/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SpyderNotebookServer(NotebookApp):
def init_webapp(self):
"""initialize tornado webapp and httpserver.
"""
super(SpyderNotebookServer, self).init_webapp()
super().init_webapp()

default_handlers = [
(ujoin(self.base_url, r'/notebook/(.*)'), NotebookHandler),
Expand Down
18 changes: 3 additions & 15 deletions spyder_notebook/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ def notebook(qtbot):
return notebook_plugin


@pytest.fixture
def tmpdir_under_home():
"""Create a temporary directory under the home dir."""
tmpdir = tempfile.mkdtemp(dir=get_home_dir())
yield tmpdir
print('rmtree', tmpdir)
shutil.rmtree(tmpdir)


# =============================================================================
# Tests
# =============================================================================
Expand Down Expand Up @@ -174,15 +165,12 @@ def test_close_nonexisting_notebook(notebook, qtbot):


@flaky(max_runs=3)
def test_open_notebook(notebook, qtbot, tmpdir_under_home):
def test_open_notebook(notebook, qtbot, tmpdir):
"""Test that a notebook can be opened from a non-ascii directory."""
# Move the test file to non-ascii directory
test_notebook = osp.join(LOCATION, 'test.ipynb')

# For Python 2, non-ascii directory needs to be under home dir
test_notebook_non_ascii = osp.join(tmpdir_under_home,
u'äöüß', 'test.ipynb')
os.mkdir(os.path.join(tmpdir_under_home, u'äöüß'))
test_notebook_non_ascii = osp.join(str(tmpdir), u'äöüß', 'test.ipynb')
os.mkdir(os.path.join(str(tmpdir), u'äöüß'))
shutil.copyfile(test_notebook, test_notebook_non_ascii)

# Wait for prompt
Expand Down
9 changes: 2 additions & 7 deletions spyder_notebook/widgets/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

# Spyder imports
from spyder.config.base import _, get_image_path, get_module_source_path
from spyder.py3compat import is_text_string
from spyder.utils.qthelpers import add_actions
from spyder.utils import sourcecode
from spyder.widgets.findreplace import FindReplace
Expand All @@ -39,10 +38,6 @@
# -----------------------------------------------------------------------------
# Using the same css file from the Help plugin for now. Maybe
# later it'll be a good idea to create a new one.
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError # Python 2

PLUGINS_PATH = get_module_source_path('spyder', 'plugins')
CSS_PATH = osp.join(PLUGINS_PATH, 'help', 'utils', 'static', 'css')
Expand Down Expand Up @@ -126,7 +121,7 @@ class NotebookClient(QWidget):

def __init__(self, plugin, filename, ini_message=None):
"""Constructor."""
super(NotebookClient, self).__init__(plugin)
super().__init__(plugin)

if os.name == 'nt':
filename = filename.replace('/', '\\')
Expand Down Expand Up @@ -182,7 +177,7 @@ def register(self, server_info):

def go_to(self, url_or_text):
"""Go to page utl."""
if is_text_string(url_or_text):
if isinstance(url_or_text, str):
url = QUrl(url_or_text)
else:
url = url_or_text
Expand Down
2 changes: 1 addition & 1 deletion spyder_notebook/widgets/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DOMWidget(WebView):

def __init__(self, parent):
"""Constructor."""
super(DOMWidget, self).__init__(parent)
super().__init__(parent)
if WEBENGINE:
self.dom = self.page()
else:
Expand Down

0 comments on commit 9e6d82f

Please sign in to comment.