コード例 #1
0
    def setUp(self):
        self.method1 = "def debugFunctions(self, funcList):"
        self.method2 = "def _Funct1():"
        self.method3 = " def Another_function(arg1, arg2 = 5):    "
        self.method4 = "def test( _args ): "
        self.method5 = "def 1Bad():"
        self.method6 = "def functionname([formal_args,] *var_args_tuple ):"
        self.method7 = "def alsoBad() "
        self.method8 = "noFunct():"
        self.method9 = " def        okay(args = 4):"


        c_info = ConfigInfo("../util/pytest.ini")

        self.testChunk = logChunk.logChunk("", "Python")

        self.chunk1 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk1.txt"), "Python", c_info)
        self.chunk2 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk2.txt"), "Python", c_info)
        self.chunk3 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk3.txt"), "Python", c_info)
        self.chunk4 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk4.txt"), "Python", c_info)
        self.chunk5 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk5.txt"), "Python", c_info)
        self.chunk6 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk6.txt"), "Python", c_info)
        self.chunk7 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk7.txt"), "Python", c_info)
        self.chunk8 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk8.txt"), "Python", c_info)
        self.chunk9 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk9.txt"), "Python", c_info)
        self.chunk10 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk10.txt"), "Python", c_info)
        self.chunk11 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk11.txt"), "Python", c_info)
        self.chunk12 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk12.txt"), "Python", c_info)
        self.chunk13 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk13.txt"), "Python", c_info)
        self.chunk14 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk14.txt"), "Python", c_info)
        self.chunk15 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk15.txt"), "Python", c_info)
        self.chunk16 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk16.txt"), "Python", c_info)
        self.chunk17 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk17.txt"), "Python", c_info)
        self.chunk18 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk18.txt"), "Python", c_info)
        self.chunk19 = logChunk.logChunk(self.readHelper("testfiles/Python/testChunk19.txt"), "Python", c_info)
コード例 #2
0
    def setUp(self):
        self.config_file = "../util/gitcprocTest.ini"
        self.config_info = ConfigInfo(self.config_file)
        self.repo_file = self.config_info.cfg.ConfigSectionMap(
            "Repos")['repo_url_file']
        self.repos = [
            r.strip().replace("/", self.config_info.SEP)
            for r in open(self.repo_file, 'r')
        ]
        #Get the download location
        self.output_loc = self.config_info.cfg.ConfigSectionMap(
            "Repos")['repo_locations']

        #Get the log file names for this.
        self.log_files = [("../../evaluation/log_files/" + r + ".out",
                           "../../evaluation/log_files/" + r + ".err")
                          for r in self.repos]
        #Clean up old output and files for this
        for log in self.log_files:
            if (os.path.exists(log[0])):
                subprocess.call(["rm", log[0]])
            if (os.path.exists(log[1])):
                subprocess.call(["rm", log[1]])

        if (os.path.isdir("../../evaluation/repos/gitcprocTest/")):
            subprocess.call(
                ["rm", "-rf", "../../evaluation/repos/gitcprocTest/"])

        subprocess.call(
            ['mkdir', '-p', '../../evaluation/repos/gitcprocTest/'])

        self.csv_loc = "../Results/" + self.repos[
            0] + "ChangeSummary.csv"  #Note that this is likely to change with better output configuration.
        self.csv_loc2 = "../Results/" + self.repos[
            0] + "PatchSummary.csv"  #Note that this is likely to change with better output configuration.
コード例 #3
0
    def setUp(self):
        self.javaMethod1 = "public static Intent createIntent(Context context, String username, String password) {"
        self.javaMethod2 = " public <V> V post(final String uri, final Object params, final Type type) \n throws IOException {"
        self.javaMethod3 = "public static Intent createIntent(final Collection<? extends Issue> issues,\n final Repository repository, final int position) {"
        self.javaMethod4 = "@Override \n public List<User> run(Account account) throws Exception {"
        self.javaMethod5 = "private JClass typeBoundsToJClass(GeneratedClassHolder holder, List<? extends TypeMirror> bounds, Map<String, TypeMirror> actualTypes) {"
        self.javaMethod6 = " public JMethod implementMethod(GeneratedClassHolder holder, List<ExecutableElement> methods, String methodName, String returnType, String... parameterTypes) {"
        self.javaMethod7 = "ProgrammerInterview pInstance = new    ProgrammerInterview() {\npublic void read() {"

        c_info = ConfigInfo("../util/javatest.ini")
        self.testChunk2 = logChunk.logChunk("", "Java", c_info)

        #Read in the block tests
        self.chunkb1 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk1.txt"), "Java", c_info)
        self.chunkb2 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk2.txt"), "Java", c_info)
        self.chunkb3 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk3.txt"), "Java", c_info)
        self.chunkb4 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk4.txt"), "Java", c_info)
        self.chunkb5 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk5.txt"), "Java", c_info)
        self.chunkb6 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk6.txt"), "Java", c_info)
        self.chunkb7 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk7.txt"), "Java", c_info)
        self.chunkb8 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk8.txt"), "Java", c_info)
        self.chunkb9 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk9.txt"), "Java", c_info)
        self.chunkb10 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk10.txt"), "Java", c_info)
        self.chunkb11 = logChunk.logChunk(
            self.readHelper("testfiles/Block/testChunk11.txt"), "Java", c_info)
コード例 #4
0
    def setUp(self):

        c_info = ConfigInfo("../util/pytest.ini")
        self.testCommit1 = ghLogDb.ghLogDb(
            "testfiles/ghLogDbTestPython/TestCommit1.txt", c_info)
        self.testCommit2 = ghLogDb.ghLogDb(
            "testfiles/ghLogDbTestPython/TestCommit2.txt", c_info)
コード例 #5
0
    def setUp(self):

        c_info = ConfigInfo("../util/sample_conf.ini")
        c_info2 = ConfigInfo("../util/javatest.ini")
        Util.DATABASE = 0
        self.testCommit1 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit1.txt",c_info)
        self.testCommit2 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit2.txt",c_info)
        self.testCommit3 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit3.txt",c_info)
        self.testCommit4 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit4.txt",c_info)
        self.testCommit5 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit5.txt",c_info)

        self.testCommit7 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit7.txt",c_info)
        #self.testCommit8 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit8.txt",c_info) #Broken, but I don't think its fixable. Fault of git logger
        self.testCommit9 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit9.txt",c_info)
        self.testCommit10 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit10.txt",c_info)
        self.testCommit11 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit11.txt",c_info)
        self.testCommit12 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit12.txt",c_info)
        self.testCommit13 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit13.txt",c_info)
        self.testCommit14 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit14.txt",c_info)
        self.testCommit15 = ghLogDb.ghLogDb("testfiles/ghLogDbTest/TestCommit15.txt",c_info)

        #self.testCommit13.processLog() #Make sure there is no crash -> Hangs a long time

        self.testCommitb1=ghLogDb.ghLogDb("testfiles/ghLogDbTestBlock/TestCommit1.txt",c_info2)
コード例 #6
0
def main():
    print "Utility to process github logs"

    if len(sys.argv) < 3:
        print "!!! Usage: python ghProc.py project config_file [password]"
        sys.exit()

    project = str(sys.argv[1])
    config_file = sys.argv[2]
    config_info = ConfigInfo(config_file)

    if (config_info.DATABASE):
        if (len(sys.argv) < 4):
            print(
                "Database output selected, please input the password after the project"
            )
            sys.exit()

        password = str(sys.argv[3])

    if checkProj(project) == False:
        print("!! Please provide a valid directory")
        return

    if (config_info.LOGTIME):
        start = datetime.datetime.now()

    #dumpLog(project)
    if (config_info.DATABASE):
        parseFinish = processLog(project, config_info, password)
    else:
        parseFinish = processLog(project, config_info)

    print "!! Done"

    if (config_info.LOGTIME):
        end = datetime.datetime.now()
        print("Project: " + project)
        print("Start time: " + str(start))
        print("Parse Finish time:" + str(parseFinish))
        print("End time: " + str(end))
        print("Parse time: " + str(parseFinish - start))
        print("Write time: " + str(end - parseFinish))
        print("Total time: " + str(end - start))
コード例 #7
0
def main():
    print("==== Utility to process Github logs ===")

    if len(sys.argv) < 3:
        print("!!! Usage: python ghProc.py project config_file")
        sys.exit()

    project = sys.argv[1]
    config_file = sys.argv[2]

    config_info = ConfigInfo(config_file)
    log_config = config_info.cfg.ConfigSectionMap("Log")
    try:
        langs = log_config['languages'].split(",")
    except:
        langs = []  #Treat empty as showing all supported languages.

    if not os.path.isdir(project):
        print("!! Please provide a valid directory")
        return

    getGitLog(project, langs, config_info)
    #processLog(project)
    print("Done!!")
コード例 #8
0
 def setUp(self):
     self.langSwitch = LanguageSwitcherFactory.LanguageSwitcherFactory.createLS(
         "C")
     c_info = ConfigInfo("../util/sample_conf.ini")
     self.sT = ScopeTrackerFactory.ScopeTrackerFactory.createST(
         self.langSwitch, c_info)
コード例 #9
0
    "-pl",
    "--parse_log",
    action="store_true",
    help="Flag that indicates you want to run the step to parse the logs.")
parser.add_argument(
    "-p",
    "--password",
    type=str,
    default=None,
    help="If you are outputting to the database, you must enter your password."
)

args = parser.parse_args()

config_file = args.config_file
config_info = ConfigInfo(config_file)

if (
        config_info.DATABASE and args.parse_log
):  #If we have database output selected and are performing the parse-log step.
    if args.password is not None:
        password = args.password
    else:
        password = getpass.getpass(
            prompt="Database option selected, enter your password:"******""

repo_config = config_info.cfg.ConfigSectionMap("Repos")

if (args.download):