Beispiel #1
0
def get_stats(github):
    '''Gets API data and returns markdown progress'''

    stats = ''
    repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id))

    if show_profile_view.lower() in truthy:
        data = run_v3_api(get_profile_view.substitute(owner=username, repo=username))
        stats += '![Profile Views](http://img.shields.io/badge/' + quote(str(translate['Profile Views'])) + '-' + str(
            data['count']) + '-blue)\n\n'

    if show_loc.lower() in truthy:
        stats += '![Lines of code](https://img.shields.io/badge/' + quote(
            str(translate['From Hello World I have written'])) + '-' + quote(
            str(get_line_of_code())) + '%20' + quote(str(translate['Lines of code'])) + '-blue)\n\n'

    if show_short_info.lower() in truthy:
        stats += get_short_info(github)

    if show_waka_stats.lower() in truthy:
        stats += get_waka_time_stats()

    if showLanguagePerRepo.lower() in truthy:
        stats = stats + generate_language_per_repo(repositoryList) + '\n\n'

    if showLocChart.lower() in truthy:
        loc = LinesOfCode(id, username, ghtoken, repositoryList)
        loc.calculateLoc()
        stats += '**' + translate['Timeline'] + '**\n\n'
        stats = stats + '![Chart not found](https://github.com/' + username + '/' + username + '/blob/master/charts/bar_graph.png) \n\n'

    return stats
Beispiel #2
0
def get_yearly_data():
    repository_list = run_query(repositoryListQuery.substitute(username=username, id=id))
    loc = LinesOfCode(id, username, ghtoken, repository_list, ignored_repos_name)
    yearly_data = loc.calculateLoc()
    if showLocChart.lower() in truthy:
        loc.plotLoc(yearly_data)
    return yearly_data
Beispiel #3
0
def get_line_of_code():
    repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id))
    loc = LinesOfCode(id, username, ghtoken, repositoryList, ignored_repos_name)
    yearly_data = loc.calculateLoc()
    total_loc = sum(
        [yearly_data[year][quarter][lang] for year in yearly_data for quarter in yearly_data[year] for lang in
         yearly_data[year][quarter]])
    return millify(int(total_loc))
Beispiel #4
0
def get_stats(github):
    '''Gets API data and returns markdown progress'''

    stats = ''
    repositoryList = run_query(
        repositoryListQuery.substitute(username=username, id=id))

    if show_profile_view.lower() in truthy:
        data = run_v3_api(
            get_profile_view.substitute(owner=username, repo=username))
        stats += '![Profile Views](http://img.shields.io/badge/' + quote(
            str(translate['Profile Views'])) + '-' + str(
                data['count']) + '-blue)\n\n'

    if show_loc.lower() in truthy:
        stats += '![Lines of code](https://img.shields.io/badge/' + quote(
            str(translate['From Hello World I have written'])) + '-' + quote(
                str(get_line_of_code())) + '%20' + quote(
                    str(translate['Lines of code'])) + '-blue)\n\n'

    if show_short_info.lower() in truthy:
        stats += get_short_info(github)

    if show_waka_stats.lower() in truthy:
        stats += get_waka_time_stats()

    if showLanguagePerRepo.lower() in truthy:
        stats = stats + generate_language_per_repo(repositoryList) + '\n\n'

    if showLocChart.lower() in truthy:
        loc = LinesOfCode(id, username, ghtoken, repositoryList,
                          ignored_repos_name)
        yearly_data = loc.calculateLoc()
        loc.plotLoc(yearly_data)
        stats += '**' + translate['Timeline'] + '**\n\n'
        branch_name = github.get_repo(f'{username}/{username}').default_branch
        stats = stats + '![Chart not found](https://raw.githubusercontent.com/' + username + '/' + username + '/' + branch_name + '/charts/bar_graph.png) \n\n'

    if show_updated_date.lower() in truthy:
        today = date.today()
        d1 = today.strftime("%d/%m/%Y")
        stats = stats + "\n Last Updated on " + d1

    return stats