Skip to content

Commit 9683ed4

Browse files
Stop using @abstractproperty which is deprecated.
1 parent 9aaa3e6 commit 9683ed4

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/prompt_toolkit/input/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from __future__ import annotations
66

7-
from abc import ABCMeta, abstractmethod, abstractproperty
7+
from abc import ABCMeta, abstractmethod
88
from contextlib import contextmanager
99
from typing import Callable, ContextManager, Generator
1010

@@ -55,7 +55,8 @@ def flush(self) -> None:
5555
"The event loop can call this when the input has to be flushed."
5656
pass
5757

58-
@abstractproperty
58+
@property
59+
@abstractmethod
5960
def closed(self) -> bool:
6061
"Should be true when the input stream is closed."
6162
return False

src/prompt_toolkit/key_binding/key_bindings.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def my_key_binding(event):
3737

3838
from __future__ import annotations
3939

40-
from abc import ABCMeta, abstractmethod, abstractproperty
40+
from abc import ABCMeta, abstractmethod
4141
from inspect import isawaitable
4242
from typing import (
4343
TYPE_CHECKING,
@@ -155,7 +155,8 @@ class KeyBindingsBase(metaclass=ABCMeta):
155155
Interface for a KeyBindings.
156156
"""
157157

158-
@abstractproperty
158+
@property
159+
@abstractmethod
159160
def _version(self) -> Hashable:
160161
"""
161162
For cache invalidation. - This should increase every time that
@@ -186,7 +187,8 @@ def get_bindings_starting_with_keys(self, keys: KeysTuple) -> list[Binding]:
186187
"""
187188
return []
188189

189-
@abstractproperty
190+
@property
191+
@abstractmethod
190192
def bindings(self) -> list[Binding]:
191193
"""
192194
List of `Binding` objects.

src/prompt_toolkit/styles/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from __future__ import annotations
66

7-
from abc import ABCMeta, abstractmethod, abstractproperty
7+
from abc import ABCMeta, abstractmethod
88
from typing import Callable, Hashable, NamedTuple
99

1010
__all__ = [
@@ -126,7 +126,8 @@ def get_attrs_for_style_str(
126126
:param default: `Attrs` to be used if no styling was defined.
127127
"""
128128

129-
@abstractproperty
129+
@property
130+
@abstractmethod
130131
def style_rules(self) -> list[tuple[str, str]]:
131132
"""
132133
The list of style rules, used to create this style.

0 commit comments

Comments
 (0)