Update mypy to 1.4.1 (#91983)

Mostly fixes for PEP-484 violation (i.e. when default arg is set to None, but type is not annotated as optional)
Plus few real fixes:
  - Add missing `_get_upgraders_entry_map` to `torch/_C/__init__.pyi`
  - Add missing return statement to `torch._export. deserialize_graph`
  - Fix error message in `torch.ao.ns.fx.weight_utils.get_lstm_mod_weights`
  -
TODO (in followup PR):
  - Fix erroneous `isinstance` check in `torch/ao/quantization/_pt2e/qat_utils.py`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91983
Approved by: https://github.com/kit1980, https://github.com/ZainRizvi, https://github.com/huydhn, https://github.com/thiagocrepaldi, https://github.com/aaronenyeshi
This commit is contained in:
Nikita Shulga
2023-07-13 16:30:33 +00:00
committed by PyTorch MergeBot
parent f73757d551
commit 634659e262
69 changed files with 177 additions and 171 deletions

View File

@ -1,11 +1,11 @@
#!/usr/bin/env python3
import time
from package.oss.cov_json import get_json_report
from package.oss.init import initialization
from package.tool.summarize_jsons import summarize_jsons
from package.util.setting import TestPlatform
from package.util.utils import print_time
from package.oss.cov_json import get_json_report # type: ignore[import]
from package.oss.init import initialization # type: ignore[import]
from package.tool.summarize_jsons import summarize_jsons # type: ignore[import]
from package.util.setting import TestPlatform # type: ignore[import]
from package.util.utils import print_time # type: ignore[import]
def report_coverage() -> None:

View File

@ -45,7 +45,7 @@ def transform_file_name(
return file_path[file_path.find(folder) :]
# remove pytorch base folder path
if platform == TestPlatform.OSS:
from package.oss.utils import get_pytorch_folder
from package.oss.utils import get_pytorch_folder # type: ignore[import]
pytorch_foler = get_pytorch_folder()
assert file_path.startswith(pytorch_foler)

View File

@ -89,7 +89,9 @@ def get_raw_profiles_folder() -> str:
def detect_compiler_type(platform: TestPlatform) -> CompilerType:
if platform == TestPlatform.OSS:
from package.oss.utils import detect_compiler_type # type: ignore[misc]
from package.oss.utils import ( # type: ignore[assignment, import, misc]
detect_compiler_type,
)
cov_type = detect_compiler_type() # type: ignore[call-arg]
else:
@ -100,7 +102,7 @@ def detect_compiler_type(platform: TestPlatform) -> CompilerType:
cov_type = detect_compiler_type()
check_compiler_type(cov_type)
return cov_type
return cov_type # type: ignore[no-any-return]
def get_test_name_from_whole_path(path: str) -> str: