Skip to content

Commit d929395

Browse files
committed
API: remove helper fabrication functions from top-level
1 parent edafd11 commit d929395

File tree

2 files changed

+16
-29
lines changed

2 files changed

+16
-29
lines changed

docs/source/api.rst

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,6 @@ Interactivity
2828
Figure Fabrication
2929
------------------
3030

31-
Un-managed
32-
++++++++++
33-
34-
35-
.. autosummary::
36-
:toctree: _as_gen
37-
:nosignatures:
38-
39-
mpl_gui.figure
40-
mpl_gui.subplots
41-
mpl_gui.subplot_mosaic
42-
43-
44-
.. autosummary::
45-
:toctree: _as_gen
46-
:nosignatures:
47-
48-
mpl_gui.promote_figure
4931

5032
Managed
5133
+++++++

mpl_gui/__init__.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@
2525
from ._manage_interactive import ion, ioff, is_interactive # noqa: F401
2626
from ._manage_backend import select_gui_toolkit # noqa: F401
2727
from ._manage_backend import current_backend_module as _cbm
28-
from ._promotion import promote_figure as promote_figure
29-
from ._creation import figure, subplots, subplot_mosaic # noqa: F401
28+
from ._promotion import promote_figure as _promote_figure
29+
from ._creation import (
30+
figure as _figure,
31+
subplots as _subplots,
32+
subplot_mosaic as _subplot_mosaic,
33+
)
34+
3035

3136
from ._version import get_versions
3237

@@ -70,7 +75,7 @@ def show(figs, *, block=None, timeout=0):
7075
if fig.canvas.manager is not None:
7176
managers.append(fig.canvas.manager)
7277
else:
73-
managers.append(promote_figure(fig, num=None))
78+
managers.append(_promote_figure(fig, num=None))
7479

7580
if block is None:
7681
block = not is_interactive()
@@ -151,7 +156,7 @@ def registry_cleanup(fig_wr):
151156
fig.set_label(f"{self._prefix}{fignum:d}")
152157
self._fig_to_number[fig] = fignum
153158
if is_interactive():
154-
promote_figure(fig, num=fignum)
159+
_promote_figure(fig, num=fignum)
155160
return fig
156161

157162
@property
@@ -183,25 +188,25 @@ def by_number(self):
183188
self._ensure_all_figures_promoted()
184189
return {fig.canvas.manager.num: fig for fig in self.figures}
185190

186-
@functools.wraps(figure)
191+
@functools.wraps(_figure)
187192
def figure(self, *args, **kwargs):
188-
fig = figure(*args, **kwargs)
193+
fig = _figure(*args, **kwargs)
189194
return self._register_fig(fig)
190195

191-
@functools.wraps(subplots)
196+
@functools.wraps(_subplots)
192197
def subplots(self, *args, **kwargs):
193-
fig, axs = subplots(*args, **kwargs)
198+
fig, axs = _subplots(*args, **kwargs)
194199
return self._register_fig(fig), axs
195200

196-
@functools.wraps(subplot_mosaic)
201+
@functools.wraps(_subplot_mosaic)
197202
def subplot_mosaic(self, *args, **kwargs):
198-
fig, axd = subplot_mosaic(*args, **kwargs)
203+
fig, axd = _subplot_mosaic(*args, **kwargs)
199204
return self._register_fig(fig), axd
200205

201206
def _ensure_all_figures_promoted(self):
202207
for f in self.figures:
203208
if f.canvas.manager is None:
204-
promote_figure(f, num=self._fig_to_number[f])
209+
_promote_figure(f, num=self._fig_to_number[f])
205210

206211
def show_all(self, *, block=None, timeout=None):
207212
"""

0 commit comments

Comments
 (0)