From 09e9a9d712f4bf0af672c839257b644dac790b62 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 17 Oct 2023 18:18:22 -0400 Subject: [PATCH 1/5] MNT: don't use else close on for-loop as we return inside --- mpl_gui/_manage_backend.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mpl_gui/_manage_backend.py b/mpl_gui/_manage_backend.py index 1929b08..6e51de2 100644 --- a/mpl_gui/_manage_backend.py +++ b/mpl_gui/_manage_backend.py @@ -79,10 +79,9 @@ def select_gui_toolkit(newbackend=None): except ImportError: continue - else: - # Switching to Agg should always succeed; if it doesn't, let the - # exception propagate out. - return select_gui_toolkit("agg") + # Switching to Agg should always succeed; if it doesn't, let the + # exception propagate out. + return select_gui_toolkit("agg") if isinstance(newbackend, str): # Backends are implemented as modules, but "inherit" default method From 7ad3c9ca1684199799b141a16308bc99636f5a0a Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 17 Oct 2023 18:19:14 -0400 Subject: [PATCH 2/5] MNT: remove redundant config in docs conf.py --- docs/source/conf.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 8e7bafc..8453e3f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -108,10 +108,6 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - default_role = "obj" nitpicky = True From e9ba62019b09a8ed597901a7ce3144e78dd1a4d0 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 17 Oct 2023 18:23:09 -0400 Subject: [PATCH 3/5] MNT: use explict None return --- mpl_gui/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mpl_gui/__init__.py b/mpl_gui/__init__.py index 2dcb674..d36a205 100644 --- a/mpl_gui/__init__.py +++ b/mpl_gui/__init__.py @@ -306,7 +306,8 @@ def close(self, val): """ if val == "all": - return self.close_all() + self.close_all() + return # or do we want to close _all_ of the figures with a given label / number? if isinstance(val, str): fig = self.by_label[val] From 916a46dcf9e83e976933e9647a8911f6f1a3bb87 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 18 Oct 2023 14:10:13 -0400 Subject: [PATCH 4/5] MNT: more codeql warnings addressed --- mpl_gui/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mpl_gui/__init__.py b/mpl_gui/__init__.py index d36a205..278f505 100644 --- a/mpl_gui/__init__.py +++ b/mpl_gui/__init__.py @@ -250,7 +250,7 @@ def show_all(self, *, block=None, timeout=None): if timeout is None: timeout = self._timeout self._ensure_all_figures_promoted() - display(*self.figures, block=self._block, timeout=self._timeout) + display(*self.figures, block=self._block, timeout=timeout) # alias to easy pyplot compatibility show = show_all @@ -327,6 +327,7 @@ def close(self, val): _FigureCanvasBase(figure=fig) assert fig.canvas.manager is None self._fig_to_number.pop(fig, None) + return class FigureContext(FigureRegistry): From 8590c35450d65a65b7b717c60b3ef93a611a7d23 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 28 Dec 2024 21:10:53 -0500 Subject: [PATCH 5/5] DOC: account for new warnings in sphinx autosummary --- docs/source/api.rst | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/source/api.rst b/docs/source/api.rst index f016221..90c7985 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -12,7 +12,7 @@ Select the backend :toctree: _as_gen - mpl_gui.select_gui_toolkit + select_gui_toolkit Interactivity @@ -22,9 +22,9 @@ Interactivity :toctree: _as_gen - mpl_gui.ion - mpl_gui.ioff - mpl_gui.is_interactive + ion + ioff + is_interactive Unmanaged Figures @@ -41,9 +41,9 @@ a `matplotlib.figure.Figure` instance and creating children in one line. - mpl_gui.figure - mpl_gui.subplots - mpl_gui.subplot_mosaic + figure + subplots + subplot_mosaic @@ -55,8 +55,8 @@ Display - mpl_gui.display - mpl_gui.demote_figure + display + demote_figure @@ -64,12 +64,12 @@ Locally Managed Figures ----------------------- -.. autoclass:: mpl_gui.FigureRegistry +.. autoclass:: FigureRegistry :no-undoc-members: :show-inheritance: -.. autoclass:: mpl_gui.FigureContext +.. autoclass:: FigureContext :no-undoc-members: :show-inheritance: @@ -80,9 +80,9 @@ Create Figures and Axes :toctree: _as_gen - mpl_gui.FigureRegistry.figure - mpl_gui.FigureRegistry.subplots - mpl_gui.FigureRegistry.subplot_mosaic + FigureRegistry.figure + FigureRegistry.subplots + FigureRegistry.subplot_mosaic Access managed figures @@ -92,9 +92,9 @@ Access managed figures :toctree: _as_gen - mpl_gui.FigureRegistry.by_label - mpl_gui.FigureRegistry.by_number - mpl_gui.FigureRegistry.figures + FigureRegistry.by_label + FigureRegistry.by_number + FigureRegistry.figures @@ -106,10 +106,10 @@ Show and close managed Figures :toctree: _as_gen - mpl_gui.FigureRegistry.show_all - mpl_gui.FigureRegistry.close_all - mpl_gui.FigureRegistry.show - mpl_gui.FigureRegistry.close + FigureRegistry.show_all + FigureRegistry.close_all + FigureRegistry.show + FigureRegistry.close @@ -130,9 +130,9 @@ Create Figures and Axes :toctree: _as_gen - mpl_gui.global_figures.figure - mpl_gui.global_figures.subplots - mpl_gui.global_figures.subplot_mosaic + figure + subplots + subplot_mosaic Access managed figures @@ -143,7 +143,7 @@ Access managed figures :toctree: _as_gen - mpl_gui.global_figures.by_label + by_label Show and close managed Figures @@ -156,10 +156,10 @@ Show and close managed Figures - mpl_gui.global_figures.show - mpl_gui.global_figures.show_all - mpl_gui.global_figures.close_all - mpl_gui.global_figures.close + show + show_all + close_all + close Interactivity @@ -170,6 +170,6 @@ Interactivity - mpl_gui.global_figures.ion - mpl_gui.global_figures.ioff - mpl_gui.global_figures.is_interactive + ion + ioff + is_interactive