[BE]: Update mypy to 1.10.0 (#127717)

Updates mypy to the latest and greatest.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127717
Approved by: https://github.com/ezyang
This commit is contained in:
Aaron Gokaslan
2024-06-13 15:57:10 +00:00
committed by PyTorch MergeBot
parent 49366b2640
commit 93a14aba6e
6 changed files with 11 additions and 7 deletions

View File

@ -85,10 +85,10 @@ librosa>=0.6.2 ; python_version < "3.11"
#Pinned versions:
#test that import:
mypy==1.9.0
mypy==1.10.0
# Pin MyPy version because new errors are likely to appear with each release
#Description: linter
#Pinned versions: 1.9.0
#Pinned versions: 1.10.0
#test that import: test_typing.py, test_type_hints.py
networkx==2.8.8

View File

@ -136,7 +136,7 @@ init_command = [
'numpy==1.24.3 ; python_version == "3.8"',
'numpy==1.26.0 ; python_version >= "3.9"',
'expecttest==0.1.6',
'mypy==1.9.0',
'mypy==1.10.0',
'sympy==1.11.1',
'types-requests==2.27.25',
'types-PyYAML==6.0.7',

View File

@ -45,7 +45,7 @@ class DefaultFuseHandler(FuseHandler):
def __init__(
self,
node: Node):
super().__init__(node)
super().__init__(node) # type:ignore[safe-super]
def fuse(self,
load_arg: Callable,

View File

@ -345,4 +345,8 @@ def register_fsdp_forward_method(module: nn.Module, method_name: str) -> None:
return fsdp_state._post_forward(self, args, out)
# Use `__get__` to make `wrapped_method` an instance method
setattr(module, method_name, wrapped_method.__get__(module, type(module)))
setattr(
module,
method_name,
wrapped_method.__get__(module, type(module)), # type:ignore[attr-defined]
)

View File

@ -139,7 +139,7 @@ class lazy_property:
def __init__(self, wrapped):
self.wrapped = wrapped
update_wrapper(self, wrapped)
update_wrapper(self, wrapped) # type:ignore[arg-type]
def __get__(self, instance, obj_type=None):
if instance is None:

View File

@ -61,7 +61,7 @@ class AST_Rewriter(ast.NodeTransformer):
closure=f.__closure__,
)
g = functools.update_wrapper(g, f)
g.__kwdefaults__ = copy.copy(f.__kwdefaults__)
g.__kwdefaults__ = copy.copy(f.__kwdefaults__) # type:ignore[attr-defined]
return g
# Return the correct FunctionType object
return change_func_globals(fn_compiled, globals=fn.__globals__)