-
Notifications
You must be signed in to change notification settings - Fork 0
/
agSearch
executable file
·40 lines (29 loc) · 1.18 KB
/
agSearch
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
#!/usr/bin/env python3
# coding: utf-8
from searchModule.api import API
from searchModule.searchQueryFactory import SearchQueryFactory
from searchModule.searchQueryConsumerFactory import SearchQueryConsumerFactory
from analysisModule.codeQueryCollection import CodeQueryCollection
from analysisModule.repository import Repository
from analysisModule.analyzer import Analyzer
from analysisModule.codeQueryReader import CodeQueryReader
from initializerModule.mongoDB import MongoDB
from initializerModule.dbControl import DBControl
from initializerModule.parser import Parser
import copy
import os
inputDict = Parser.parseInput()
currentDir = os.getcwd()
dataDir = os.path.join(currentDir, 'data')
if not os.path.isdir(dataDir):
os.mkdir(dataDir)
DBControl.startContainer(dataDir)
db = MongoDB(inputDict['dbcollection'])
s = SearchQueryFactory.getSearchQuery(inputDict['api'], inputDict['searchqueries'])
c = SearchQueryConsumerFactory.getConsumer(inputDict['api'], s, db)
c.startSearch()
c.reportRepos()
queryCollection = CodeQueryReader.readCodeQueriesFromFile(inputDict['codequeries'])
repoAnalyzer = Analyzer(queryCollection, db)
repoAnalyzer.beginAnalysis()
DBControl.stopContainer()