From cbcfe931566448ba8c9df5e150ceabd04f7efd51 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Tue, 24 Feb 2026 22:38:00 +0000 Subject: [PATCH] fix: replace bare except clauses with except Exception 4 bare except: in src/external_assets.py replaced to avoid catching SystemExit and KeyboardInterrupt. --- src/external_assets.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/external_assets.py b/src/external_assets.py index efafefd..08978e8 100644 --- a/src/external_assets.py +++ b/src/external_assets.py @@ -118,11 +118,11 @@ def _analyze_assets_needed(self, storyboard_data) -> List[str]: response = self.api_function(prompt, max_tokens=100)[0] try: content = response.candidates[0].content.parts[0].text - except: + except Exception: content = response.choices[0].message.content elements = [line.strip().lower() for line in content.strip().split("\n") if line.strip()] return list(dict.fromkeys(elements))[:4] - except: + except Exception: return [] def _check_cache(self, element: str) -> Optional[str]: @@ -162,7 +162,7 @@ def _download_iconfinder(self, element: str) -> Optional[str]: filepath = self.assets_dir / f"{element}.png" filepath.write_bytes(img_resp.content) return str(filepath.absolute()) - except: + except Exception: return None def _download_iconify(self, element: str) -> Optional[str]: @@ -178,7 +178,7 @@ def _download_iconify(self, element: str) -> Optional[str]: filepath = self.assets_dir / f"{element}.svg" filepath.write_text(svg_resp.text, encoding="utf-8") return str(filepath.absolute()) - except: + except Exception: return None def _enhance_animations(self, animations: List[str], assets: Dict[str, str]) -> List[str]: