From 9be013360e7842abfd206aeb96a997f186ba1f5d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 31 May 2026 09:00:30 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20string=20splitti?= =?UTF-8?q?ng=20and=20list=20comprehensions=20in=20helpers/skills.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com> --- .jules/bolt.md | 3 +++ helpers/skills.py | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .jules/bolt.md diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000000..ab422b9254 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2025-06-03 - Nested MagicMock Requires Full Paths +**Learning:** When testing scripts in isolation and mocking missing dependencies with `sys.modules['module'] = MagicMock()`, if the codebase imports from deeply nested submodules (like `litellm.types.utils`), mocking just the top-level `litellm` package is insufficient and raises a `ModuleNotFoundError: No module named 'litellm.types'; 'litellm' is not a package` error. +**Action:** When creating scratchpad tests that use `sys.modules` mocks, ensure you mock every part of the nested import path required by the test environment. diff --git a/helpers/skills.py b/helpers/skills.py index 1112d2973f..12fad2b3e0 100644 --- a/helpers/skills.py +++ b/helpers/skills.py @@ -125,17 +125,17 @@ def _coerce_list(value: Any) -> List[str]: if value is None: return [] if isinstance(value, list): - return [str(v).strip() for v in value if str(v).strip()] + return [stripped for v in value if (stripped := str(v).strip())] if isinstance(value, tuple): - return [str(v).strip() for v in list(value) if str(v).strip()] + return [stripped for v in value if (stripped := str(v).strip())] if isinstance(value, str): # Support comma-separated or space-delimited strings if "," in value: parts = [p.strip() for p in value.split(",")] + return [p for p in parts if p] else: - parts = [p.strip() for p in re.split(r"\s+", value)] - return [p for p in parts if p] - return [str(value).strip()] if str(value).strip() else [] + return value.split() + return [stripped] if (stripped := str(value).strip()) else [] def _normalize_name(name: str) -> str: @@ -475,7 +475,7 @@ def search_skills( if not q: return [] - raw_terms = [t for t in re.split(r"\s+", q) if t] + raw_terms = q.split() terms = [ t for t in raw_terms if len(t) >= 3 or any(ch.isdigit() for ch in t)