From 5f24bb24aba309a13cfe5b1afd6ef801b82d6102 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Wed, 25 Feb 2026 02:54:38 +0000 Subject: [PATCH] fix: replace 3 bare excepts with except Exception - parse_minicpm.py: tool parsing fallback - custom.py (2): server error handling --- .../rollout/mcp/mcpapi/tool_parser/parse_minicpm.py | 2 +- AgentCPM-Report/servers/custom/src/custom.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/AgentCPM-Explore/AgentRL/src/rollout/mcp/mcpapi/tool_parser/parse_minicpm.py b/AgentCPM-Explore/AgentRL/src/rollout/mcp/mcpapi/tool_parser/parse_minicpm.py index 48aa905..46f9796 100644 --- a/AgentCPM-Explore/AgentRL/src/rollout/mcp/mcpapi/tool_parser/parse_minicpm.py +++ b/AgentCPM-Explore/AgentRL/src/rollout/mcp/mcpapi/tool_parser/parse_minicpm.py @@ -127,7 +127,7 @@ def parse_tool_for_minicpm3( return tool_calls else: return [] - except: + except Exception: return [] if __name__ == "__main__": diff --git a/AgentCPM-Report/servers/custom/src/custom.py b/AgentCPM-Report/servers/custom/src/custom.py index ef2a6f8..d0f4ed9 100644 --- a/AgentCPM-Report/servers/custom/src/custom.py +++ b/AgentCPM-Report/servers/custom/src/custom.py @@ -249,7 +249,7 @@ def evisrag_output_extract_from_special(ans_ls: List[str]) -> Dict[str, List[str def extract(ans: str) -> str: try: content = ans.split('')[1].split('')[0].strip() - except: + except Exception: content = ans.strip() return content @@ -541,7 +541,7 @@ def _surveycpm_print_tasknote_hire(current_survey, last_detail=False): try: content = _surveycpm_abbr_one_line(current_survey["title"], abbr=False) string += f"# Title: {content}\n\n" - except: + except Exception: string += f"# Title: None\n\n" # sections @@ -706,7 +706,7 @@ def surveycpm_parse_response( hard_mode=hard_mode, # You can use hard mode for better performance **kwargs ) - except: + except Exception: action_is_valid = False action = {} else: @@ -811,7 +811,7 @@ def surveycpm_validate_action( section_node = surveycpm_get_position(current_survey, action["position"], tag="outline") if "subsections" in section_node: return False - except: + except Exception: return False for sec in action["subsections"]: @@ -848,7 +848,7 @@ def surveycpm_validate_action( assert action["content"].count("\\cite") <= 12 assert "\\cite" in action["content"] - except: + except Exception: return False return True @@ -1485,7 +1485,7 @@ def extract_num_from_textid(textid): try: if textid.startswith("textid"): return int(textid.split("textid")[-1].strip()) - except: + except Exception: return None return None def replace_bibkey(match): # \\cite{textid2, textid1} -> [1,2]