Exemple #1
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)
Exemple #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)
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #5
0
 def test_dict__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, object())
Exemple #6
0
 def test_dict__none(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, None)
Exemple #7
0
 def test_function__non_function(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(object(), self.DICT)
Exemple #8
0
 def test_function__none(self):
     self.assertEquals(self.DICT, __unit__.mapvalues(None, self.DICT))
Exemple #9
0
 def write_contrib(contrib, parent, tag):
     ET.SubElement(parent, tag, attrib=dicts.mapvalues(str_, contrib))
Exemple #10
0
 def test_function__none(self):
     self.assertEquals(self.DICT, __unit__.mapvalues(None, self.DICT))
Exemple #11
0
 def test_map(self):
     self.assertEquals(self.MAPPED_DICT,
                       __unit__.mapvalues(MapValues.FUNCTION, self.DICT))
Exemple #12
0
 def test_dict__empty(self):
     self.assertEquals({}, __unit__.mapvalues(None, {}))
     self.assertEquals({}, __unit__.mapvalues(MapValues.FUNCTION, {}))
Exemple #13
0
 def test_dict__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, object())
Exemple #14
0
 def test_dict__none(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(MapValues.FUNCTION, None)
Exemple #15
0
 def test_function__non_function(self):
     with self.assertRaises(TypeError):
         __unit__.mapvalues(object(), self.DICT)
Exemple #16
0
 def test_dict__empty(self):
     self.assertEquals({}, __unit__.mapvalues(None, {}))
     self.assertEquals({}, __unit__.mapvalues(MapValues.FUNCTION, {}))
Exemple #17
0
 def test_map(self):
     self.assertEquals(self.MAPPED_DICT,
                       __unit__.mapvalues(MapValues.FUNCTION, self.DICT))
Exemple #18
0
 def write_contrib(contrib, parent, tag):
     ET.SubElement(parent, tag, attrib=dicts.mapvalues(str_, contrib))