Skip to content

Commit

Permalink
resolve depreceations
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp committed Sep 26, 2020
1 parent ac241d9 commit e802d7b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 17 deletions.
4 changes: 2 additions & 2 deletions psyplot_gui/help_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from tempfile import mkdtemp
try:
from sphinx.application import Sphinx
from sphinx.util import get_module_source
from sphinx.pycode import ModuleAnalyzer
try:
from psyplot.sphinxext.extended_napoleon import (
ExtendedNumpyDocstring as NumpyDocstring,
Expand Down Expand Up @@ -740,7 +740,7 @@ def is_importable(self, modname):
bool
True if sphinx can import the module"""
try:
get_module_source(modname)
ModuleAnalyzer.get_module_source(modname)
return True
except Exception:
return False
Expand Down
4 changes: 3 additions & 1 deletion psyplot_gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,9 @@ def edit_preferences(self, exec_=None):
widget = PrefPageClass(dlg)
widget.initialize()
dlg.add_page(widget)
available_width = 0.667 * QDesktopWidget().availableGeometry().width()
available_width = int(
0.667*QDesktopWidget().availableGeometry().width()
)
width = dlg.sizeHint().width()
height = dlg.sizeHint().height()
# The preferences window should cover at least one third of the screen
Expand Down
14 changes: 8 additions & 6 deletions psyplot_gui/sphinx_supp/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@
extensions.append('sphinx.ext.intersphinx')
del use_intersphinx

autodoc_default_flags = ['show_inheritance']
autodoc_default_options = {
'show_inheritance': True
}

try:
import autodocsumm
except ImportError:
pass
else:
extensions.append('autodocsumm')
autodoc_default_flags.append('autosummary')
autodoc_default_options['autosummary'] = True
not_document_data = ['psyplot.config.rcsetup.defaultParams',
'psyplot.config.rcsetup.rcParams']

Expand All @@ -67,16 +69,16 @@
autoclass_content = 'both'

# General information about the project.
project = u'Help'
copyright = u'2016, Philipp Sommer'
author = u'Philipp Sommer'
project = 'psyplot Help'
copyright = psyplot_gui.__copyright__
author = psyplot_gui.__author__

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = re.match('\d+\.\d+\.\d+', psyplot_gui.__version__).group()
version = re.match(r'\d+\.\d+\.\d+', psyplot_gui.__version__).group()
# The full version, including alpha/beta/rc tags.
release = psyplot_gui.__version__
#
Expand Down
2 changes: 1 addition & 1 deletion tests/test_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _test_object_docu(self, symbol):
self.insert_text('object')
QTest.keyClicks(c._control, symbol)
sig = '' if six.PY2 else re.sub(
'^\(\s*self,\s*', '(', str(signature(object.__init__)))
r'^\(\s*self,\s*', '(', str(signature(object.__init__)))
header = "object" + sig
bars = '=' * len(header)
self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dataframeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import _base_testing as bt
import unittest
from pandas.util.testing import assert_frame_equal
from pandas.testing import assert_frame_equal
from psyplot_gui.compat.qtcompat import Qt, QApplication


Expand Down
26 changes: 20 additions & 6 deletions tests/test_plot_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
asstring)


def get_col_num(ax):
try:
return ax.get_subplotspec().colspan.start
except AttributeError: # matplotlib<3.2
return ax.colNum


def get_row_num(ax):
try:
return ax.get_subplotspec().rowspan.start
except AttributeError: # matplotlib<3.2
return ax.rowNum


class PlotCreatorTest(bt.PsyPlotGuiTestCase):
"""Tests concerning the plot creator"""

Expand Down Expand Up @@ -147,8 +161,8 @@ def test_add_subplots(self):
self.assertEqual([ax.numRows for ax in axes], [2] * nvar)
rows = [0, 0, 1] * nfigs
cols = [0, 1, 0] * nfigs
self.assertEqual([ax.rowNum for ax in axes], rows)
self.assertEqual([ax.colNum for ax in axes], cols)
self.assertEqual([get_row_num(ax) for ax in axes], rows)
self.assertEqual([get_col_num(ax) for ax in axes], cols)
fig_nums = list(chain(*([i] * 3 for i in range(1, nfigs + 1))))
self.assertEqual([ax.get_figure().number for ax in axes], fig_nums)
plt.close('all')
Expand All @@ -170,8 +184,8 @@ def test_add_single_subplots(self):
# test rows, cols and figure numbers
self.assertEqual([ax.numCols for ax in axes], [2] * nvar)
self.assertEqual([ax.numRows for ax in axes], [2] * nvar)
self.assertEqual([ax.rowNum for ax in axes], [0] * nvar)
self.assertEqual([ax.colNum for ax in axes], [1] * nvar)
self.assertEqual([get_row_num(ax) for ax in axes], [0] * nvar)
self.assertEqual([get_col_num(ax) for ax in axes], [1] * nvar)
self.assertEqual([ax.get_figure().number for ax in axes], list(
range(1, nvar + 1)))
plt.close('all')
Expand Down Expand Up @@ -203,8 +217,8 @@ def test_axescreator_subplots(self):
# test rows, cols and figure numbers
self.assertEqual([ax.numCols for ax in axes], [2] * nvar)
self.assertEqual([ax.numRows for ax in axes], [2] * nvar)
self.assertEqual([ax.rowNum for ax in axes], [0] * nvar)
self.assertEqual([ax.colNum for ax in axes], [1] * nvar)
self.assertEqual([get_row_num(ax) for ax in axes], [0] * nvar)
self.assertEqual([get_col_num(ax) for ax in axes], [1] * nvar)
self.assertEqual([ax.get_figure().number for ax in axes], list(
range(1, nvar + 1)))
# close figures
Expand Down

0 comments on commit e802d7b

Please sign in to comment.