misc,python: Run pre-commit run --all-files

Applies the `pyupgrade` hook to all files in the repo.

Change-Id: I9879c634a65c5fcaa9567c63bc5977ff97d5d3bf
This commit is contained in:
Bobby R. Bruce
2023-10-09 13:40:03 -07:00
parent 83af4525ce
commit 298119e402
188 changed files with 741 additions and 779 deletions

View File

@@ -57,7 +57,7 @@ def _printErrorQuit(error_message):
--------------------------------------------------------------------------
"""
)
print(open(sys.argv[1], "r").read())
print(open(sys.argv[1]).read())
print(
"""
--------------------------------------------------------------------------
@@ -105,7 +105,7 @@ def _validateTags(commit_header):
tags = "".join(commit_header.split(":")[0].split()).split(",")
if any(tag not in valid_tags for tag in tags):
invalid_tag = next((tag for tag in tags if tag not in valid_tags))
invalid_tag = next(tag for tag in tags if tag not in valid_tags)
_printErrorQuit("Invalid Gem5 tag: " + invalid_tag)
@@ -120,7 +120,7 @@ commit_message = open(sys.argv[1]).read()
commit_message_lines = commit_message.splitlines()
commit_header = commit_message_lines[0]
commit_header_match = re.search(
"^(fixup! )?(\S[\w\-][,\s*[\w\-]+]*:.+\S$)", commit_header
r"^(fixup! )?(\S[\w\-][,\s*[\w\-]+]*:.+\S$)", commit_header
)
if commit_header_match is None:
_printErrorQuit("Invalid commit header")