Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd8c6a2

Browse files
committed
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 '<locals>' 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.
1 parent a5a4324 commit bd8c6a2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/matplotlib/patheffects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
174174
renderer.draw_path(gc, tpath, affine, rgbFace)
175175

176176
withEffect.__name__ = f"with{effect_class.__name__}"
177+
withEffect.__qualname__ = f"with{effect_class.__name__}"
177178
withEffect.__doc__ = f"""
178179
A shortcut PathEffect for applying `.{effect_class.__name__}` and then
179180
drawing the original Artist.

0 commit comments

Comments
 (0)