[BE][Easy] enable postponed annotations in torchgen (#129376)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/129376
Approved by: https://github.com/ezyang
ghstack dependencies: #129375
This commit is contained in:
Xuehai Pan
2024-06-28 16:28:16 +08:00
committed by PyTorch MergeBot
parent 59eb2897f1
commit 494057d6d4
45 changed files with 977 additions and 901 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import importlib.util
import os
import sys
from importlib.util import module_from_spec, spec_from_file_location
from itertools import chain
from pathlib import Path
@ -18,9 +18,9 @@ you are in the root directory of the Pytorch git repo"""
if not file_path.exists():
raise Exception(err_msg) # noqa: TRY002
spec = importlib.util.spec_from_file_location(module_name, file_path)
spec = spec_from_file_location(module_name, file_path)
assert spec is not None
module = importlib.util.module_from_spec(spec)
module = module_from_spec(spec)
sys.modules[module_name] = module
assert spec.loader is not None
assert module is not None