예제 #1
0
def main(options):
	f = Factory()

	set_logger(options)
	options['output_dir']=create_output_dir(options['output_dir'])

	modules = f.load_modules(options['packages'], options['output_dir'])
	
	for m in modules:
		classes = f.load_classes(m, options['OS'], options['release'])
		for cl in classes:
			instance = cl(options)
			if 'dump' in str(cl):
				for m in options['dump'].split(','):
					try:
						if options['output_type'] in EXTRACT_DUMP[m]:
							getattr(instance, EXTRACT_DUMP[m])()
					except Exception:
						options['logger'].error(traceback.format_exc())
				continue
			for name, method in inspect.getmembers(cl, predicate=inspect.ismethod):
				if not name.startswith('_'):
					try:
						if options['output_type'] in name:
							getattr(instance, name)()
					except Exception:
						options['logger'].error(traceback.format_exc())
예제 #2
0
파일: main.py 프로젝트: vtarasovaaa/factory
from view import draw
from factory.game import Game
from factory.factory import Factory


if __name__ == "__main__":
    game = Game([
        Factory(),
        Factory(100),
        Factory(200),
        Factory(300),
        Factory(400)
    ], 5)

    draw(game)