-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatch_so_github.py
More file actions
29 lines (23 loc) · 902 Bytes
/
match_so_github.py
File metadata and controls
29 lines (23 loc) · 902 Bytes
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
# -*- coding: utf-8 -*-
from github import github_get_repositories
from stack_overflow import so_get_code, so_get_interesting_answers, code_snippet_get_language
from rank_code import rank_code_snippet_in_rep
# TODO: configure get_repositories using more parameters
popular_languages = ['Java']
if __name__ == '__main__':
code_list = []
rank_list = []
hub = {}
for l in popular_languages:
hub[l] = github_get_repositories(l)
# TODO: define filters, define amount of answers to get
answers = so_get_interesting_answers()
for answer in answers:
code_list.append(so_get_code(answer))
for code_snippet in code_list:
language = code_snippet_get_language(code_snippet)
for rep in hub[language]:
# if 'spark-master' in rep[0]:
rank_list.append((code_snippet, rep, rank_code_snippet_in_rep(rep, code_snippet)))
for r in rank_list:
print (r[2])