Ejemplo n.º 1
0
def test_centrality_display_multiple_dfs():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    a = centrality(data, "id", "author", "created_at", "discussion", name="mixih")
    b = centrality(
        parse_issues(PATH_TO_RESOURCES + "issues2.json"), "id", "author", "created_at", "discussion", name="asu"
    )
    display([a, b], show_plots=False)
    assert True
Ejemplo n.º 2
0
def test_centrality_display():
    repo = PATH_TO_RESOURCES + "repo"
    if not os.listdir(repo):
        raise Exception("Empty git submodule. Try: git submodule update --init")
    data = parse_repositories(repo)
    a = centrality(data, "id", "author_name", "date", "files", name="Alex Merry")
    display(a, show_plots=False)
    assert True
Ejemplo n.º 3
0
def test_centrality_on_repository_no_author():
    repo = PATH_TO_RESOURCES + "repo"
    if not os.listdir(repo):
        raise Exception(
            "Empty git submodule. Try: git submodule update --init")
    data = parse_repositories(repo)
    assert isinstance(centrality(data, "id", "author_name", "date", "files"),
                      list)
Ejemplo n.º 4
0
def test_centrality_size_df_frac():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    large_frac = centrality(data,
                            "id",
                            "author",
                            "created_at",
                            "discussion",
                            name="mixih",
                            frac=0.8)
    low_frac = centrality(data,
                          "id",
                          "author",
                          "created_at",
                          "discussion",
                          name="mixih",
                          frac=0.025)
    assert not large_frac.size.equals(low_frac.size)
Ejemplo n.º 5
0
def test_display_multiple_types():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    a = centrality(data, "id", "author", "created_at", "discussion", name="mixih")
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    b = response(data, "id", "author", "created_at", "discussion")
    data = parse_repositories(PATH_TO_RESOURCES + "repo")
    c = network(data, "author_name", "files")
    display([a, b, c], show_plots=False)
    assert True
Ejemplo n.º 6
0
def test_centrality_on_issues_activity_df_row_count():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    a = centrality(data,
                   "id",
                   "author",
                   "created_at",
                   "discussion",
                   name="mixih")
    assert len(a.activity.index) == 23
Ejemplo n.º 7
0
def test_centrality_on_issues_size_cols():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    a = centrality(data,
                   "id",
                   "author",
                   "created_at",
                   "discussion",
                   name="mixih")
    assert a.size.columns.tolist() == ["date", "value"]
Ejemplo n.º 8
0
def test_centrality_on_issues_return_type():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    assert isinstance(
        centrality(data,
                   "id",
                   "author",
                   "created_at",
                   "discussion",
                   name="mixih"), Centrality)
Ejemplo n.º 9
0
def test_centrality_on_mailinglist_size_cols():
    data = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox")
    a = centrality(data,
                   "message_id",
                   "sender_name",
                   "date",
                   "references",
                   "message_id",
                   name="Jay Woods")
    assert a.size.columns.tolist() == ["date", "value"]
Ejemplo n.º 10
0
def test_centrality_on_mailinglist_activity_df_row_count():
    data = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox")
    a = centrality(data,
                   "message_id",
                   "sender_name",
                   "date",
                   "references",
                   "message_id",
                   name="Jay Woods")
    assert len(a.activity.index) == 3
Ejemplo n.º 11
0
def test_centrality_on_mailinglists_return_type():
    data = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox")
    assert isinstance(
        centrality(data,
                   "message_id",
                   "sender_name",
                   "date",
                   "references",
                   "message_id",
                   name="Jay Woods"), Centrality
    )  # Might break here because message_id is used as both a source and an id
Ejemplo n.º 12
0
def test_centrality_on_repository_activity_df_row_count():
    repo = PATH_TO_RESOURCES + "repo"
    if not os.listdir(repo):
        raise Exception(
            "Empty git submodule. Try: git submodule update --init")
    data = parse_repositories(repo)
    a = centrality(data,
                   "id",
                   "author_name",
                   "date",
                   "files",
                   name="Alex Merry")
    assert len(a.activity.index) == 48
Ejemplo n.º 13
0
def test_centrality_return_type():
    repo = PATH_TO_RESOURCES + "repo"
    if not os.listdir(repo):
        raise Exception(
            "Empty git submodule. Try: git submodule update --init")
    data = parse_repositories(repo)
    assert isinstance(
        centrality(data,
                   "id",
                   "author_name",
                   "date",
                   "files",
                   name="Alex Merry"), Centrality)
Ejemplo n.º 14
0
def test_centrality_on_repository_size_df_cols():
    repo = PATH_TO_RESOURCES + "repo"
    if not os.listdir(repo):
        raise Exception(
            "Empty git submodule. Try: git submodule update --init")
    data = parse_repositories(repo)
    a = centrality(data,
                   "id",
                   "author_name",
                   "date",
                   "files",
                   name="Alex Merry")
    assert a.size.columns.tolist() == ["date", "value"]
Ejemplo n.º 15
0
def test_display_multiple_types_with_multiple_dfs():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    a = centrality(data, "id", "author", "created_at", "discussion", name="mixih")
    b = centrality(
        parse_issues(PATH_TO_RESOURCES + "issues2.json"), "id", "author", "created_at", "discussion", name="asu"
    )
    path = PATH_TO_RESOURCES + "repo"
    if not os.listdir(path):
        raise Exception("Empty git submodule. Try: git submodule update --init")
    repo = parse_repositories(path)
    c = network(repo, "author_name", "files")
    mail = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox")
    d = network(mail, "sender_name", "references", "message_id")
    issues = parse_issues(PATH_TO_RESOURCES + "issues.json")
    e = network(issues, "author", "discussion")
    issues = parse_issues(PATH_TO_RESOURCES + "issues.json")
    comm = parse_comments(issues)
    data = issues.merge(comm, how="outer")
    f = teamsize(data, "id", "author", "created_at")
    g = teamsize(parse_issues(PATH_TO_RESOURCES + "issues2.json"), "id", "author", "created_at")
    display([a, b, c, d, e, f, g], show_plots=False)
    assert True
Ejemplo n.º 16
0
def test_centrality_issues():
    b = centrality(
        parse_issues(PATH_TO_RESOURCES + "issues2.json"), "id", "author", "created_at", "discussion", name="asu"
    )
    display(b, show_plots=False)
    assert True
Ejemplo n.º 17
0
        help="Name of the contributor to explore," +
        " if no name is provided a list of names will be proposed",
    )
    arg_parser.add_argument("-f", "--start", help="Start date")
    arg_parser.add_argument("-u", "--end", help="End date")
    arg_parser.add_argument("--palette",
                            choices=["blue4", "magma256"],
                            default="magma256",
                            help="Choose a palette (default is magma256)")
    arg_parser.add_argument("-t", "--title", help="Title")
    arg_parser.add_argument("-o",
                            "--output",
                            default="result.html",
                            help="Output file (default is 'result.html')")
    args = arg_parser.parse_args()

    start_date = args.start
    end_date = args.end

    data = cd.parse_issues(args.paths, start_date, end_date)
    c = cd.centrality(data,
                      "id",
                      "author",
                      "created_at",
                      "discussion",
                      name=args.name)
    if args.name:
        cd.display(c, palette=args.palette, output=args.output)
    else:
        print("Found authors: ", c)
Ejemplo n.º 18
0
def test_centrality_on_mailinglist_no_author():
    data = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox")
    assert isinstance(
        centrality(data, "message_id", "sender_name", "date", "references",
                   "message_id"), list)
Ejemplo n.º 19
0
def test_centrality_on_issues_no_author():
    data = parse_issues(PATH_TO_RESOURCES + "issues.json")
    assert isinstance(
        centrality(data, "id", "author", "created_at", "discussion"), list)
Ejemplo n.º 20
0
    arg_parser.add_argument(
        "paths",
        metavar="path",
        nargs="+",
        help="Path of a git repository to process or of a directory containing git repositories",
    )
    arg_parser.add_argument(
        "-n",
        "--name",
        help="Name of the contributor to explore," + " if no name is provided a list of names will be proposed",
    )
    arg_parser.add_argument("-f", "--start", help="Start date")
    arg_parser.add_argument("-u", "--end", help="End date")
    arg_parser.add_argument(
        "--palette", choices=["blue4", "magma256"], default="magma", help="Choose a palette (default is magma256)"
    )
    arg_parser.add_argument("-t", "--title", help="Title")
    arg_parser.add_argument("-o", "--output", help="Output file (default is 'result.html')")
    args = arg_parser.parse_args()

    start_date = args.start
    end_date = args.end
    output_filename = args.output or "result.html"

    data = cd.parse_mail(args.paths, start_date, end_date)
    c = cd.centrality(data, "message_id", "sender_name", "date", "references", "message_id", name=args.name)
    if args.name:
        cd.display(c, palette=args.palette, output=output_filename)
    else:
        print("Found authors: ", c)
Ejemplo n.º 21
0
    arg_parser = ArgumentParser(description="A tool for visualizing, week by week, who contributes code")
    arg_parser.add_argument(
        "paths",
        metavar="path",
        nargs="+",
        help="Path of a git repository to process or of a directory containing git repositories",
    )
    arg_parser.add_argument(
        "-n",
        "--name",
        help="Name of the contributor to explore," + " if no name is provided a list of names will be proposed",
    )
    arg_parser.add_argument("-f", "--start", help="Start date")
    arg_parser.add_argument("-u", "--end", help="End date")
    arg_parser.add_argument(
        "--palette", choices=["blue4", "magma256"], default="magma256", help="Choose a palette (default is magma256)"
    )
    arg_parser.add_argument("-t", "--title", help="Title")
    arg_parser.add_argument("-o", "--output", default="result.html", help="Output file (default is 'result.html')")
    args = arg_parser.parse_args()

    start_date = args.start
    end_date = args.end

    data = cd.parse_repositories(args.paths, start_date, end_date)
    c = cd.centrality(data, "id", "author_name", "date", "files", name=args.name)
    if args.name:
        cd.display(c, palette=args.palette, output=args.output)
    else:
        print("Found authors: ", c)