[core] Enable ruff PTH (flake8-use-pathlib) lint family (#16661)

This commit is contained in:
J. Nick Koston
2026-05-26 05:14:42 +00:00
committed by GitHub
parent ae814cff5c
commit ae74920b81
54 changed files with 162 additions and 155 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
from pathlib import Path
import re
# pylint: disable=import-error
@@ -34,10 +35,10 @@ DOMAINS = {
def sub(path, pattern, repl):
with open(path, encoding="utf-8") as handle:
with Path(path).open(encoding="utf-8") as handle:
content = handle.read()
content = re.sub(pattern, repl, content, flags=re.MULTILINE)
with open(path, "w", encoding="utf-8") as handle:
with Path(path).open("w", encoding="utf-8") as handle:
handle.write(content)