Skip to content

Commit 7460aff

Browse files
committed
-
1 parent 30421bd commit 7460aff

File tree

7 files changed

+21
-13
lines changed

7 files changed

+21
-13
lines changed

source_py2/python_toolbox/combi/perming/perm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,10 @@ def __lt__(self, other):
429429

430430
class UnrecurrentedMixin:
431431
'''Mixin for a permutation in a space that's been unrecurrented.'''
432-
__getitem__ = lambda self, i: super().__getitem__(i)[1]
433-
__iter__ = lambda self: iter(tuple(zip(*super().__iter__()))[1])
432+
def __getitem__(self, i):
433+
return super(UnrecurrentedMixin, self).__getitem__(i)[1]
434+
def __iter__(self, i):
435+
return iter(tuple(zip(*super(UnrecurrentedMixin, self).__iter__()))[1])
434436
index = lambda self, item: self.nominal_perm_space.domain[
435437
next(j for j, pair in enumerate(self._perm_sequence)
436438
if pair[1] == item)

source_py2/python_toolbox/combi/perming/perm_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ def __reduce__(self, *args, **kwargs):
940940
pass
941941
# #
942942
#######################################################################
943-
return super().__reduce__(*args, **kwargs)
943+
return super(PermSpace, self).__reduce__(*args, **kwargs)
944944

945945

946946
def _coerce_perm(self, perm):

source_py2/python_toolbox/combi/perming/variations.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class UnallowedVariationSelectionException(exceptions.CuteException):
4141
def __init__(self, variation_clash):
4242
self.variation_clash = variation_clash
4343
assert variation_clash in variation_clashes
44-
super().__init__(
44+
super(UnallowedVariationSelectionException, self).__init__(
4545
"You can't create a `PermSpace` that's %s." % (
4646
' and '.join(
4747
'%s%s' % (
@@ -81,7 +81,9 @@ def __getitem__(self, i):
8181
return VariationSelection(SelectionSpace.__getitem__(self, i))
8282

8383
def index(self, variation_selection):
84-
return super().index(variation_selection.variations)
84+
return super(VariationSelectionSpace, self).index(
85+
variation_selection.variations
86+
)
8587

8688
@caching.cache()
8789
def __repr__(self):
@@ -142,7 +144,7 @@ def _create_from_sorted_set(cls, variations):
142144
# This method exsits so we could cache canonically. The `__new__`
143145
# method canonicalizes the `variations` argument to a `SortedSet` and
144146
# we cache according to it.
145-
variation_selection = super().__new__(cls)
147+
variation_selection = super(VariationSelection, cls).__new__(cls)
146148
variation_selection.__init__(variations)
147149
return variation_selection
148150

source_py2/python_toolbox/nifty_collections/bagging.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class _BaseBagMixin:
146146
'''
147147

148148
def __init__(self, iterable={}):
149-
super().__init__()
149+
super(_BaseBagMixin, self).__init__()
150150

151151
if isinstance(iterable, collections.Mapping):
152152
for key, value, in iterable.items():
@@ -547,7 +547,7 @@ class _MutableBagMixin(_BaseBagMixin):
547547

548548
def __setitem__(self, i, count):
549549
try:
550-
super().__setitem__(i, _process_count(count))
550+
super(_MutableBagMixin, self).__setitem__(i, _process_count(count))
551551
except _ZeroCountAttempted:
552552
del self[i]
553553

@@ -825,7 +825,8 @@ def get_contained_bags(self):
825825
key.
826826
'''
827827
if self._contained_bags is None:
828-
self._contained_bags = super().get_contained_bags()
828+
self._contained_bags = \
829+
super(_FrozenBagMixin, self).get_contained_bags()
829830
return self._contained_bags
830831

831832

source_py2/python_toolbox/nifty_collections/frozen_bag_bag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FrozenBagBag(FrozenBag):
2828
2929
'''
3030
def __init__(self, iterable):
31-
super().__init__(iterable)
31+
super(FrozenBagBag, self).__init__(iterable)
3232

3333
# All zero values were already fileterd out by `FrozenBag`, we'll
3434
# filter out just the non-natural-number keys.

source_py2/test_python_toolbox/test_combi/test_perm_space.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ def __eq__(self, other):
651651

652652
class PokerHandSpace(combi.CombSpace):
653653
def __init__(self):
654-
super().__init__(card_space, 5, perm_type=PokerHand)
654+
super(PokerHandSpace, self).__init__(card_space, 5,
655+
perm_type=PokerHand)
655656

656657
class PokerHand(combi.Comb):
657658
@caching.CachedProperty

source_py3/python_toolbox/combi/perming/perm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,10 @@ def __lt__(self, other):
426426

427427
class UnrecurrentedMixin:
428428
'''Mixin for a permutation in a space that's been unrecurrented.'''
429-
__getitem__ = lambda self, i: super().__getitem__(i)[1]
430-
__iter__ = lambda self: iter(tuple(zip(*super().__iter__()))[1])
429+
def __getitem__(self, i):
430+
return super().__getitem__(i)[1]
431+
def __iter__(self, i):
432+
return iter(tuple(zip(*super().__iter__()))[1])
431433
index = lambda self, item: self.nominal_perm_space.domain[
432434
next(j for j, pair in enumerate(self._perm_sequence)
433435
if pair[1] == item)

0 commit comments

Comments
 (0)