Enable import following in MYPYNOFOLLOW (now MYPYINDUCTOR) (#113830)

Skipping importing some packages for now to make this change more
tractable.

For some reason, lintrunner on CI raises errors in all imported `.pyi` files,
even though it doesn't on my local machine. The errors are all from missing
generic types, as the MYPYINDUCTOR config has `disallow_any_generics`
set. I have thus added `disable-error-code` comments to the relevant files,
though I fixed a few that were easy enough.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/113830
Approved by: https://github.com/Skylion007
ghstack dependencies: #113722, #113721
This commit is contained in:
Jez Ng
2023-11-16 12:28:24 -08:00
committed by PyTorch MergeBot
parent 0c8362de1a
commit 631fb33fd6
14 changed files with 43 additions and 22 deletions

View File

@ -86,11 +86,13 @@ if __name__ == "__main__":
version = tagged_version
with open(version_path, "w") as f:
f.write("from typing import Optional\n\n")
f.write("__all__ = ['__version__', 'debug', 'cuda', 'git_version', 'hip']\n")
f.write(f"__version__ = '{version}'\n")
# NB: This is not 100% accurate, because you could have built the
# library code with DEBUG, but csrc without DEBUG (in which case
# this would claim to be a release build when it's not.)
f.write(f"debug = {repr(bool(args.is_debug))}\n")
f.write(f"cuda = {repr(args.cuda_version)}\n")
f.write(f"cuda: Optional[str] = {repr(args.cuda_version)}\n")
f.write(f"git_version = {repr(sha)}\n")
f.write(f"hip = {repr(args.hip_version)}\n")
f.write(f"hip: Optional[str] = {repr(args.hip_version)}\n")