Skip to content

Commit

Permalink
Path.unlink's missing_ok has been added in 3.8 only.
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPalard committed Apr 11, 2022
1 parent 4ebb006 commit de9fe42
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""

from argparse import ArgumentParser
from contextlib import suppress
import filecmp
from itertools import product
import json
Expand Down Expand Up @@ -421,7 +422,8 @@ def edit(file: Path):
o.write(line.replace("localhoat", "localhost"))
"""
temporary = file.with_name(file.name + ".tmp")
temporary.unlink(missing_ok=True)
with suppress(FileNotFoundError):
temporary.unlink()
with open(file, encoding="UTF-8") as input_file:
with open(temporary, "w", encoding="UTF-8") as output_file:
yield input_file, output_file
Expand Down

0 comments on commit de9fe42

Please sign in to comment.