예제 #1
0
파일: approx.py 프로젝트: Xion/coded4
def approximate_coding_sessions(clustered_commits, approx_algo):
    """Approximates the coding sessions that resulted in given clustered commits.

    :param clustered_commits: Dictionary mapping contributor names
                              to lists of Commit clusters
    :param approx_algo: Name of approximation algorithm

    :return: Dictionary mapping contributor names to lists of Session tuples
    """
    approx_func = globals().get(approx_algo + '_approximation')
    if not approx_func:
        raise ValueError("Unknown approximation '%s'" % approx_algo)

    return dicts.mapvalues(curry(map, approx_func), clustered_commits)
예제 #2
0
def approximate_coding_sessions(clustered_commits, approx_algo):
    """Approximates the coding sessions that resulted in given clustered commits.

    :param clustered_commits: Dictionary mapping contributor names
                              to lists of Commit clusters
    :param approx_algo: Name of approximation algorithm

    :return: Dictionary mapping contributor names to lists of Session tuples
    """
    approx_func = globals().get(approx_algo + '_approximation')
    if not approx_func:
        raise ValueError("Unknown approximation '%s'" % approx_algo)

    return dicts.mapvalues(curry(map, approx_func), clustered_commits)
예제 #3
0
파일: cluster.py 프로젝트: mmgutsche/coded4
def cluster_commits(grouped_commits, cluster_algo, epsilon):
    """Clusters commits for every contributor in given dictionary.

    :param grouped_commits: Dictionary mapping contributor names
                            to lists of Commit tuples
    :param cluster_algo: Name of clustering algorithm
    :param epsilon: Temporal distance for the epsilon-neighborhood

    :return: Dictionary mapping author names to lists of coding sessions
    """
    cluster_func = globals().get(cluster_algo + '_clustering')
    if not cluster_func:
        raise ValueError("Unknown clustering algorithm '%s'" % cluster_algo)

    return dicts.mapvalues(curry(cluster_func, epsilon=epsilon),
                           grouped_commits)
예제 #4
0
파일: cluster.py 프로젝트: Xion/coded4
def cluster_commits(grouped_commits, cluster_algo, epsilon):
    """Clusters commits for every contributor in given dictionary.

    :param grouped_commits: Dictionary mapping contributor names
                            to lists of Commit tuples
    :param cluster_algo: Name of clustering algorithm
    :param epsilon: Temporal distance for the epsilon-neighborhood

    :return: Dictionary mapping author names to lists of coding sessions
    """
    cluster_func = globals().get(cluster_algo + '_clustering')
    if not cluster_func:
        raise ValueError("Unknown clustering algorithm '%s'" % cluster_algo)

    return dicts.mapvalues(curry(cluster_func, epsilon=epsilon),
                           grouped_commits)
예제 #5
0
 def test_dict__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, object())
예제 #6
0
 def test_dict__none(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, None)
예제 #7
0
 def test_function__non_function(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(object(), self.DICT)
예제 #8
0
 def test_function__none(self):
     self.assertEquals(self.DICT, __unit__.mapvalues(None, self.DICT))
예제 #9
0
파일: output.py 프로젝트: Xion/coded4
 def write_contrib(contrib, parent, tag):
     ET.SubElement(parent, tag, attrib=dicts.mapvalues(str_, contrib))
예제 #10
0
파일: test_dicts.py 프로젝트: Xion/taipan
 def test_function__none(self):
     self.assertEquals(self.DICT, __unit__.mapvalues(None, self.DICT))
예제 #11
0
파일: test_dicts.py 프로젝트: Xion/taipan
 def test_map(self):
     self.assertEquals(self.MAPPED_DICT,
                       __unit__.mapvalues(MapValues.FUNCTION, self.DICT))
예제 #12
0
파일: test_dicts.py 프로젝트: Xion/taipan
 def test_dict__empty(self):
     self.assertEquals({}, __unit__.mapvalues(None, {}))
     self.assertEquals({}, __unit__.mapvalues(MapValues.FUNCTION, {}))
예제 #13
0
파일: test_dicts.py 프로젝트: Xion/taipan
 def test_dict__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, object())
예제 #14
0
파일: test_dicts.py 프로젝트: Xion/taipan
 def test_dict__none(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, None)
예제 #15
0
파일: test_dicts.py 프로젝트: Xion/taipan
 def test_function__non_function(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(object(), self.DICT)
예제 #16
0
 def test_dict__empty(self):
     self.assertEquals({}, __unit__.mapvalues(None, {}))
     self.assertEquals({}, __unit__.mapvalues(MapValues.FUNCTION, {}))
예제 #17
0
 def test_map(self):
     self.assertEquals(self.MAPPED_DICT,
                       __unit__.mapvalues(MapValues.FUNCTION, self.DICT))
예제 #18
0
파일: output.py 프로젝트: mmgutsche/coded4
 def write_contrib(contrib, parent, tag):
     ET.SubElement(parent, tag, attrib=dicts.mapvalues(str_, contrib))