From 16ed5ececda124023ec2052a423d6ec47e935b05 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Thu, 25 Dec 2025 19:31:00 +0000 Subject: [PATCH] [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. --- .ci/generate_test_report_lib.py | 6 ++---- .ci/premerge_advisor_explain.py | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.ci/generate_test_report_lib.py b/.ci/generate_test_report_lib.py index 5b16599cc743..ed86ab88e66d 100644 --- a/.ci/generate_test_report_lib.py +++ b/.ci/generate_test_report_lib.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception """Library to parse JUnit XML files and return a markdown report.""" -from typing import TypedDict, Optional +from typing import TypedDict import platform 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 # 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): name: str explained: bool - reason: Optional[str] + reason: str | None SEE_BUILD_FILE_STR = "Download the build's log file to see the details." diff --git a/.ci/premerge_advisor_explain.py b/.ci/premerge_advisor_explain.py index 4a3900021ede..6046905284cc 100644 --- a/.ci/premerge_advisor_explain.py +++ b/.ci/premerge_advisor_explain.py @@ -8,10 +8,6 @@ import platform import sys import json -# TODO(boomanaiden154): Remove the optional call once we can require Python -# 3.10. -from typing import Optional - import requests import github import github.PullRequest @@ -24,7 +20,7 @@ PREMERGE_ADVISOR_URL = ( COMMENT_TAG = "" -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) for comment in pr.as_issue().get_comments(): if platform_comment_tag in comment.body: