forked from zhangyu19/dupPRdetect
Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
7b6e7bdc24 | |
|
8e0fdd0f90 | |
![]() |
7d0ee6c508 | |
|
a5ae301e06 | |
|
f2a8ad725c | |
![]() |
2a57de44e5 |
11
app.py
11
app.py
|
@ -3,6 +3,7 @@ import detect_gitee, detect_trustie
|
||||||
import re
|
import re
|
||||||
import operator
|
import operator
|
||||||
import redis
|
import redis
|
||||||
|
import time
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@ -67,7 +68,11 @@ def parse_trustie(PR_url, error):
|
||||||
|
|
||||||
repo_info, pr_num = url_2_repo(PR_url)
|
repo_info, pr_num = url_2_repo(PR_url)
|
||||||
scores = detect_trustie.main(repo_info, pr_num, url_head)
|
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)
|
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:
|
if scores is None:
|
||||||
error = 1
|
error = 1
|
||||||
|
@ -80,6 +85,8 @@ def parse_trustie(PR_url, error):
|
||||||
@app.route('/result',methods = ['POST', 'GET'])
|
@app.route('/result',methods = ['POST', 'GET'])
|
||||||
def output():
|
def output():
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
result = request
|
result = request
|
||||||
|
|
||||||
|
@ -93,6 +100,8 @@ def output():
|
||||||
print("trustie")
|
print("trustie")
|
||||||
re = parse_trustie(PR_url, error)
|
re = parse_trustie(PR_url, error)
|
||||||
|
|
||||||
|
print("time cost: ", time.time() - start_time)
|
||||||
|
|
||||||
if re["error"] == 1:
|
if re["error"] == 1:
|
||||||
return render_template("error.html", result=locals())
|
return render_template("error.html", result=locals())
|
||||||
else:
|
else:
|
||||||
|
@ -112,6 +121,8 @@ def output():
|
||||||
print("trustie")
|
print("trustie")
|
||||||
re = parse_trustie(PR_url, error)
|
re = parse_trustie(PR_url, error)
|
||||||
|
|
||||||
|
print("time cost: ", time.time() - start_time)
|
||||||
|
|
||||||
if re["error"] == 1:
|
if re["error"] == 1:
|
||||||
return render_template("error.html", result=locals())
|
return render_template("error.html", result=locals())
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -47,7 +47,6 @@ def crawl_file_to_pr(all_pr_info, repo, url_head):
|
||||||
response = requests.get(file_url, headers=header, stream=True)
|
response = requests.get(file_url, headers=header, stream=True)
|
||||||
r = response.json()
|
r = response.json()
|
||||||
pr["files"] = r
|
pr["files"] = r
|
||||||
# print(pr)
|
|
||||||
|
|
||||||
return all_pr_info
|
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):
|
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_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 = jieba.lcut(current_pr_value["title"] + " " + current_pr_value['description'])
|
||||||
current_word = [x.strip() for x in current_word if x.strip() != '']
|
current_word = [x.strip() for x in current_word if x.strip() != '']
|
||||||
|
|
|
@ -362,9 +362,9 @@ p {
|
||||||
.header {
|
.header {
|
||||||
position:relative;
|
position:relative;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
background: linear-gradient(60deg, rgba(84,58,183,1) 0%, rgba(0,172,193,1) 100%);
|
color:black;
|
||||||
color:white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width:50px;
|
width:50px;
|
||||||
fill:white;
|
fill:white;
|
||||||
|
@ -401,12 +401,20 @@ p {
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
position:relative;
|
position: relative;
|
||||||
height:20vh;
|
|
||||||
text-align:center;
|
text-align:center;
|
||||||
background-color: white;
|
background-color: #323232;
|
||||||
|
}
|
||||||
|
footer{
|
||||||
|
position:fixed;
|
||||||
|
color:#fff;
|
||||||
|
bottom:0;
|
||||||
|
width:100%;
|
||||||
|
height:30px;
|
||||||
|
line-height:30px;
|
||||||
|
text-align:center;
|
||||||
|
background-color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Animation */
|
/* Animation */
|
||||||
|
|
||||||
.parallax > use {
|
.parallax > use {
|
||||||
|
@ -543,13 +551,15 @@ body, html {
|
||||||
}
|
}
|
||||||
|
|
||||||
.word-no-effects {
|
.word-no-effects {
|
||||||
position: relative;
|
height: 6rem;
|
||||||
top: 20%;
|
line-height: 6rem;
|
||||||
margin: auto;
|
background: #f1f8ff;
|
||||||
padding-top: 20px;
|
text-align: center;
|
||||||
height: 100px;
|
border-radius: 4px 4px 0 0;
|
||||||
color: white;
|
font-size: 2em;
|
||||||
font: 700 normal 2.6666666667em 'Montserrat', sans-serif;
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
box-shadow: 0 0 14px rgb(0 0 0 / 10%);
|
||||||
|
-webkit-box-shadow: 0 0 14px rgb(0 0 0 / 10%);
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -563,6 +573,7 @@ body {
|
||||||
-webkit-backface-visibility: hidden;
|
-webkit-backface-visibility: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0px !important;
|
padding: 0px !important;
|
||||||
|
padding-bottom: 30px !important;
|
||||||
margin: 0px !important;
|
margin: 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ of Simple CSS Waves-->
|
||||||
|
|
||||||
<link rel="stylesheet" href="http://se.learnerhub.net//dup/font-awesome.css">
|
<link rel="stylesheet" href="http://se.learnerhub.net//dup/font-awesome.css">
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="http://se.learnerhub.net//dup/wave.css">
|
<link rel="stylesheet" type="text/css" href="../static/css/wave.css">
|
||||||
<!--<link rel="stylesheet" type="text/css" href="../static/css/wave.css">-->
|
<!--<link rel="stylesheet" type="text/css" href="http://se.learnerhub.net//dup/wave.css">-->
|
||||||
|
|
||||||
<script src="http://se.learnerhub.net/jquery-3.6.0.min.js" type="text/javascript"></script>
|
<script src="http://se.learnerhub.net/jquery-3.6.0.min.js" type="text/javascript"></script>
|
||||||
<script src="../static/js/percent.js" type="text/javascript"></script>
|
<script src="../static/js/percent.js" type="text/javascript"></script>
|
||||||
|
@ -18,16 +18,17 @@ of Simple CSS Waves-->
|
||||||
<script src="http://se.learnerhub.net//dup/bootstrap.min.js"></script>
|
<script src="http://se.learnerhub.net//dup/bootstrap.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
<div class="header" style="flex-float:column">
|
<div class="header" style="flex-float:column">
|
||||||
|
|
||||||
<!-- <div style="height: 10px;"></div> -->
|
<!-- <div style="height: 10px;"></div> -->
|
||||||
<div class="word-no-effects">P/R重复性检测</div>
|
<div class="word-no-effects">P/R重复性检测</div>
|
||||||
|
|
||||||
<!--Content before waves-->
|
<!--Content before waves-->
|
||||||
<div class="flex" style="flex-flow: column; overflow:auto; margin-left: 10px; margin-right: 10px">
|
<div class="flex" style="flex-flow: column; overflow:auto; margin: 30px 10px">
|
||||||
<div class="table-responsive table-hover" style="height: 100%; width: 90%; min-height: 400px;">
|
<div class="table-responsive table-hover" style="height: 100%; width: 90%; min-height: 400px;">
|
||||||
|
|
||||||
<table class="table table-bordered white" >
|
<table class="table table-bordered black" >
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">PR编号</th>
|
<th scope="col">PR编号</th>
|
||||||
|
@ -51,38 +52,19 @@ of Simple CSS Waves-->
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!--Waves Container-->
|
|
||||||
<div>
|
|
||||||
<svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
|
|
||||||
<defs>
|
|
||||||
<path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"/>
|
|
||||||
</defs>
|
|
||||||
<g class="parallax">
|
|
||||||
<use xlink:href="#gentle-wave" x="48" y="0" fill="rgba(255,255,255,0.7"/>
|
|
||||||
<use xlink:href="#gentle-wave" x="48" y="3" fill="rgba(255,255,255,0.5)"/>
|
|
||||||
<use xlink:href="#gentle-wave" x="48" y="5" fill="rgba(255,255,255,0.3)"/>
|
|
||||||
<use xlink:href="#gentle-wave" x="48" y="7" fill="#fff"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<!--Waves end-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--Header ends-->
|
<!--Header ends-->
|
||||||
|
|
||||||
<!--Content starts-->
|
<!--Content starts-->
|
||||||
<div class="content flex">
|
<footer>
|
||||||
<a target="_blank" href="https://www.mulanos.cn" class="col-md-2" style="color: black;">©木兰开源社区</a>
|
<div class="content flex">
|
||||||
<a target="_blank" href="https://www.mulanos.cn/about_us" class="col-md-2" style="color: black;">关于我们</a>
|
<a target="_blank" href="https://www.mulanos.cn" class="col-md-2" style="color: rgb(136, 136, 136);">©木兰开源社区</a>
|
||||||
<a target="_blank" href="http://beian.miit.gov.cn/#/Integrated/index" class="col-md-2" style="color: black;">粤ICP备12009483号</a>
|
<a target="_blank" href="https://www.mulanos.cn/about_us" class="col-md-2" style="color: rgb(136, 136, 136);">关于我们</a>
|
||||||
<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010102004572" class="col-md-3" style="color: black;">
|
<a target="_blank" href="http://beian.miit.gov.cn/#/Integrated/index" class="col-md-2" style="color: rgb(136, 136, 136);">粤ICP备12009483号</a>
|
||||||
<img class="vertical4" src="http://oscimg.oschina.net/oscnet/up-17f2400d0edc099191961ca721235261b1b.png">京公网安备 11010102004571号</a>
|
<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010102004572" class="col-md-3" style="color: rgb(136, 136, 136);">
|
||||||
</div>
|
<img class="vertical4" src="http://oscimg.oschina.net/oscnet/up-17f2400d0edc099191961ca721235261b1b.png">京公网安备 11010102004571号</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
<!--Content ends-->
|
<!--Content ends-->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
Loading…
Reference in New Issue