Skip to content

Commit 8581b65

Browse files
committed
-
1 parent 9d07884 commit 8581b65

File tree

12 files changed

+360
-360
lines changed

12 files changed

+360
-360
lines changed

misc/IDE files/Wing/python_toolbox_py3.wpr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ debug.launch-configs = (1,
1616
'pypath': ('default',
1717
''),
1818
'pyrunargs': ('project',
19-
''),
20-
'runargs': u'--processes=3',
21-
'rundir': ('custom',
22-
u'${WING:PROJECT_HOME}')})})
19+
u''),
20+
'runargs': u'',
21+
'rundir': ('default',
22+
u'')})})
2323
proj.directory-list = [{'dirloc': loc('../../..'),
2424
'excludes': [u'dist',
2525
u'source_py2',

source_py3/python_toolbox/caching/cached_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _get_personality(self):
2929
personality = CachedProperty(_get_personality)
3030
3131
You can also put in a value as the first argument if you'd like to have it
32-
returned instead of using a getter. (It can be a totally static value like
32+
returned instead of using a getter. (It can be a tobag static value like
3333
`0`). If this value happens to be a callable but you'd still like it to be
3434
used as a static value, use `force_value_not_getter=True`.
3535
'''

source_py3/python_toolbox/collection_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _get_all_contained_counters(counter, use_lazy_tuple=True):
3434
counter,
3535
(
3636
collections.Counter,
37-
nifty_collections.tallying._TallyMixin
37+
nifty_collections.bagging._BagMixin
3838
)
3939
)
4040
counter_type = type(counter)

source_py3/python_toolbox/combi/perming/calculating_length.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
def calculate_length_of_recurrent_perm_space(k, ftt):
1616
cache = _length_of_recurrent_perm_space_cache
17-
if not isinstance(ftt, nifty_collections.FrozenTallyTally):
18-
ftt = nifty_collections.FrozenTallyTally(ftt)
17+
if not isinstance(ftt, nifty_collections.FrozenBagBag):
18+
ftt = nifty_collections.FrozenBagBag(ftt)
1919
if k == 0:
2020
return 1
2121
elif k == 1:
2222
assert ftt
23-
# (Works because `FrozenTallyTally` has a functioning `__bool__`,
23+
# (Works because `FrozenBagBag` has a functioning `__bool__`,
2424
# unlike Python's `Counter`.)
2525
return ftt.n_elements
2626
try:
@@ -42,13 +42,13 @@ def calculate_length_of_recurrent_perm_space(k, ftt):
4242
# The last level is calculated. Time to make our way up.
4343
for k_, level in enumerate(reversed(levels), (k - len(levels) + 1)):
4444
if k_ == 1:
45-
for ftt_, sub_ftt_tally in level.items():
45+
for ftt_, sub_ftt_bag in level.items():
4646
cache[(k_, ftt_)] = ftt_.n_elements
4747
else:
48-
for ftt_, sub_ftt_tally in level.items():
48+
for ftt_, sub_ftt_bag in level.items():
4949
cache[(k_, ftt_)] = sum(
5050
(cache[(k_ - 1, sub_ftt)] * factor for
51-
sub_ftt, factor in sub_ftt_tally.items())
51+
sub_ftt, factor in sub_ftt_bag.items())
5252
)
5353

5454
return cache[(k, ftt)]
@@ -62,13 +62,13 @@ def calculate_length_of_recurrent_perm_space(k, ftt):
6262

6363
def calculate_length_of_recurrent_comb_space(k, ftt):
6464
cache = _length_of_recurrent_comb_space_cache
65-
if not isinstance(ftt, nifty_collections.FrozenTallyTally):
66-
ftt = nifty_collections.FrozenTallyTally(ftt)
65+
if not isinstance(ftt, nifty_collections.FrozenBagBag):
66+
ftt = nifty_collections.FrozenBagBag(ftt)
6767
if k == 0:
6868
return 1
6969
elif k == 1:
7070
assert ftt
71-
# (Works because `FrozenTallyTally` has a functioning `__bool__`,
71+
# (Works because `FrozenBagBag` has a functioning `__bool__`,
7272
# unlike Python's `Counter`.)
7373
return ftt.n_elements
7474
try:

source_py3/python_toolbox/combi/perming/perm_space.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(self, iterable_or_length, domain=None, *, n_elements=None,
182182
# #
183183
if self.is_rapplied:
184184
self.is_recurrent = any(count >= 2 for count in
185-
self._frozen_ordered_tally.values())
185+
self._frozen_ordered_bag.values())
186186
else:
187187
self.is_recurrent = False
188188
# #
@@ -382,7 +382,7 @@ def _unsliced_length(self):
382382
if self.is_recurrent:
383383
return calculate_length_of_recurrent_perm_space(
384384
self.n_elements - len(self.fixed_map),
385-
nifty_collections.FrozenTallyTally(
385+
nifty_collections.FrozenBagBag(
386386
collections.Counter(self.free_values).values()
387387
)
388388
)
@@ -399,12 +399,12 @@ def _unsliced_length(self):
399399
if self.is_combination:
400400
return calculate_length_of_recurrent_comb_space(
401401
self.n_elements,
402-
self._frozen_tally_tally
402+
self._frozen_bag_bag
403403
)
404404
else:
405405
return calculate_length_of_recurrent_perm_space(
406406
self.n_elements,
407-
self._frozen_tally_tally
407+
self._frozen_bag_bag
408408
)
409409

410410
else:
@@ -445,11 +445,11 @@ def variation_selection(self):
445445
return variation_selection
446446

447447
@caching.CachedProperty
448-
def _frozen_ordered_tally(self):
449-
return nifty_collections.FrozenOrderedTally(self.sequence)
448+
def _frozen_ordered_bag(self):
449+
return nifty_collections.FrozenOrderedBag(self.sequence)
450450

451-
_frozen_tally_tally = caching.CachedProperty(
452-
lambda self: self._frozen_ordered_tally.frozen_tally_tally
451+
_frozen_bag_bag = caching.CachedProperty(
452+
lambda self: self._frozen_ordered_bag.frozen_bag_bag
453453
)
454454

455455

@@ -577,7 +577,7 @@ def __getitem__(self, i):
577577
assert not self.is_dapplied and not self.is_degreed and \
578578
not self.is_sliced
579579
available_values = list(self.sequence)
580-
reserved_values = nifty_collections.Tally(self.fixed_map.values())
580+
reserved_values = nifty_collections.Bag(self.fixed_map.values())
581581
wip_perm_sequence_dict = dict(self.fixed_map)
582582
wip_i = i
583583
shit_set = set()
@@ -588,7 +588,7 @@ def __getitem__(self, i):
588588
continue
589589
unused_values = [
590590
item for item in
591-
nifty_collections.OrderedTally(available_values) -
591+
nifty_collections.OrderedBag(available_values) -
592592
reserved_values if item not in shit_set
593593
]
594594
for unused_value in unused_values:

source_py3/python_toolbox/nifty_collections/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from .weak_key_identity_dict import WeakKeyIdentityDict
1010
from .lazy_tuple import LazyTuple
1111
from .frozen_dict_and_frozen_ordered_dict import FrozenDict, FrozenOrderedDict
12-
from .tallying import Tally, OrderedTally, FrozenTally, FrozenOrderedTally
13-
from .frozen_tally_tally import FrozenTallyTally
12+
from .bagging import Bag, OrderedBag, FrozenBag, FrozenOrderedBag
13+
from .frozen_bag_bag import FrozenBagBag
1414
from .default_sorted_dict import DefaultSortedDict
1515
from .cute_enum import CuteEnum
1616

0 commit comments

Comments
 (0)