def handle(self, args): ''' Handles the command. ''' try: for dataset in args.datasets: raw_dir = DATA_DIR / dataset minified_dir = DATA_DIR / dataset / 'minified' logger.info('> Building %s dataset...', dataset) raw_dir.create(parents=True) minified_dir.create(parents=True) data = DatabaseFactory.fromYear(dataset).parse() with raw_dir: for raw_format in args.raw: data.export(raw_format, 'auto') with minified_dir: for minifiable_format in args.min: data.export(minifiable_format, 'auto', minify=True) except KeyboardInterrupt: logger.info('> Building was canceled.')
def handle(self, args): ''' Handles the command. ''' if not args.base: self._parser.error( 'You need to give the database year you want to export.') if not args.format: self._parser.error( 'You need to give the database format you want to export.') try: base = DatabaseFactory.fromYear(args.base) base.parse().export(args.format, args.filename, minify=args.minify) except KeyboardInterrupt: logger.info('> Exporting was canceled.')