MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / detect_preferred_library

Method detect_preferred_library

core/preferences.py:188–195  ·  view source on GitHub ↗

Generic detector for preferred library from a map.

(cls, content: str, lib_map: Dict, category: str)

Source from the content-addressed store, hash-verified

186
187 @classmethod
188 def detect_preferred_library(cls, content: str, lib_map: Dict, category: str) -> Optional[str]:
189 """Generic detector for preferred library from a map."""
190 scores = defaultdict(int)
191 for lib, patterns in lib_map.items():
192 for p in patterns:
193 if re.search(p, content, re.MULTILINE):
194 scores[lib] += 1
195 return max(scores, key=scores.get) if scores else None
196
197 @classmethod
198 def detect_log_style(cls, content: str) -> Optional[str]:

Callers 1

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected