-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathlocalTestingFile.py
116 lines (100 loc) · 4.19 KB
/
localTestingFile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from github import Github
from themes.level_1.level1 import genHTMLLevel1
from themes.level_2.level2 import genHTMLLevel2
from utils.convertors import Convertors
from utils.adders import Adder
import sys
import os
import re
git = Github(sys.argv[1])
theme_selected = sys.argv[2]
blogs = eval(sys.argv[3].title())
include_hackathon = eval(sys.argv[4].title())
stats_choice = sys.argv[5]
# currentRepoName = sys.argv[6].split('/')[-1]
# currentRepoBranch = sys.argv[7].split('/')[-1]
resume_link = sys.argv[8]
allow_footer = eval(sys.argv[9].title())
projects_sort_by = sys.argv[10]
stats_customization = sys.argv[11]
social_links = sys.argv[12:]
convert = Convertors()
adder = Adder()
start = git.rate_limiting[0]
print(f'Request left at start of the script: {start}')
user_object = git.get_user()
git_username = user_object.login
user_data = {'username': git_username,
'git_photo_url': user_object.avatar_url,
'git_bio': user_object.bio,
'git_email': user_object.email,
'git_followers': user_object.followers,
'git_following': user_object.following,
'name': user_object.name,
'latest_updated': str(user_object.updated_at)}
repo_list = [repo.name for repo in git.get_user().get_repos()]
project_data = {}
hackathon_data = {}
if include_hackathon:
for repo in repo_list:
print(f'Repo being checked: {repo}')
try:
repo_object = git.get_repo(git_username + '/' + repo)
repo_topics = repo_object.get_topics()
if len(repo_topics) != 0:
if 'project' in repo_topics:
project_data[f'{repo}'] = {'repo_topics': repo_topics,
'repo_description': repo_object.description,
'repo_stars': int(repo_object.stargazers_count),
'repo_forks': int(repo_object.forks_count)}
if 'hackathon' in repo_topics:
hackathon_data[f'{repo}'] = {'repo_topics': repo_topics,
'repo_description': repo_object.description,
'repo_stars': int(repo_object.stargazers_count),
'repo_forks': int(repo_object.forks_count)}
else:
continue
else:
continue
except:
continue
else:
for repo in repo_list:
print(f'Repo being checked: {repo}')
try:
repo_object = git.get_repo(git_username + '/' + repo)
repo_topics = repo_object.get_topics()
if len(repo_topics) != 0:
if 'project' in repo_topics:
project_data[f'{repo}'] = {'repo_topics': repo_topics,
'repo_description': repo_object.description,
'repo_stars': int(repo_object.stargazers_count),
'repo_forks': int(repo_object.forks_count)}
else:
continue
else:
continue
except:
continue
end = git.rate_limiting[0]
print(f'Request left at end of the script: {end}')
print(f'Requests Consumed in this process: {start - end}')
project_repos = convert.repoDataToHTML(
project_data, git_username, projects_sort_by)
if include_hackathon:
hackathon_repos = convert.repoDataToHTML(
hackathon_data, git_username, projects_sort_by)
else:
hackathon_repos = None
social_data = convert.soicalLinksListToHTML(
social_links, user_data['username'])
if theme_selected == '1':
newIndex = genHTMLLevel1(
user_data, project_repos, hackathon_repos, blogs, social_data, resume_link, allow_footer)
elif theme_selected == '2':
newIndex = genHTMLLevel2(user_data, project_repos,
hackathon_repos, blogs, social_data, resume_link, allow_footer)
newIndex = adder.addGitHubStats(
newIndex, stats_choice, git_username, theme_selected, stats_customization)
with open('index.html', 'w', encoding='UTF-8') as f:
f.write(newIndex)