MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / _read

Function _read

scripts/test-impact/coverage_live_v2.py:89–107  ·  view source on GitHub ↗
(path, limit)

Source from the content-addressed store, hash-verified

87
88
89def _read(path, limit):
90 fd = _regular(path)
91 try:
92 before = os.fstat(fd)
93 if before.st_size > limit:
94 _error("resource_limit", "file byte limit exceeded")
95 data = bytearray()
96 while True:
97 part = os.read(fd, min(65536, limit + 1 - len(data)))
98 if not part:
99 break
100 data.extend(part)
101 if len(data) > limit:
102 _error("resource_limit", "file byte limit exceeded")
103 if _signature(before) != _signature(os.fstat(fd)):
104 _error("identity", "input changed during capture")
105 return bytes(data)
106 finally:
107 os.close(fd)
108
109
110def _identity(path):

Callers 4

_registryFunction · 0.85
publishMethod · 0.85
_convertFunction · 0.85
sp_stdin_probeFunction · 0.85

Calls 6

_regularFunction · 0.85
_errorFunction · 0.85
_signatureFunction · 0.85
bytesFunction · 0.85
readMethod · 0.45
closeMethod · 0.45

Tested by 1

sp_stdin_probeFunction · 0.68