MCPcopy Index your code
hub / github.com/bpython/bpython / save

Method save

bpython/history.py:206–214  ·  view source on GitHub ↗
(self, filename: Path, encoding: str, lines: int = 0)

Source from the content-addressed store, hash-verified

204 return entries if len(entries) else [""]
205
206 def save(self, filename: Path, encoding: str, lines: int = 0) -> None:
207 fd = os.open(
208 filename,
209 os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
210 stat.S_IRUSR | stat.S_IWUSR,
211 )
212 with open(fd, "w", encoding=encoding, errors="ignore") as hfile:
213 with FileLock(hfile, filename=str(filename)):
214 self.save_to(hfile, self.entries, lines)
215
216 def save_to(
217 self, fd: TextIO, entries: list[str] | None = None, lines: int = 0

Callers 1

test_saveMethod · 0.95

Calls 2

save_toMethod · 0.95
FileLockFunction · 0.85

Tested by 1

test_saveMethod · 0.76