修正sort的错误

This commit is contained in:
root 2021-11-17 17:17:53 +08:00
parent ec2e15a11d
commit f2a8ad725c
3 changed files with 4 additions and 2 deletions

4
app.py
View File

@ -67,7 +67,11 @@ def parse_trustie(PR_url, error):
repo_info, pr_num = url_2_repo(PR_url)
scores = detect_trustie.main(repo_info, pr_num, url_head)
for i in scores:
i["avg_score"] = float(i["avg_score"])
scores = sorted(scores, key=operator.itemgetter("avg_score"), reverse=True)
for i in scores:
i["avg_score"] = str(i["avg_score"])
if scores is None:
error = 1

View File

@ -47,7 +47,6 @@ def crawl_file_to_pr(all_pr_info, repo, url_head):
response = requests.get(file_url, headers=header, stream=True)
r = response.json()
pr["files"] = r
# print(pr)
return all_pr_info
@ -74,7 +73,6 @@ def crawl_all_pr(url):
def detect_text_file_dup(all_pr_info, project_key, pr_num):
print(r.get(project_key + "_" + str(pr_num)))
current_pr_value = json.loads(r.get(project_key + "_" + str(pr_num)))
current_word = jieba.lcut(current_pr_value["title"] + " " + current_pr_value['description'])
current_word = [x.strip() for x in current_word if x.strip() != '']

BIN
nohup.out Normal file

Binary file not shown.