[CI] Finish Python Version TODOs

There were a couple TODOs in .ci related to Python typing changes after
v3.10. Now that Windows is python version matched to Linux at Python
3.12, we do not need to keep using the old syntax.
This commit is contained in:
Aiden Grossman
2025-12-25 19:31:00 +00:00
parent 88039f85c0
commit 16ed5ececd
2 changed files with 3 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Library to parse JUnit XML files and return a markdown report.""" """Library to parse JUnit XML files and return a markdown report."""
from typing import TypedDict, Optional from typing import TypedDict
import platform import platform
from junitparser import JUnitXml, Failure from junitparser import JUnitXml, Failure
@@ -11,12 +11,10 @@ from junitparser import JUnitXml, Failure
# This data structure should match the definition in llvm-zorg in # This data structure should match the definition in llvm-zorg in
# premerge/advisor/advisor_lib.py # premerge/advisor/advisor_lib.py
# TODO(boomanaiden154): Drop the Optional here and switch to str | None when
# we require Python 3.10.
class FailureExplanation(TypedDict): class FailureExplanation(TypedDict):
name: str name: str
explained: bool explained: bool
reason: Optional[str] reason: str | None
SEE_BUILD_FILE_STR = "Download the build's log file to see the details." SEE_BUILD_FILE_STR = "Download the build's log file to see the details."

View File

@@ -8,10 +8,6 @@ import platform
import sys import sys
import json import json
# TODO(boomanaiden154): Remove the optional call once we can require Python
# 3.10.
from typing import Optional
import requests import requests
import github import github
import github.PullRequest import github.PullRequest
@@ -24,7 +20,7 @@ PREMERGE_ADVISOR_URL = (
COMMENT_TAG = "<!--PREMERGE ADVISOR COMMENT: {platform}-->" COMMENT_TAG = "<!--PREMERGE ADVISOR COMMENT: {platform}-->"
def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> Optional[int]: def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> int | None:
platform_comment_tag = COMMENT_TAG.format(platform=platform) platform_comment_tag = COMMENT_TAG.format(platform=platform)
for comment in pr.as_issue().get_comments(): for comment in pr.as_issue().get_comments():
if platform_comment_tag in comment.body: if platform_comment_tag in comment.body: