PEP585: .github (#145707)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/145707
Approved by: https://github.com/huydhn
This commit is contained in:
Aaron Orenstein
2025-01-26 11:50:47 -08:00
committed by PyTorch MergeBot
parent bfaf76bfc6
commit 60f98262f1
22 changed files with 265 additions and 280 deletions

View File

@ -1,6 +1,7 @@
import os
import re
from typing import List, Optional, Pattern, Tuple
from re import Pattern
from typing import Optional
BOT_COMMANDS_WIKI = "https://github.com/pytorch/pytorch/wiki/Bot-commands"
@ -13,13 +14,13 @@ CONTACT_US = f"Questions? Feedback? Please reach out to the [PyTorch DevX Team](
ALTERNATIVES = f"Learn more about merging in the [wiki]({BOT_COMMANDS_WIKI})."
def has_label(labels: List[str], pattern: Pattern[str] = CIFLOW_LABEL) -> bool:
def has_label(labels: list[str], pattern: Pattern[str] = CIFLOW_LABEL) -> bool:
return len(list(filter(pattern.match, labels))) > 0
class TryMergeExplainer:
force: bool
labels: List[str]
labels: list[str]
pr_num: int
org: str
project: str
@ -31,7 +32,7 @@ class TryMergeExplainer:
def __init__(
self,
force: bool,
labels: List[str],
labels: list[str],
pr_num: int,
org: str,
project: str,
@ -47,7 +48,7 @@ class TryMergeExplainer:
def _get_flag_msg(
self,
ignore_current_checks: Optional[
List[Tuple[str, Optional[str], Optional[int]]]
list[tuple[str, Optional[str], Optional[int]]]
] = None,
) -> str:
if self.force:
@ -68,7 +69,7 @@ class TryMergeExplainer:
def get_merge_message(
self,
ignore_current_checks: Optional[
List[Tuple[str, Optional[str], Optional[int]]]
list[tuple[str, Optional[str], Optional[int]]]
] = None,
) -> str:
title = "### Merge started"