File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
source_py3/python_toolbox Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ def _unsliced_length(self):
420420 return calculate_length_of_recurrent_perm_space (
421421 self .n_elements - len (self .fixed_map ),
422422 nifty_collections .FrozenBagBag (
423- collections . Counter (self .free_values ).values ()
423+ nifty_collections . Bag (self .free_values ).values ()
424424 )
425425 )
426426 else :
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ def are_equal_regardless_of_order(seq1, seq2):
3030
3131 Currently will fail for items that have problems with comparing.
3232 '''
33- return collections .Counter (seq1 ) == collections .Counter (seq2 )
33+ from python_toolbox import nifty_collections
34+ return nifty_collections .Bag (seq1 ) == nifty_collections .Bag (seq2 )
3435
3536
3637def flatten (iterable ):
@@ -224,8 +225,9 @@ def get_recurrences(sequence):
224225
225226 The values of the dict are the numbers of repititions of each item.
226227 '''
228+ from python_toolbox import nifty_collections
227229 return {item : n_recurrences for item , n_recurrences in
228- collections . Counter (sequence ).most_common () if n_recurrences >= 2 }
230+ nifty_collections . Bag (sequence ).most_common () if n_recurrences >= 2 }
229231
230232
231233def ensure_iterable_is_immutable_sequence (iterable , default_type = tuple ,
You can’t perform that action at this time.
0 commit comments