Part of twisted.python View Source
Deprecation framework for Twisted.
To mark a method or function as being deprecated do this:def badAPI(self, first, second): ''' Docstring for badAPI. ''' ... badAPI = deprecate(Version("Twisted", 8, 0, 0))(badAPI)
The newly-decorated badAPI will issue a warning when called. It will also have a deprecation notice appended to its docstring.
See alsoVersion
.
Function | getWarningMethod | Return the warning method currently used to record deprecation warnings. |
Function | setWarningMethod | Set the warning method to use to record deprecation warnings. |
Function | getDeprecationWarningString | Return a string indicating that the callable was deprecated in the given version. |
Function | deprecated | Return a decorator that marks callables as deprecated. |
Function | _getDeprecationDocstring | Undocumented |
Function | _appendToDocstring | Append the given text to the docstring of thingWithDoc .
|
Set the warning method to use to record deprecation warnings.
The callable should take message, category and stacklevel. The return value is ignored.Parameters | callableThing | A callable to be deprecated. |
version | The twisted.python.versions.Version
that the callable was deprecated in.
| |
Returns | A string describing the deprecation. |
Parameters | version | The version in which the callable will be marked as having been
deprecated. The decorated function will be annotated with this version,
having it set as its deprecatedVersion attribute.
(type: twisted.python.versions.Version
) |
Append the given text to the docstring of thingWithDoc
.
thingWithDoc
has no docstring, then the text just
replaces the docstring. If it has a single-line docstring then it appends a
blank line and the message text. If it has a multi-line docstring, then in
appends a blank line a the message text, and also does the indentation
correctly.