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

Function load_file

core/context.py:64–82  ·  view source on GitHub ↗

Load a single file into memory.

(path)

Source from the content-addressed store, hash-verified

62 return False
63
64def load_file(path):
65 """Load a single file into memory."""
66 if is_ignored(path):
67 warning(f"Ignored: {path}")
68 return f"[ERROR] File is ignored by .codeyignore: {path}"
69
70 p = Path(path).expanduser()
71 if not p.exists():
72 p = Path(os.getcwd()) / path
73 if not p.exists():
74 warning(f"File not found: {path}")
75 return f"[ERROR] File not found: {path}"
76 try:
77 content = p.read_text(encoding="utf-8", errors="replace")
78 _mem.load_file(str(p), content)
79 success(f"Loaded: {p.name} ({len(content)} chars)")
80 return content
81 except Exception as e:
82 return f"[ERROR] {e}"
83
84def load_glob(pattern):
85 import glob

Callers 7

fix_fileFunction · 0.90
run_tdd_loopFunction · 0.90
test_default_ignoreMethod · 0.90
test_custom_ignoreMethod · 0.90
load_globFunction · 0.85
load_directoryFunction · 0.85
auto_load_from_promptFunction · 0.85

Calls 5

warningFunction · 0.90
successFunction · 0.90
is_ignoredFunction · 0.85
existsMethod · 0.80
load_fileMethod · 0.80

Tested by 2

test_default_ignoreMethod · 0.72
test_custom_ignoreMethod · 0.72