Skip to content

Commit 5c117dd

Browse files
bpo-35609: Remove examples for deprecated decorators in the abc module. (pythonGH-11355)
1 parent 7108aab commit 5c117dd

File tree

1 file changed

+5
-46
lines changed

1 file changed

+5
-46
lines changed

Lib/abc.py

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def abstractmethod(funcobj):
1111
class that has a metaclass derived from ABCMeta cannot be
1212
instantiated unless all of its abstract methods are overridden.
1313
The abstract methods can be called using any of the normal
14-
'super' call mechanisms.
14+
'super' call mechanisms. abstractmethod() may be used to declare
15+
abstract methods for properties and descriptors.
1516
1617
Usage:
1718
@@ -27,17 +28,7 @@ def my_abstract_method(self, ...):
2728
class abstractclassmethod(classmethod):
2829
"""A decorator indicating abstract classmethods.
2930
30-
Similar to abstractmethod.
31-
32-
Usage:
33-
34-
class C(metaclass=ABCMeta):
35-
@abstractclassmethod
36-
def my_abstract_classmethod(cls, ...):
37-
...
38-
39-
'abstractclassmethod' is deprecated. Use 'classmethod' with
40-
'abstractmethod' instead.
31+
Deprecated, use 'classmethod' with 'abstractmethod' instead.
4132
"""
4233

4334
__isabstractmethod__ = True
@@ -50,17 +41,7 @@ def __init__(self, callable):
5041
class abstractstaticmethod(staticmethod):
5142
"""A decorator indicating abstract staticmethods.
5243
53-
Similar to abstractmethod.
54-
55-
Usage:
56-
57-
class C(metaclass=ABCMeta):
58-
@abstractstaticmethod
59-
def my_abstract_staticmethod(...):
60-
...
61-
62-
'abstractstaticmethod' is deprecated. Use 'staticmethod' with
63-
'abstractmethod' instead.
44+
Deprecated, use 'staticmethod' with 'abstractmethod' instead.
6445
"""
6546

6647
__isabstractmethod__ = True
@@ -73,29 +54,7 @@ def __init__(self, callable):
7354
class abstractproperty(property):
7455
"""A decorator indicating abstract properties.
7556
76-
Requires that the metaclass is ABCMeta or derived from it. A
77-
class that has a metaclass derived from ABCMeta cannot be
78-
instantiated unless all of its abstract properties are overridden.
79-
The abstract properties can be called using any of the normal
80-
'super' call mechanisms.
81-
82-
Usage:
83-
84-
class C(metaclass=ABCMeta):
85-
@abstractproperty
86-
def my_abstract_property(self):
87-
...
88-
89-
This defines a read-only property; you can also define a read-write
90-
abstract property using the 'long' form of property declaration:
91-
92-
class C(metaclass=ABCMeta):
93-
def getx(self): ...
94-
def setx(self, value): ...
95-
x = abstractproperty(getx, setx)
96-
97-
'abstractproperty' is deprecated. Use 'property' with 'abstractmethod'
98-
instead.
57+
Deprecated, use 'property' with 'abstractmethod' instead.
9958
"""
10059

10160
__isabstractmethod__ = True

0 commit comments

Comments
 (0)