(self)
| 314 | logger.warning("Failed to create backup: %s", e) |
| 315 | |
| 316 | def _generate_content(self) -> str: |
| 317 | lines: List[str] = [] |
| 318 | for opt in self.config.global_options: |
| 319 | lines.append(str(opt)) |
| 320 | if self.config.global_options and (not lines or lines[-1] != ""): |
| 321 | lines.append("") |
| 322 | for host in self.config.hosts: |
| 323 | lines.append(f"Host {' '.join(host.patterns)}") |
| 324 | for opt in host.options: |
| 325 | lines.append(str(opt)) |
| 326 | lines.append("") |
| 327 | while lines and lines[-1] == "": |
| 328 | lines.pop() |
| 329 | for inc in self.config.include_directives: |
| 330 | lines.append(f"Include {inc}") |
| 331 | return "\n".join(lines) + "\n" |
| 332 | |
| 333 | def _atomic_write(self, content: str) -> None: |
| 334 | tmp = tempfile.NamedTemporaryFile( |
no outgoing calls
no test coverage detected