Revert "[lint] upgrade mypy to latest version"

This reverts commit 9bf18aab94943f5352604a39340ad57ad4d0c5a4.

Reverted https://github.com/pytorch/pytorch/pull/76753 on behalf of https://github.com/suo
This commit is contained in:
PyTorch MergeBot
2022-05-03 20:01:18 +00:00
parent 4bb5944133
commit 3d7428d9ac
29 changed files with 61 additions and 70 deletions

View File

@ -537,8 +537,9 @@ class StmtBuilder(Builder):
raise UnsupportedNodeError(ctx, stmt, reason='without assigned value')
# Disallow type annotations on instance attributes outside of __init__
if type(stmt.target) == ast.Attribute and \
stmt.target.value.id == "self" and ctx.funcname != "__init__": # type: ignore[attr-defined]
if type(stmt.target) == ast.Attribute and\
stmt.target.value.id == "self" and\
ctx.funcname != "__init__":
start = stmt.col_offset
end = start + len(f"self.{stmt.target.attr}")
if hasattr(stmt.annotation, 'id'):