style: some rename & more robust code
This commit is contained in:
		
							parent
							
								
									6cd0cd5509
								
							
						
					
					
						commit
						dfe836109c
					
				|  | @ -33,7 +33,9 @@ def get_conf_stage( | |||
|             fn, parser_model = processed_dict[parser] | ||||
|             fn(parser_model, conf_stage.parsers[idx]) | ||||
|         elif parser == "diff": | ||||
|             fix_diff(task_stage, task_conf, conf_stage.parsers[idx], conf_stage) | ||||
|             fix_diff( | ||||
|                 task_stage, task_conf, conf_stage.parsers[idx], conf_stage.executor | ||||
|             ) | ||||
|         else: | ||||
|             continue | ||||
|     return conf_stage | ||||
|  | @ -88,7 +90,7 @@ def get_executor_with( | |||
| 
 | ||||
| 
 | ||||
| def fix_keyword( | ||||
|     keyword_config: task.ParserKeyword, keyword_parser_: result.Parser | ||||
|     keyword_config: task.ParserKeyword, keyword_parser: result.Parser | ||||
| ) -> None: | ||||
|     keyword_weight: List[result.KeywordConfig] = [] | ||||
|     unique_weight = list(set(keyword_config.weight)) | ||||
|  | @ -102,7 +104,7 @@ def fix_keyword( | |||
|             else: | ||||
|                 continue | ||||
| 
 | ||||
|     keyword_parser_.with_.update( | ||||
|     keyword_parser.with_.update( | ||||
|         result.KeywordMatchConfig( | ||||
|             matches=keyword_weight, | ||||
|         ).model_dump(by_alias=True) | ||||
|  | @ -134,8 +136,6 @@ def fix_dummy( | |||
|     dummy_parser_config: task.ParserDummy, dummy_parser: result.Parser | ||||
| ) -> None: | ||||
|     # we don't use dummy parser in real application | ||||
|     if dummy_parser_config is None: | ||||
|         return | ||||
|     dummy_parser.with_.update( | ||||
|         result.DummyConfig( | ||||
|             score=dummy_parser_config.score, | ||||
|  | @ -156,9 +156,8 @@ def fix_diff( | |||
|     task_stage: task.Stage, | ||||
|     task_conf: task.Config, | ||||
|     diff_parser_config: result.Parser, | ||||
|     conf_stage: result.StageDetail, | ||||
|     diff_executor: result.Executor, | ||||
| ) -> None: | ||||
|     diff_parser = diff_parser_config | ||||
|     skip = task_stage.skip | ||||
|     cases = task_stage.cases | ||||
|     finalized_cases = [case for case in cases if case not in skip] | ||||
|  | @ -215,10 +214,9 @@ def fix_diff( | |||
|                 ) | ||||
|             ) | ||||
| 
 | ||||
|     if diff_parser: | ||||
|         diff_parser.with_.update( | ||||
|     diff_parser_config.with_.update( | ||||
|         result.DiffConfig(name="diff", cases=parser_cases).model_dump(by_alias=True) | ||||
|     ) | ||||
|         conf_stage.executor.with_.cases = stage_cases | ||||
|     diff_executor.with_.cases = stage_cases | ||||
| 
 | ||||
|     return | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user