fix: avoid races in filesystem ops (#2287)
Use `exist_ok` and `missing_ok` in pathlib operations where we can.
This commit is contained in:
@@ -42,8 +42,7 @@ def main() -> None:
|
||||
)
|
||||
|
||||
dest_path = Path("docs/data/how-it-works.png")
|
||||
if dest_path.exists():
|
||||
dest_path.unlink()
|
||||
dest_path.unlink(missing_ok=True)
|
||||
|
||||
Path(screenshot).rename(dest_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user