Commit 5c117dd2 authored by Serhiy Storchaka's avatar Serhiy Storchaka Committed by GitHub

bpo-35609: Remove examples for deprecated decorators in the abc module. (GH-11355)

parent 7108aab4
...@@ -11,7 +11,8 @@ def abstractmethod(funcobj): ...@@ -11,7 +11,8 @@ def abstractmethod(funcobj):
class that has a metaclass derived from ABCMeta cannot be class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract methods are overridden. instantiated unless all of its abstract methods are overridden.
The abstract methods can be called using any of the normal The abstract methods can be called using any of the normal
'super' call mechanisms. 'super' call mechanisms. abstractmethod() may be used to declare
abstract methods for properties and descriptors.
Usage: Usage:
...@@ -27,17 +28,7 @@ def abstractmethod(funcobj): ...@@ -27,17 +28,7 @@ def abstractmethod(funcobj):
class abstractclassmethod(classmethod): class abstractclassmethod(classmethod):
"""A decorator indicating abstract classmethods. """A decorator indicating abstract classmethods.
Similar to abstractmethod. Deprecated, use 'classmethod' with 'abstractmethod' instead.
Usage:
class C(metaclass=ABCMeta):
@abstractclassmethod
def my_abstract_classmethod(cls, ...):
...
'abstractclassmethod' is deprecated. Use 'classmethod' with
'abstractmethod' instead.
""" """
__isabstractmethod__ = True __isabstractmethod__ = True
...@@ -50,17 +41,7 @@ class abstractclassmethod(classmethod): ...@@ -50,17 +41,7 @@ class abstractclassmethod(classmethod):
class abstractstaticmethod(staticmethod): class abstractstaticmethod(staticmethod):
"""A decorator indicating abstract staticmethods. """A decorator indicating abstract staticmethods.
Similar to abstractmethod. Deprecated, use 'staticmethod' with 'abstractmethod' instead.
Usage:
class C(metaclass=ABCMeta):
@abstractstaticmethod
def my_abstract_staticmethod(...):
...
'abstractstaticmethod' is deprecated. Use 'staticmethod' with
'abstractmethod' instead.
""" """
__isabstractmethod__ = True __isabstractmethod__ = True
...@@ -73,29 +54,7 @@ class abstractstaticmethod(staticmethod): ...@@ -73,29 +54,7 @@ class abstractstaticmethod(staticmethod):
class abstractproperty(property): class abstractproperty(property):
"""A decorator indicating abstract properties. """A decorator indicating abstract properties.
Requires that the metaclass is ABCMeta or derived from it. A Deprecated, use 'property' with 'abstractmethod' instead.
class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract properties are overridden.
The abstract properties can be called using any of the normal
'super' call mechanisms.
Usage:
class C(metaclass=ABCMeta):
@abstractproperty
def my_abstract_property(self):
...
This defines a read-only property; you can also define a read-write
abstract property using the 'long' form of property declaration:
class C(metaclass=ABCMeta):
def getx(self): ...
def setx(self, value): ...
x = abstractproperty(getx, setx)
'abstractproperty' is deprecated. Use 'property' with 'abstractmethod'
instead.
""" """
__isabstractmethod__ = True __isabstractmethod__ = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment