refactor: sanity check & minor optimization
Some checks failed
build / build (push) Has been cancelled
build / build (pull_request) Successful in 2m30s

This commit is contained in:
张泊明518370910136 2025-03-05 02:48:08 -05:00
parent 34ce4b0e13
commit 3751eb84a6
GPG Key ID: D47306D7062CDA9D

View File

@ -67,7 +67,7 @@ def get_executor_with(
task_stage: task.Stage, cached: Dict[str, None]
) -> result.ExecutorWith:
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
copy_out_files = ["stdout", "stderr"]
executor_with_config = result.ExecutorWith(
@ -102,6 +102,8 @@ def get_executor_with(
def fix_keyword(
keyword_config: task.ParserKeyword, keyword_parser: result.Parser
) -> 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]] = {}
for keyword, score in zip(keyword_config.keyword, keyword_config.weight):
score_groups.setdefault(score, []).append(keyword)