Revert "[BE][Easy] enable postponed annotations in tools (#129375)"

This reverts commit 59eb2897f1745f513edb6c63065ffad481c4c8d0.

Reverted https://github.com/pytorch/pytorch/pull/129375 on behalf of https://github.com/huydhn due to Sorry for reverting your change but I need to revert to cleanly revert https://github.com/pytorch/pytorch/pull/129374, please do a rebase and reland this ([comment](https://github.com/pytorch/pytorch/pull/129375#issuecomment-2197800541))
This commit is contained in:
PyTorch MergeBot
2024-06-29 00:44:25 +00:00
parent 6063bb9d45
commit a32ce5ce34
123 changed files with 1052 additions and 1275 deletions

View File

@ -1,10 +1,9 @@
from __future__ import annotations
import argparse
import os
import re
import subprocess
from pathlib import Path
from typing import Optional, Union
from setuptools import distutils # type: ignore[import]
@ -13,7 +12,7 @@ UNKNOWN = "Unknown"
RELEASE_PATTERN = re.compile(r"/v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/")
def get_sha(pytorch_root: str | Path) -> str:
def get_sha(pytorch_root: Union[str, Path]) -> str:
try:
rev = None
if os.path.exists(os.path.join(pytorch_root, ".git")):
@ -31,7 +30,7 @@ def get_sha(pytorch_root: str | Path) -> str:
return UNKNOWN
def get_tag(pytorch_root: str | Path) -> str:
def get_tag(pytorch_root: Union[str, Path]) -> str:
try:
tag = subprocess.run(
["git", "describe", "--tags", "--exact"],
@ -47,8 +46,8 @@ def get_tag(pytorch_root: str | Path) -> str:
return UNKNOWN
def get_torch_version(sha: str | None = None) -> str:
pytorch_root = Path(__file__).absolute().parent.parent
def get_torch_version(sha: Optional[str] = None) -> str:
pytorch_root = Path(__file__).parent.parent
version = open(pytorch_root / "version.txt").read().strip()
if os.getenv("PYTORCH_BUILD_VERSION"):