608fff2119f21191352ddf5d96eb82fc1ab099b0,dit/utils/misc.py,,partitions,#,370

Before Change


        yield ()
        return
    for i in xrange(2**len(set_) / 2):
        parts = [set(), set()]
        for item in set_:
            parts[i&1].add(item)
            i >>= 1
        for b in partitions(parts[1]):
            yield (parts[0],) + b

After Change



    
    // Handle iterators.
    seq = list(seq)

    if tuples:
        for partition in partitions1( seq ):
            // Convert the partition into a list of sorted tuples.
            partition = map(tuple, map(sorted, partition))

            // Convert the partition into a sorted tuple of sorted tuples.
            // Sort by smallest parts first, then lexicographically.
            partition = tuple(sorted(partition, cmp=len_cmp))

            yield partition

    else:
        for partition in partitions1( seq ):
            partition = frozenset( map(frozenset, partition) )
            yield partition

def ordered_partitions(seq, tuples=False):
    
    Generates ordered partitions of elements in `seq`.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: dit/dit
Commit Name: 608fff2119f21191352ddf5d96eb82fc1ab099b0
Time: 2013-02-25
Author: chebee7i@gmail.com
File Name: dit/utils/misc.py
Class Name:
Method Name: partitions


Project Name: IDSIA/sacred
Commit Name: 443e179cfaf8f5502002fbd8e480685d2991eade
Time: 2017-09-14
Author: qwlouse@gmail.com
File Name: sacred/initialize.py
Class Name:
Method Name: create_run


Project Name: onnx/onnx-coreml
Commit Name: 7f7a30cae66e7d65917ceea966225292f582d809
Time: 2019-10-04
Author: bhushan.s.94@gmail.com
File Name: onnx_coreml/_transformers.py
Class Name: DeadCodeElimination
Method Name: __call__