Esempio n. 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)
        yearly_data = loc.calculateLoc()
        loc.plotLoc(yearly_data)
        stats += '**' + translate['Timeline'] + '**\n\n'
        stats = stats + '![Chart not found](https://raw.githubusercontent.com/' + username + '/' + username + '/master/charts/bar_graph.png) \n\n'

    return stats
Esempio n. 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