Clarified names.
This commit is contained in:
14
gitfiti.py
14
gitfiti.py
@ -207,7 +207,7 @@ def load_images(img_names):
|
|||||||
return loaded_imgs
|
return loaded_imgs
|
||||||
|
|
||||||
|
|
||||||
def get_calendar(username, base_url):
|
def retrieve_contributions_calendar(username, base_url):
|
||||||
"""retrieves the GitHub commit calendar data for a username"""
|
"""retrieves the GitHub commit calendar data for a username"""
|
||||||
base_url = base_url + 'users/' + username
|
base_url = base_url + 'users/' + username
|
||||||
|
|
||||||
@ -222,11 +222,11 @@ def get_calendar(username, base_url):
|
|||||||
return page.read().decode('utf-8').splitlines()
|
return page.read().decode('utf-8').splitlines()
|
||||||
|
|
||||||
|
|
||||||
def find_max_commits(calendar):
|
def find_max_daily_commits(contributions_calendar):
|
||||||
"""finds the highest number of commits in one day"""
|
"""finds the highest number of commits in one day"""
|
||||||
output = set()
|
output = set()
|
||||||
|
|
||||||
for line in calendar:
|
for line in contributions_calendar:
|
||||||
for day in line.split():
|
for day in line.split():
|
||||||
if 'data-count=' in day:
|
if 'data-count=' in day:
|
||||||
commit = day.split('=')[1]
|
commit = day.split('=')[1]
|
||||||
@ -338,11 +338,11 @@ def main():
|
|||||||
|
|
||||||
git_base = ghe if ghe else GITHUB_BASE_URL
|
git_base = ghe if ghe else GITHUB_BASE_URL
|
||||||
|
|
||||||
cal = get_calendar(username, git_base)
|
contributions_calendar = retrieve_contributions_calendar(username, git_base)
|
||||||
|
|
||||||
max_commits = find_max_commits(cal)
|
max_daily_commits = find_max_daily_commits(contributions_calendar)
|
||||||
|
|
||||||
m = calculate_multiplier(max_commits)
|
m = calculate_multiplier(max_daily_commits)
|
||||||
|
|
||||||
repo = request_user_input(
|
repo = request_user_input(
|
||||||
'Enter the name of the repository to use by gitfiti: ')
|
'Enter the name of the repository to use by gitfiti: ')
|
||||||
@ -361,7 +361,7 @@ def main():
|
|||||||
'Enter the word "gitfiti" to exceed your max\n'
|
'Enter the word "gitfiti" to exceed your max\n'
|
||||||
'(this option generates WAY more commits)\n'
|
'(this option generates WAY more commits)\n'
|
||||||
'Any other input will cause the default matching behavior'
|
'Any other input will cause the default matching behavior'
|
||||||
).format(max_commits))
|
).format(max_daily_commits))
|
||||||
match = request_user_input()
|
match = request_user_input()
|
||||||
|
|
||||||
match = m if (match == 'gitfiti') else 1
|
match = m if (match == 'gitfiti') else 1
|
||||||
|
Reference in New Issue
Block a user