File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1227,14 +1227,16 @@ class Transform(TransformNode):
12271227
12281228 def __init_subclass__ (cls ):
12291229 # 1d transforms are always separable; we assume higher-dimensional ones
1230- # are not but subclasses can also directly set is_separable.
1231- if ("is_separable" not in vars (cls ) # Was it overridden explicitly?
1230+ # are not but subclasses can also directly set is_separable -- this is
1231+ # verified by checking whether "is_separable" appears more than once in
1232+ # the class's MRO (it appears once in Transform).
1233+ if (sum ("is_separable" in vars (parent ) for parent in cls .__mro__ ) == 1
12321234 and cls .input_dims == cls .output_dims == 1 ):
12331235 cls .is_separable = True
12341236 # Transform.inverted raises NotImplementedError; we assume that if this
12351237 # is overridden then the transform is invertible but subclass can also
12361238 # directly set has_inverse.
1237- if ("has_inverse" not in vars (cls ) # Was it overridden explicitly?
1239+ if (sum ( "has_inverse" in vars (parent ) for parent in cls . __mro__ ) == 1
12381240 and hasattr (cls , "inverted" )
12391241 and cls .inverted is not Transform .inverted ):
12401242 cls .has_inverse = True
You can’t perform that action at this time.
0 commit comments