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

Method learn_from_file

core/preferences.py:305–326  ·  view source on GitHub ↗

Learn preferences from a file. Args: path: File path (used to determine file type) content: File content to analyze Returns: Dictionary of detected preferences

(self, path: str, content: str)

Source from the content-addressed store, hash-verified

303 warning(f"Failed to save preferences: {e}")
304
305 def learn_from_file(self, path: str, content: str) -> Dict[str, str]:
306 """
307 Learn preferences from a file.
308
309 Args:
310 path: File path (used to determine file type)
311 content: File content to analyze
312
313 Returns:
314 Dictionary of detected preferences
315 """
316 if not path.endswith(".py"):
317 return {}
318
319 detected = PreferenceDetector.detect_all_preferences(content)
320
321 # Update preferences with detected values
322 for key, value in detected.items():
323 if value:
324 self._update_preference(key, value, confidence=0.3)
325
326 return detected
327
328 def learn_from_files(self, files: List[tuple]) -> Dict[str, List[str]]:
329 """

Callers 3

learn_from_filesMethod · 0.95
test_learn_from_fileMethod · 0.95

Calls 2

_update_preferenceMethod · 0.95

Tested by 2

test_learn_from_fileMethod · 0.76