refactor: sanity check & minor optimization
This commit is contained in:
		
							parent
							
								
									34ce4b0e13
								
							
						
					
					
						commit
						3751eb84a6
					
				|  | @ -67,7 +67,7 @@ def get_executor_with( | ||||||
|     task_stage: task.Stage, cached: Dict[str, None] |     task_stage: task.Stage, cached: Dict[str, None] | ||||||
| ) -> result.ExecutorWith: | ) -> result.ExecutorWith: | ||||||
|     file_import = task_stage.files.import_ |     file_import = task_stage.files.import_ | ||||||
|     copy_in_files = [file for file in file_import if file not in cached] |     copy_in_files = (file for file in file_import if file not in cached) | ||||||
|     file_export = task_stage.files.export |     file_export = task_stage.files.export | ||||||
|     copy_out_files = ["stdout", "stderr"] |     copy_out_files = ["stdout", "stderr"] | ||||||
|     executor_with_config = result.ExecutorWith( |     executor_with_config = result.ExecutorWith( | ||||||
|  | @ -102,6 +102,8 @@ def get_executor_with( | ||||||
| def fix_keyword( | def fix_keyword( | ||||||
|     keyword_config: task.ParserKeyword, keyword_parser: result.Parser |     keyword_config: task.ParserKeyword, keyword_parser: result.Parser | ||||||
| ) -> None: | ) -> None: | ||||||
|  |     if len(keyword_config.keyword) != len(keyword_config.weight): | ||||||
|  |         raise ValueError("Keywords and weights must have the same length") | ||||||
|     score_groups: Dict[int, List[str]] = {} |     score_groups: Dict[int, List[str]] = {} | ||||||
|     for keyword, score in zip(keyword_config.keyword, keyword_config.weight): |     for keyword, score in zip(keyword_config.keyword, keyword_config.weight): | ||||||
|         score_groups.setdefault(score, []).append(keyword) |         score_groups.setdefault(score, []).append(keyword) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user