From bd8c6a2d05cb31da08a2314ae4469607f27c09ec Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 27 May 2020 22:52:43 -0400 Subject: [PATCH] DOC/API: set __qualname__ when using class factory In patheffects.py we have a helper function to reduce the boiler plate in defining the path effect sub-classes. We are setting the `__name__` and `__doc__` to (templated) values, but were not setting the `__qualname__` which was leaving the string '' in the `__qualname__`. This string is then used by sphinx-gallery to generate an index of examples that use a given class with files named like `f'{obj.__qualname__}.examples'` which works correctly (but not in the way we want) on liunx but fails on windows as `<>` are forbidden in file names.- This sets the `__qualname__` to match the `__name__` and fully simulate defining these classes in the module. --- lib/matplotlib/patheffects.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/patheffects.py b/lib/matplotlib/patheffects.py index f9989f89454f..99ca11eff6f6 100644 --- a/lib/matplotlib/patheffects.py +++ b/lib/matplotlib/patheffects.py @@ -174,6 +174,7 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace): renderer.draw_path(gc, tpath, affine, rgbFace) withEffect.__name__ = f"with{effect_class.__name__}" + withEffect.__qualname__ = f"with{effect_class.__name__}" withEffect.__doc__ = f""" A shortcut PathEffect for applying `.{effect_class.__name__}` and then drawing the original Artist.