|
4 | 4 | from abc import abstractmethod |
5 | 5 | from collections import OrderedDict, defaultdict |
6 | 6 | from typing import ( |
7 | | - Any, TypeVar, List, Tuple, cast, Set, Dict, Union, Optional, Callable, Sequence |
| 7 | + Any, TypeVar, List, Tuple, cast, Set, Dict, Union, Optional, Callable, Sequence, |
8 | 8 | ) |
9 | 9 |
|
10 | 10 | MYPY = False |
11 | 11 | if MYPY: |
12 | | - from typing import DefaultDict |
| 12 | + from typing import DefaultDict, ClassVar |
13 | 13 |
|
14 | 14 | import mypy.strconv |
15 | 15 | from mypy.util import short_type |
@@ -48,7 +48,7 @@ def get_column(self) -> int: |
48 | 48 | return self.column |
49 | 49 |
|
50 | 50 |
|
51 | | -if False: |
| 51 | +if MYPY: |
52 | 52 | # break import cycle only needed for mypy |
53 | 53 | import mypy.types |
54 | 54 |
|
@@ -630,11 +630,10 @@ def deserialize(cls, data: JsonDict) -> 'FuncDef': |
630 | 630 | # NOTE: ret.info is set in the fixup phase. |
631 | 631 | ret.arg_names = data['arg_names'] |
632 | 632 | ret.arg_kinds = data['arg_kinds'] |
633 | | - # Mark these as 'None' so that future uses will trigger an error |
634 | | - _dummy = None # type: Any |
635 | | - ret.arguments = _dummy |
636 | | - ret.max_pos = _dummy |
637 | | - ret.min_args = _dummy |
| 633 | + # Leave these uninitialized so that future uses will trigger an error |
| 634 | + del ret.arguments |
| 635 | + del ret.max_pos |
| 636 | + del ret.min_args |
638 | 637 | return ret |
639 | 638 |
|
640 | 639 |
|
@@ -1243,8 +1242,6 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T: |
1243 | 1242 | class ComplexExpr(Expression): |
1244 | 1243 | """Complex literal""" |
1245 | 1244 |
|
1246 | | - value = 0.0j |
1247 | | - |
1248 | 1245 | def __init__(self, value: complex) -> None: |
1249 | 1246 | super().__init__() |
1250 | 1247 | self.value = value |
@@ -2166,7 +2163,7 @@ class is generic then it will be a type constructor of higher kind. |
2166 | 2163 | FLAGS = [ |
2167 | 2164 | 'is_abstract', 'is_enum', 'fallback_to_any', 'is_named_tuple', |
2168 | 2165 | 'is_newtype', 'is_protocol', 'runtime_protocol' |
2169 | | - ] |
| 2166 | + ] # type: ClassVar[List[str]] |
2170 | 2167 |
|
2171 | 2168 | def __init__(self, names: 'SymbolTable', defn: ClassDef, module_name: str) -> None: |
2172 | 2169 | """Initialize a TypeInfo.""" |
|
0 commit comments