Skip to content

Commit fc33c38

Browse files
committed
Use a better variable name
1 parent f322125 commit fc33c38

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -332,25 +332,25 @@ def setup(app):
332332

333333
def init_filename_registry(app):
334334
env = app.builder.env
335-
if not hasattr(env, 'mpl_custom_base_names'):
336-
env.mpl_custom_base_names = defaultdict(set)
335+
if not hasattr(env, 'mpl_plot_image_basenames'):
336+
env.mpl_plot_image_basenames = defaultdict(set)
337337

338338

339339
class _FilenameCollector(EnvironmentCollector):
340340
def process_doc(self, app, doctree):
341341
pass
342342

343343
def clear_doc(self, app, env, docname):
344-
if docname in env.mpl_custom_base_names:
345-
del env.mpl_custom_base_names[docname]
344+
if docname in env.mpl_plot_image_basenames:
345+
del env.mpl_plot_image_basenames[docname]
346346

347347
def merge_other(self, app, env, docnames, other):
348348
for docname in docnames:
349-
if docname in other.mpl_custom_base_names:
350-
if docname not in env.mpl_custom_base_names:
351-
env.mpl_custom_base_names[docname] = set()
352-
env.mpl_custom_base_names[docname].update(
353-
other.mpl_custom_base_names[docname])
349+
if docname in other.mpl_plot_image_basenames:
350+
if docname not in env.mpl_plot_image_basenames:
351+
env.mpl_plot_image_basenames[docname] = set()
352+
env.mpl_plot_image_basenames[docname].update(
353+
other.mpl_plot_image_basenames[docname])
354354

355355
# -----------------------------------------------------------------------------
356356
# Doctest handling
@@ -645,8 +645,8 @@ def check_output_base_name(env, output_base):
645645
f"The image-basename '{output_base}' is invalid. "
646646
f"It must not contain dots or slashes.")
647647

648-
for d in env.mpl_custom_base_names:
649-
if output_base in env.mpl_custom_base_names[d]:
648+
for d in env.mpl_plot_image_basenames:
649+
if output_base in env.mpl_plot_image_basenames[d]:
650650
if d == docname:
651651
raise PlotError(
652652
f"The image-basename "
@@ -655,7 +655,7 @@ def check_output_base_name(env, output_base):
655655
f"'{output_base}' is used multiple times "
656656
f"(it is also used in {env.doc2path(d)}).")
657657

658-
env.mpl_custom_base_names[docname].add(output_base)
658+
env.mpl_plot_image_basenames[docname].add(output_base)
659659

660660

661661
def render_figures(code, code_path, output_dir, output_base, context,

0 commit comments

Comments
 (0)