def main(): parser = argparse.ArgumentParser(description='BloomFilter Project') parser.add_argument('-c', '--configfile', help='File holding configuration of Bloom Filter', default='testConfigHashType1.txt', dest='configFileName') parser.add_argument('-i', '--infile', help='Input file of data to add to Bloom Filter', default='testInput.txt', dest='inFileName') parser.add_argument('-o', '--outfile', help='Output file holding Bloom Filter results', default='testOutput.txt', dest='outFileName') parser.add_argument('-t', '--task', help='Which task to perform (1,2,3)', type=int, choices=[1, 2, 3], default=2, dest='taskToDo') parser.add_argument( '-v', '--valfile', help='Validation file holding Bloom Filter expected results', default='validResHashType1.txt', dest='valFileName') args = parser.parse_args() configData = util.buildBFConfigStruct(args) if configData['task'] == 2: task2(configData) elif configData['task'] == 1: task1(configData) elif configData['task'] == 3: task3(configData) else: print('Unknown Task : ' + str(configData['task']))
def main(): # DO NOT REMOVE ANY ARGUMENTS FROM THE ARGPARSER BELOW parser = argparse.ArgumentParser(description='BloomFilter Project') parser.add_argument( '-c', '--configfile', help='File holding configuration of Bloom Filter', default='testConfigHashType2.txt', dest='configFileName') parser.add_argument( '-i', '--infile', help='Input file of data to add to Bloom Filter', default='testInput.txt', dest='inFileName') parser.add_argument( '-o', '--outfile', help='Output file holding Bloom Filter results', default='testOutput.txt', dest='outFileName') # you may use this argument to distinguish between tasks - default is task # 2 - do not change # you are not required to use this code template for tasks 1 and 3. parser.add_argument( '-t', '--task', help='Which task to perform (1,2,3)', type=int, choices=[ 1, 2, 3], default=2, dest='taskToDo') parser.add_argument( '-v', '--valfile', help='Validation file holding Bloom Filter expected results', default='validResHashType2.txt', dest='valFileName') # args for autograder, do not modify parser.add_argument( '-n', '--sName', help='Student name, used by autograder', default='GT', dest='studentName') parser.add_argument( '-a', '--autograde', help='Autograder-called (2) or not (1=default)', type=int, choices=[ 1, 2], default=1, dest='autograde') args = parser.parse_args() # configData is a dictionary that holds the important info needed to build # your bloom filter # this includes the hash functon coefficients for the hash calculation for # Task 2 (do not use these for Tasks 1 and 3) # buildBFConfigStruct prints out to the console all the elements in # configData configData = util.buildBFConfigStruct(args) # perform appropriate task - 2 is default and the task2 code execution # will be tested for your grade if configData['task'] == 2: task2(configData) elif configData['task'] == 1: # you are not required to use this code template for tasks 1 and 3. task1(configData) elif configData['task'] == 3: # you are not required to use this code template for tasks 1 and 3. task3(configData) else: print ('Unknown Task : ' + str(configData['task']))