Skip to content

Commit b8806d5

Browse files
committed
Convert block=None to block=True
1 parent d69e9ee commit b8806d5

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

lib/matplotlib/backend_bases.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def draw_if_interactive(cls):
177177
cls.trigger_manager_draw(manager)
178178

179179
@classmethod
180-
def show(cls, block=None):
180+
def show(cls, block=True):
181181
"""Show all figures.
182182
183183
`show` blocks by calling `mainloop` if *block* is ``True``, or if it
@@ -198,7 +198,7 @@ def show(cls, block=None):
198198
return
199199
if cls.mainloop is None:
200200
return
201-
if block is None:
201+
if block:
202202
# Hack: Are we in IPython's pylab mode?
203203
from matplotlib import pyplot
204204
try:
@@ -210,8 +210,6 @@ def show(cls, block=None):
210210
block = not ipython_pylab and not is_interactive()
211211
# TODO: The above is a hack to get the WebAgg backend working with
212212
# ipython's `%pylab` mode until proper integration is implemented.
213-
if get_backend() == "WebAgg":
214-
block = True
215213
if block:
216214
cls.mainloop()
217215

@@ -244,7 +242,7 @@ class ShowBase(_Backend):
244242
Subclass must override mainloop() method.
245243
"""
246244

247-
def __call__(self, block=None):
245+
def __call__(self, block=True):
248246
return self.show(block=block)
249247

250248

@@ -2635,7 +2633,7 @@ def notify_axes_change(fig):
26352633
if self.toolmanager is None and self.toolbar is not None:
26362634
self.toolbar.update()
26372635

2638-
def show(self):
2636+
def show(self, block=True):
26392637
"""
26402638
For GUI backends, show the figure window and redraw.
26412639
For non-GUI backends, raise an exception to be caught

lib/matplotlib/backends/backend_nbagg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def trigger_manager_draw(manager):
242242
manager.show()
243243

244244
@staticmethod
245-
def show(*args, **kwargs):
245+
def show(block=True):
246246
## TODO: something to do when keyword block==False ?
247247
from matplotlib._pylab_helpers import Gcf
248248

lib/matplotlib/backends/backend_template.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def draw_if_interactive():
172172
"""
173173

174174

175-
def show(block=None):
175+
def show(block=True):
176176
"""
177177
For image backends - is not required
178178
For GUI backends - show() is usually the last line of a pylab script and

lib/matplotlib/backends/backend_webagg.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,10 @@ def trigger_manager_draw(manager):
319319
manager.canvas.draw_idle()
320320

321321
@staticmethod
322-
def show():
322+
def show(block=True):
323+
if not block:
324+
warnings.warn('The webagg backend does not support "block=False"')
325+
block = True
323326
WebAggApplication.initialize()
324327

325328
url = "http://127.0.0.1:{port}{prefix}".format(

0 commit comments

Comments
 (0)