def importTemplates(file): _kv = KeyValues() log.info("Loading {0}".format(file)) _kv.load(file) for id in _kv['Templates']: importTemplate(id,_kv['Templates'][id])
def importTemplates(file): _kv = KeyValues() log.info("Loading {0}".format(file)) _kv.load(file) for id in _kv['Templates']: importTemplate(id, _kv['Templates'][id])
outfile=args.input_file+'.new' outfile = os.path.abspath(outfile) outdir = os.path.dirname(outfile) if not os.path.isdir(outdir): os.makedirs(outdir) log.basicConfig(format='%(asctime)s [%(levelname)-8s]: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', filename=outfile+'.log',filemode='w',level=log.DEBUG) for included_file in args.include: importTemplates(included_file) if args.spawnpoints != '': importSpawnPoints(args.spawnpoints) kv = KeyValues() kv.load(sys.argv[1]) if 'Templates' in kv: for id in kv['Templates']: templates[id]=kv['Templates'][id] log.info('Loaded {0} templates.'.format(len(templates))) scanForInvalidTemplates(kv,args.input_file,['WaveSchedule']) log.info('Finished scanning: {0} warnings, {1} errors.'.format(stats['warnings'],stats['errors'])) log.info('Used templates: {0}'.format(len(template_uses))) for key in sorted(template_uses.keys()): log.info('Template {0}: Used {1} times.'.format(key,template_uses[key])) #exportTemplates('PARSED_TEMPLATES.pop')
os.makedirs(outdir) log.basicConfig(format='%(asctime)s [%(levelname)-8s]: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', filename=outfile + '.log', filemode='w', level=log.DEBUG) for included_file in args.include: importTemplates(included_file) if args.spawnpoints != '': importSpawnPoints(args.spawnpoints) kv = KeyValues() kv.load(sys.argv[1]) if 'Templates' in kv: for id in kv['Templates']: templates[id] = kv['Templates'][id] log.info('Loaded {0} templates.'.format(len(templates))) scanForInvalidTemplates(kv, args.input_file, ['WaveSchedule']) log.info('Finished scanning: {0} warnings, {1} errors.'.format( stats['warnings'], stats['errors'])) log.info('Used templates: {0}'.format(len(template_uses))) for key in sorted(template_uses.keys()): log.info('Template {0}: Used {1} times.'.format(key, template_uses[key])) #exportTemplates('PARSED_TEMPLATES.pop')