(self, filename: Path, encoding: str, lines: int = 0)
| 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 |