contrib: Fix clang-format-diff.py lint errors

We assume to be using python3, so don't check for it. This removes a
type error on the line `from io import BytesIO as StringIO`.

Specify the encoding as "utf8" when opening a file.
This commit is contained in:
TheCharlatan 2024-01-17 11:08:11 +01:00
parent 008e81e025
commit 52149b7a2c
No known key found for this signature in database
GPG Key ID: 9B79B45691DB4173

View File

@ -29,10 +29,7 @@ import re
import subprocess
import sys
if sys.version_info.major >= 3:
from io import StringIO
else:
from io import BytesIO as StringIO
from io import StringIO
def main():
@ -172,7 +169,7 @@ def main():
sys.exit(p.returncode)
if not args.i:
with open(filename) as f:
with open(filename, encoding="utf8") as f:
code = f.readlines()
formatted_code = StringIO(stdout).readlines()
diff = difflib.unified_diff(