Skip to content
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