-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge2db
More file actions
69 lines (42 loc) · 1.6 KB
/
merge2db
File metadata and controls
69 lines (42 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from pymongo import MongoClient
client = MongoClient('mongodb+srv://mbillahmim:[email protected]/')
db = client.sample_mflix
helperMethods = db.helperMethods
repoMethods = db.repoMethods
helperMethodsList = []
repoMethodsList = []
for item in helperMethods.find():
helperMethodsList.append(item)
for element in repoMethods.find():
repoMethodsList.append(element)
client.close()
def getMethodBody(repo,functionName,argsCount):
methodBody=""
fileName=""
for item in repoMethodsList:
if (item.get('repo')==repo):
fileName = item.get('file')
methods = item.get('methods')
for method in methods:
if(functionName == method.get('FunctionName') and argsCount == method.get('ArgsCount')):
methodBody = method.get('Syntax')
return methodBody,fileName
return methodBody,fileName
counter = 0
for helper in helperMethodsList:
repo = helper.get('repo')
helpers = helper.get('helpers')
for item in helpers:
functionName = item.get('FunctionName')
argsCount = item.get('ArgsCount')
methodBody, fileName = getMethodBody(repo,functionName,argsCount)
item["MethodBody"] = methodBody
item["FileName"] = fileName
#print(item)
counter += 1
print("Processed helpers: ",counter)
client = MongoClient('mongodb+srv://mbillahmim:[email protected]/')
db = client.sample_mflix
javaTestDataset = db.javaTestDataset
for item in helperMethodsList:
javaTestDataset.insert_one(item)