A decorator that warns about deprecation when the passed-in function is invoked.
(func, name)
| 149 | |
| 150 | |
| 151 | def _deprecated(func, name): |
| 152 | """A decorator that warns about deprecation when the passed-in function is |
| 153 | invoked.""" |
| 154 | @wraps(func) |
| 155 | def with_warning(*args, **kwargs): |
| 156 | warnings.warn( |
| 157 | ('The %s method is deprecated and will be removed in v2.*.*' % |
| 158 | name), |
| 159 | DeprecationWarning |
| 160 | ) |
| 161 | return func(*args, **kwargs) |
| 162 | return with_warning |
| 163 | |
| 164 | |
| 165 | class Hashids(object): |