Skip to content

Commit 0e6e9c6

Browse files
TH3CHARLieilevkivskyi
authored andcommitted
replace @abstractproperty usage in mypy (#8310)
1 parent 5d8c0cd commit 0e6e9c6

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

mypy/plugin.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class C: pass
119119
semantic analyzer is enabled (it's always true in mypy 0.730 and later).
120120
"""
121121

122-
from abc import abstractmethod, abstractproperty
122+
from abc import abstractmethod
123123
from typing import Any, Callable, List, Tuple, Optional, NamedTuple, TypeVar, Dict
124124
from mypy_extensions import trait, mypyc_attr
125125

@@ -214,7 +214,8 @@ class CheckerPluginInterface:
214214
path = None # type: str
215215

216216
# Type context for type inference
217-
@abstractproperty
217+
@property
218+
@abstractmethod
218219
def type_context(self) -> List[Optional[Type]]:
219220
"""Return the type context of the plugin"""
220221
raise NotImplementedError
@@ -348,7 +349,8 @@ def defer(self) -> None:
348349
"""
349350
raise NotImplementedError
350351

351-
@abstractproperty
352+
@property
353+
@abstractmethod
352354
def final_iteration(self) -> bool:
353355
"""Is this the final iteration of semantic analysis?"""
354356
raise NotImplementedError

mypy/semanal_shared.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Shared definitions used by different parts of semantic analysis."""
22

3-
from abc import abstractmethod, abstractproperty
3+
from abc import abstractmethod
44

55
from typing import Optional, List, Callable
66
from typing_extensions import Final
@@ -67,7 +67,8 @@ def is_incomplete_namespace(self, fullname: str) -> bool:
6767
"""Is a module or class namespace potentially missing some definitions?"""
6868
raise NotImplementedError
6969

70-
@abstractproperty
70+
@property
71+
@abstractmethod
7172
def final_iteration(self) -> bool:
7273
"""Is this the final iteration of semantic analysis?"""
7374
raise NotImplementedError
@@ -156,7 +157,8 @@ def parse_bool(self, expr: Expression) -> Optional[bool]:
156157
def qualified_name(self, n: str) -> str:
157158
raise NotImplementedError
158159

159-
@abstractproperty
160+
@property
161+
@abstractmethod
160162
def is_typeshed_stub_file(self) -> bool:
161163
raise NotImplementedError
162164

0 commit comments

Comments
 (0)