8000 API: only split the code on fully-dedented plt.show calls · matplotlib/matplotlib@3c90d8f · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c90d8f

Browse files
committed
API: only split the code on fully-dedented plt.show calls
Also remove the () from the search so `plt.show(block=True)` will also be caught. The reason for this change is so that calling `plt.show()` inside of a function will not try to split the code into independently executed chunks.
1 parent f4971af commit 3c90d8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def _split_code_at_show(text):
348348
is_doctest = contains_doctest(text)
349349
part = []
350350
for line in text.split("\n"):
351-
if (not is_doctest and line.strip() == 'plt.show()') or \
351+
if (not is_doctest and line.startswith('plt.show')) or \
352352
(is_doctest and line.strip() == '>>> plt.show()'):
353353
part.append(line)
354354
parts.append("\n".join(part))

0 commit comments

Comments
 (0)
0