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

Before Change


    // Thomas Dybdahl Ahle (https://github.com/thomasahle)
    // Source: http://compprog.wordpress.com/2007/10/15/generating-the-partitions-of-a-set
    if not set_:
        yield ()
        return
    for i in xrange(2**len(set_) / 2):
        parts = [set(), set()]
        for item in set_:

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: 3

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: pgmpy/pgmpy
Commit Name: 10cd8e095eac28a167160517bdc20ca0785ca8a5
Time: 2013-11-15
Author: abinash.panda.ece10@itbhu.ac.in
File Name: src/BayesianModel/BayesianModel.py
Class Name: BayesianModel
Method Name: get_parents


Project Name: pgmpy/pgmpy
Commit Name: 99b02241dcee652b90a61cd6f7008f63eedd7d08
Time: 2013-11-15
Author: abinash.panda.ece10@itbhu.ac.in
File Name: src/BayesianModel/BayesianModel.py
Class Name: BayesianModel
Method Name: get_states