|
51 | 51 | from __future__ import annotations |
52 | 52 |
|
53 | 53 | from contextlib import contextmanager |
54 | | -from typing import Any, Callable, Iterable, Iterator, List, Optional, Set, TypeVar, cast |
| 54 | +from typing import Any, Callable, Iterable, Iterator, List, TypeVar, cast |
55 | 55 | from typing_extensions import Final, TypeAlias as _TypeAlias |
56 | 56 |
|
57 | 57 | from mypy import errorcodes as codes, message_registry |
@@ -1215,8 +1215,9 @@ def analyze_function_body(self, defn: FuncItem) -> None: |
1215 | 1215 | self.function_stack.pop() |
1216 | 1216 |
|
1217 | 1217 | def check_classvar_in_signature(self, typ: ProperType) -> None: |
| 1218 | + t: ProperType |
1218 | 1219 | if isinstance(typ, Overloaded): |
1219 | | - for t in typ.items: # type: ProperType |
| 1220 | + for t in typ.items: |
1220 | 1221 | self.check_classvar_in_signature(t) |
1221 | 1222 | return |
1222 | 1223 | if not isinstance(typ, CallableType): |
@@ -1463,7 +1464,8 @@ def analyze_namedtuple_classdef( |
1463 | 1464 | ): |
1464 | 1465 | # Don't reprocess everything. We just need to process methods defined |
1465 | 1466 | # in the named tuple class body. |
1466 | | - is_named_tuple, info = True, defn.info # type: bool, Optional[TypeInfo] |
| 1467 | + is_named_tuple = True |
| 1468 | + info: TypeInfo | None = defn.info |
1467 | 1469 | else: |
1468 | 1470 | is_named_tuple, info = self.named_tuple_analyzer.analyze_namedtuple_classdef( |
1469 | 1471 | defn, self.is_stub_file, self.is_func_scope() |
@@ -3149,11 +3151,9 @@ def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool: |
3149 | 3151 | res: Type | None = None |
3150 | 3152 | if self.is_none_alias(rvalue): |
3151 | 3153 | res = NoneType() |
3152 | | - alias_tvars, depends_on, qualified_tvars = ( |
3153 | | - [], |
3154 | | - set(), |
3155 | | - [], |
3156 | | - ) # type: List[str], Set[str], List[str] |
| 3154 | + alias_tvars: list[str] = [] |
| 3155 | + depends_on: set[str] = set() |
| 3156 | + qualified_tvars: list[str] = [] |
3157 | 3157 | else: |
3158 | 3158 | tag = self.track_incomplete_refs() |
3159 | 3159 | res, alias_tvars, depends_on, qualified_tvars = self.analyze_alias( |
|
0 commit comments