Merge pull request '重新修改factor' (#65) from zy into master

This commit is contained in:
MillerEvan 2022-09-19 16:41:05 +08:00
commit 2fc11e838c
1 changed files with 24 additions and 18 deletions

View File

@ -277,6 +277,13 @@ def factor_extractor(function_id_1: int, function_id_2: int, mysqlOp: MySQLOpera
path = re.split("[\\\\ |/]", filepath)
if "test" or "Test" in path:
is_test = 2
else:
if filepath[0] == filepath[1]:
file_distance = 0
filepath = filepath[0].get("filepath").decode()
path = re.split("[\\\\ |/]", filepath)
if "test" or "Test" in path:
is_test = 2
else:
is_test = 0
filepath_1 = filepath[0].get("filepath").decode()
@ -289,10 +296,8 @@ def factor_extractor(function_id_1: int, function_id_2: int, mysqlOp: MySQLOpera
if (path_2[0] == "test" or path_2[0] == "Test") and is_test <= 2:
is_test = is_test + 1
if path_1[0] == path_2[0]:
if len(filepath_1) == len(filepath_2) == 0:
file_distance = 0
break
else:
del path_1[0]
del path_2[0]
filepath_1 = path_1[0]
@ -303,6 +308,7 @@ def factor_extractor(function_id_1: int, function_id_2: int, mysqlOp: MySQLOpera
else:
file_distance = len(path_2)
break
except Exception:
print(repoInfo.id)
print(function_id_1, function_id_2)