1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
# Deprecated Decorator
Python ``@deprecated`` decorator to deprecate old python classes, functions or methods.
[](https://raw.githubusercontent.com/laurent-laporte-pro/deprecated/master/LICENSE.rst)
[](https://github.com/laurent-laporte-pro/deprecated/releases/latest)
[](https://pypi.org/project/Deprecated/)
[](https://github.com/laurent-laporte-pro/deprecated/actions/workflows/python-package.yml)
[](https://coveralls.io/github/laurent-laporte-pro/deprecated?branch=master)
[
](http://deprecated.readthedocs.io/en/latest/?badge=latest)
## Installation
```shell
pip install Deprecated
```
## Usage
To use this, decorate your deprecated function with **@deprecated** decorator:
```python
from deprecated import deprecated
@deprecated
def some_old_function(x, y):
return x + y
```
You can also decorate a class or a method:
```python
from deprecated import deprecated
class SomeClass(object):
@deprecated
def some_old_method(self, x, y):
return x + y
@deprecated
class SomeOldClass(object):
pass
```
You can give a "reason" message to help the developer to choose another function/class:
```python
from deprecated import deprecated
@deprecated(reason="use another function")
def some_old_function(x, y):
return x + y
```
## Authors
The authors of this library are:
[Marcos CARDOSO](https://github.com/vrcmarcos), and
[Laurent LAPORTE](https://github.com/laurent-laporte-pro).
The original code was made in [this StackOverflow post](https://stackoverflow.com/questions/2536307) by
[Leandro REGUEIRO](https://stackoverflow.com/users/1336250/leandro-regueiro),
[Patrizio BERTONI](https://stackoverflow.com/users/1315480/patrizio-bertoni), and
[Eric WIESER](https://stackoverflow.com/users/102441/eric).
|