def _create_dataset(self, module_path, dataset_arguments): import_stmt = create_import_for_camel_case_class( module_path, 'ImportedDataset') exec(import_stmt) dataset = ImportedDataset(in_storage=self._storage, **dataset_arguments) return dataset
if not ok_button: sys.exit(1) ### TODO: We depend on subpackages (like string) that die if you use unicode. ### A lot of places in the code, too, use isinstance(x, str) and ignore ### the unicode case. cache_dir = str(args.filesystem_path_to_baseyear_cache) classpath = str(args.opus_classpath_of_configuration) output_dir_container = str(args.output_directory) output_dir = os.path.join(output_dir_container, strftime('%Y_%m_%d_%H_%M', localtime())) years_to_run = args.number_of_years_to_run exec( create_import_for_camel_case_class(classpath, import_as='ImportedConfiguration')) config = ImportedConfiguration() base_year = config['base_year'] config['creating_baseyear_cache_configuration'].cache_from_database = False config[ 'creating_baseyear_cache_configuration'].baseyear_cache.existing_cache_to_copy = cache_dir config['cache_directory'] = output_dir config['years'] = (base_year + 1, base_year + years_to_run) if not len(range(config['years'][0], config['years'][1] + 1)) > 0: display_message_dialog('No years to simulate!') sys.exit(1)
def _create_dataset(self, module_path, dataset_arguments): import_stmt = create_import_for_camel_case_class(module_path, 'ImportedDataset') exec(import_stmt) dataset = ImportedDataset(in_storage=self._storage, **dataset_arguments) return dataset
ok_button = args.configure_traits() if not ok_button: sys.exit(1) ### TODO: We depend on subpackages (like string) that die if you use unicode. ### A lot of places in the code, too, use isinstance(x, str) and ignore ### the unicode case. cache_dir = str(args.filesystem_path_to_baseyear_cache) classpath = str(args.opus_classpath_of_configuration) output_dir_container = str(args.output_directory) output_dir = os.path.join(output_dir_container, strftime('%Y_%m_%d_%H_%M',localtime())) years_to_run = args.number_of_years_to_run exec(create_import_for_camel_case_class(classpath, import_as='ImportedConfiguration')) config = ImportedConfiguration() base_year = config['base_year'] config['creating_baseyear_cache_configuration'].cache_from_database = False config['creating_baseyear_cache_configuration'].baseyear_cache.existing_cache_to_copy = cache_dir config['cache_directory'] = output_dir config['years'] = (base_year+1, base_year+years_to_run) if not len(range(config['years'][0], config['years'][1]+1)) > 0: display_message_dialog('No years to simulate!') sys.exit(1) # sanity check on the cache directory -- make sure it includes a subdirectory whose name is the base year