Custom warning class for deprecations in this library. .. versionchanged:: 20.0 Renamed TelegramDeprecationWarning to PTBDeprecationWarning. Args: version (:obj:`str`): The version in which the feature was deprecated. .. versionadded:: 21.2 message
| 49 | # DeprecationWarning. We also subclass from PTBUserWarning so users can easily 'switch off' |
| 50 | # warnings |
| 51 | class PTBDeprecationWarning(PTBUserWarning, DeprecationWarning): |
| 52 | """ |
| 53 | Custom warning class for deprecations in this library. |
| 54 | |
| 55 | .. versionchanged:: 20.0 |
| 56 | Renamed TelegramDeprecationWarning to PTBDeprecationWarning. |
| 57 | |
| 58 | Args: |
| 59 | version (:obj:`str`): The version in which the feature was deprecated. |
| 60 | |
| 61 | .. versionadded:: 21.2 |
| 62 | message (:obj:`str`): The message to display. |
| 63 | |
| 64 | .. versionadded:: 21.2 |
| 65 | |
| 66 | Attributes: |
| 67 | version (:obj:`str`): The version in which the feature was deprecated. |
| 68 | |
| 69 | .. versionadded:: 21.2 |
| 70 | message (:obj:`str`): The message to display. |
| 71 | |
| 72 | .. versionadded:: 21.2 |
| 73 | """ |
| 74 | |
| 75 | __slots__ = ("message", "version") |
| 76 | |
| 77 | def __init__(self, version: str, message: str) -> None: |
| 78 | self.version: str = version |
| 79 | self.message: str = message |
| 80 | |
| 81 | def __str__(self) -> str: |
| 82 | """Returns a string representation of the warning, using :attr:`message` and |
| 83 | :attr:`version`. |
| 84 | |
| 85 | .. versionadded:: 21.2 |
| 86 | """ |
| 87 | return f"Deprecated since version {self.version}: {self.message}" |
no outgoing calls
searching dependent graphs…