Skip to content

Handle inherited is_separable, has_inverse in transform props detection. #14991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,14 +1227,16 @@ class Transform(TransformNode):

def __init_subclass__(cls):
# 1d transforms are always separable; we assume higher-dimensional ones
# are not but subclasses can also directly set is_separable.
if ("is_separable" not in vars(cls) # Was it overridden explicitly?
# are not but subclasses can also directly set is_separable -- this is
# verified by checking whether "is_separable" appears more than once in
# the class's MRO (it appears once in Transform).
if (sum("is_separable" in vars(parent) for parent in cls.__mro__) == 1
and cls.input_dims == cls.output_dims == 1):
cls.is_separable = True
# Transform.inverted raises NotImplementedError; we assume that if this
# is overridden then the transform is invertible but subclass can also
# directly set has_inverse.
if ("has_inverse" not in vars(cls) # Was it overridden explicitly?
if (sum("has_inverse" in vars(parent) for parent in cls.__mro__) == 1
and hasattr(cls, "inverted")
and cls.inverted is not Transform.inverted):
cls.has_inverse = True
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy