Skip to content

Commit 4b6dca5

Browse files
committed
-
1 parent d056e0b commit 4b6dca5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

source_py3/python_toolbox/math_tools/sequences.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def shitfuck(k, recurrence_counter):
9595
for recurrence_counter_ in current_reccurence_counters
9696
if recurrence_counter_ not in _shitfuck_cache
9797
})
98-
current_reccurence_counters = set(itertools.chain(levels[-1].values()))
98+
current_reccurence_counters = \
99+
set(itertools.chain(*levels[-1].values()))
99100

100101
# The last level is calculated. Time to make our way up.
101102
for k_, level in enumerate(reversed(levels), (k - len(levels) + 1)):
@@ -110,7 +111,7 @@ def shitfuck(k, recurrence_counter):
110111
for recurrence_counter_, sub_counters_counter in level.items():
111112
_shitfuck_cache[(k_, recurrence_counter_)] = sum(
112113
(_shitfuck_cache[(k_ - 1, sub_counter)] * factor for
113-
sub_counter, factor in sub_counters_counter)
114+
sub_counter, factor in sub_counters_counter.items())
114115
)
115116

116117
return _shitfuck_cache[(k, recurrence_counter)]

source_py3/python_toolbox/nifty_collections/frozen_counter.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ def __init__(self, iterable=None, **kwargs):
4242
if kwargs:
4343
self._dict.update(kwargs)
4444

45-
for key, value in self.items():
46-
if value == 0:
47-
del self._dict[key]
45+
for key in [key for key, value in self.items() if value == 0]:
46+
del self._dict[key]
4847

4948

5049
__getitem__ = lambda self, key: self._dict.get(key, 0)
@@ -207,5 +206,5 @@ def __and__(self, other):
207206
__bool__ = lambda self: any(True for element in self.elements())
208207

209208
n_elements = property( # blocktodo: want to make this cached but import loop
210-
lambda self: sum(value for value in values if value >= 1)
209+
lambda self: sum(value for value in self.values() if value >= 1)
211210
)

0 commit comments

Comments
 (0)