Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mnt: fix a couple of things from codeql #15

Merged
merged 5 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Select the backend
:toctree: _as_gen


mpl_gui.select_gui_toolkit
select_gui_toolkit


Interactivity
Expand All @@ -22,9 +22,9 @@ Interactivity
:toctree: _as_gen


mpl_gui.ion
mpl_gui.ioff
mpl_gui.is_interactive
ion
ioff
is_interactive


Unmanaged Figures
Expand All @@ -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



Expand All @@ -55,21 +55,21 @@ Display



mpl_gui.display
mpl_gui.demote_figure
display
demote_figure



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:

Expand All @@ -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
Expand All @@ -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



Expand All @@ -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



Expand All @@ -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
Expand All @@ -143,7 +143,7 @@ Access managed figures
:toctree: _as_gen


mpl_gui.global_figures.by_label
by_label


Show and close managed Figures
Expand All @@ -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
Expand All @@ -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
4 changes: 0 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions mpl_gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -326,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):
Expand Down
7 changes: 3 additions & 4 deletions mpl_gui/_manage_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading