File: deprecate.py

package info (click to toggle)
python-authlib 1.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,016 kB
  • sloc: python: 26,998; makefile: 53; sh: 14
file content (18 lines) | stat: -rw-r--r-- 506 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import warnings


class AuthlibDeprecationWarning(DeprecationWarning):
    pass


warnings.simplefilter("always", AuthlibDeprecationWarning)


def deprecate(message, version=None, link_uid=None, link_file=None, stacklevel=3):
    if version:
        message += f"\nIt will be compatible before version {version}."

    if link_uid and link_file:
        message += f"\nRead more <https://git.io/{link_uid}#file-{link_file}-md>"

    warnings.warn(AuthlibDeprecationWarning(message), stacklevel=stacklevel)