def main(): """ Main execution flow. """ try: args = process_arguments() config = utilities.read(args.config_file) manifest = utilities.read(args.manifest_file) # TODO: Refactor core.config = config utilities.TOKENIZER = core.Tokenizer() database = Database(config['options']['datasource']) globaloptions = { 'today': config['options']['today'], 'timeout': config['options']['timeout'] } attributes = Attributes( manifest['attributes'], database, args.cleanup, args.key_string, **globaloptions ) if not os.path.exists(args.repositories_root): os.makedirs(args.repositories_root, exist_ok=True) _run = run.Run( args.repositories_root, attributes, database, config['options']['threshold'], args.num_processes ) _run.run([int(line) for line in args.repositories_sample]) except Exception as e: extype, exvalue, extrace = sys.exc_info() traceback.print_exception(extype, exvalue, extrace)
def main(): """ Main execution flow. """ try: args = process_arguments() config = utilities.read(args.config_file) manifest = utilities.read(args.manifest_file) # TODO: Refactor core.config = config utilities.TOKENIZER = core.Tokenizer() database = Database(config['options']['datasource']) globaloptions = { 'today': config['options']['today'], 'timeout': config['options']['timeout'] } attributes = Attributes(manifest['attributes'], database, args.cleanup, args.key_string, **globaloptions) if not os.path.exists(args.repositories_root): os.makedirs(args.repositories_root, exist_ok=True) table = 'reaper_results' if args.goldenset: table = 'reaper_goldenset' _run = run.Run(args.repositories_root, attributes, database, config['options']['threshold'], args.num_processes) _run.run([int(line) for line in args.repositories_sample], table) except Exception as e: extype, exvalue, extrace = sys.exc_info() traceback.print_exception(extype, exvalue, extrace)
def test_read(self): # Arrange path = os.path.join(ASSETS_PATH, 'test.json') expected = {'message': 'hello world!!!'} # Act actual = utilities.read(open(path)) # Assert self.assertEqual(expected, actual)
def setUp(self): path = (os.path.join( os.path.abspath( os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir)), 'config.json')) config = None with open(path, 'r') as file_: config = utilities.read(file_) self.database = database.Database(config['options']['datasource']) core.config = config utilities.TOKENIZER = core.Tokenizer()