修改了tablename的获取方式

This commit is contained in:
zhangxunhui 2022-08-28 07:45:53 +08:00
parent 78da04a2ae
commit cc30fcd559
1 changed files with 12 additions and 26 deletions

View File

@ -27,30 +27,12 @@ class RiskEvaluator(object):
4.get the fix message of commit of consistent change
5.evaluate the risk
"""
method_function_relations = "{id}{separator}method_function_relations".format(
id=self.repoInfo.id,
separator=GlobalConstants.SEPARATOR,
)
clone_relations_function = "{id}{separator}clone_relations_function".format(
id=self.repoInfo.id,
separator=GlobalConstants.SEPARATOR,
)
commits = "{id}{separator}commits".format(
id=self.repoInfo.id,
separator=GlobalConstants.SEPARATOR,
)
blob_methods = "{id}{separator}blob_methods".format(
id=self.repoInfo.id,
separator=GlobalConstants.SEPARATOR,
)
blob_commit_relations = "{id}{separator}blob_commit_relations".format(
id=self.repoInfo.id,
separator=GlobalConstants.SEPARATOR,
)
commit_relations = "{id}{separator}commit_relations".format(
id=self.repoInfo.id,
separator=GlobalConstants.SEPARATOR,
)
method_function_relations = mysqlOp.tablename_dict["method_function_relations"]
clone_relations_function = mysqlOp.tablename_dict["clone_relations_function"]
commits = mysqlOp.tablename_dict["commits"]
blob_methods = mysqlOp.tablename_dict["blob_methods"]
blob_commit_relations = mysqlOp.tablename_dict["blob_commit_relations"]
commit_relations = mysqlOp.tablename_dict["commit_relations"]
# Fix: only consider the life time of clone pair(clone pair existing commits)
relate_commits = []
sql_clone_pairs = """
@ -310,9 +292,13 @@ class RiskEvaluator(object):
repoInfos: List[RepoInfo] = FileOperator("repos").load_repos()
mysqlOp: MySQLOperator = MySQLOperator(config_path="config.yml")
for repoInfo in repoInfos:
mysqlOp: MySQLOperator = MySQLOperator(config_path="config.yml", repoInfo=repoInfo)
# clone_pair = RiskEvaluator(
# 14, 10, repoInfo
# ) # Once evaluate the risk of one clone pair(function_id)
clone_pair = RiskEvaluator(
14, 10, repoInfo
10, 7, repoInfo
) # Once evaluate the risk of one clone pair(function_id)
print(clone_pair.evaluate(mysqlOp))