bad_clone_prediction/GraphExtractor.py

32 lines
920 B
Python

from models.RepoInfo import RepoInfo
from MySQLOperator import MySQLOperator
class GraphExtractor(object):
def __init__(self, repoInfo: RepoInfo, mysqlOp: MySQLOperator) -> None:
self.repoInfo = repoInfo
self.mysqlOp = mysqlOp
def form_nodes(self):
self.mysqlOp.cursor.execute("select ")
print("pause")
def form_rels(self):
print("pause")
def extract_graph(repoInfo: RepoInfo, mysqlOp: MySQLOperator):
step_name = "graph extraction"
mysqlOp.cursor.execute(
"select handled from `{steps_tablename}` where step_name=%s".format(
steps_tablename=mysqlOp.tablename_dict["steps"]
),
(step_name),
)
handled = mysqlOp.cursor.fetchone()["handled"]
if not handled:
graph_extractor = GraphExtractor(repoInfo=repoInfo, mysqlOp=mysqlOp)
graph_extractor.form_nodes()
graph_extractor.form_rels()