Skip to content

Commit c08b079

Browse files
committed
-
1 parent 658c392 commit c08b079

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

source_py2/python_toolbox/combi/perming/perm_space.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __call__(cls, *args, **kwargs):
5959

6060
class PermSpace(_VariationRemovingMixin, _VariationAddingMixin,
6161
_FixedMapManagingMixin, sequence_tools.CuteSequenceMixin,
62-
collections.Sequence, metaclass=PermSpaceType):
62+
collections.Sequence):
6363
'''
6464
A space of permutations on a sequence.
6565
@@ -149,6 +149,8 @@ class PermSpace(_VariationRemovingMixin, _VariationAddingMixin,
149149
A perm space that has none of these variations is called pure.
150150
'''
151151

152+
__metaclass__ = PermSpaceType
153+
152154
@classmethod
153155
def coerce(cls, argument):
154156
'''Make `argument` into something of class `cls` if it isn't.'''
@@ -917,6 +919,7 @@ def short_length_string(self):
917919
return str(self.length)
918920

919921
__bool__ = lambda self: bool(self.length)
922+
__nonzero__ = __bool__
920923

921924
_domain_set = caching.CachedProperty(
922925
lambda self: set(self.domain),

source_py2/python_toolbox/combi/perming/variations.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class VariationSelectionType(type):
116116
__call__ = lambda cls, variations: cls._create_from_sorted_set(
117117
sortedcontainers.SortedSet(variations))
118118

119-
class VariationSelection(metaclass=VariationSelectionType):
119+
class VariationSelection(object):
120120
'''
121121
A selection of variations of a `PermSpace`.
122122
@@ -132,6 +132,9 @@ class VariationSelection(metaclass=VariationSelectionType):
132132
with the same variations, you'll get the original `VariationSelection`
133133
object you created.
134134
'''
135+
136+
__metaclass__ = VariationSelectionType
137+
135138
@classmethod
136139
@caching.cache()
137140
def _create_from_sorted_set(cls, variations):

0 commit comments

Comments
 (0)