| 1 |
""" |
| 2 |
Click is a simple Python module inspired by the stdlib optparse to make |
| 3 |
writing command line scripts fun. Unlike other modules, it's based |
| 4 |
around a simple API that does not come with too much magic and is |
| 5 |
composable. |
| 6 |
""" |
| 7 |
|
| 8 |
from __future__ import annotations |
| 9 |
|
| 10 |
from .core import Argument as Argument |
| 11 |
from .core import Command as Command |
| 12 |
from .core import CommandCollection as CommandCollection |
| 13 |
from .core import Context as Context |
| 14 |
from .core import Group as Group |
| 15 |
from .core import Option as Option |
| 16 |
from .core import Parameter as Parameter |
| 17 |
from .decorators import argument as argument |
| 18 |
from .decorators import command as command |
| 19 |
from .decorators import confirmation_option as confirmation_option |
| 20 |
from .decorators import group as group |
| 21 |
from .decorators import help_option as help_option |
| 22 |
from .decorators import make_pass_decorator as make_pass_decorator |
| 23 |
from .decorators import option as option |
| 24 |
from .decorators import pass_context as pass_context |
| 25 |
from .decorators import pass_obj as pass_obj |
| 26 |
from .decorators import password_option as password_option |
| 27 |
from .decorators import version_option as version_option |
| 28 |
from .exceptions import Abort as Abort |
| 29 |
from .exceptions import BadArgumentUsage as BadArgumentUsage |
| 30 |
from .exceptions import BadOptionUsage as BadOptionUsage |
| 31 |
from .exceptions import BadParameter as BadParameter |
| 32 |
from .exceptions import ClickException as ClickException |
| 33 |
from .exceptions import FileError as FileError |
| 34 |
from .exceptions import MissingParameter as MissingParameter |
| 35 |
from .exceptions import NoSuchOption as NoSuchOption |
| 36 |
from .exceptions import UsageError as UsageError |
| 37 |
from .formatting import HelpFormatter as HelpFormatter |
| 38 |
from .formatting import wrap_text as wrap_text |
| 39 |
from .globals import get_current_context as get_current_context |
| 40 |
from .termui import clear as clear |
| 41 |
from .termui import confirm as confirm |
| 42 |
from .termui import echo_via_pager as echo_via_pager |
| 43 |
from .termui import edit as edit |
| 44 |
from .termui import getchar as getchar |
| 45 |
from .termui import launch as launch |
| 46 |
from .termui import pause as pause |
| 47 |
from .termui import progressbar as progressbar |
| 48 |
from .termui import prompt as prompt |
| 49 |
from .termui import secho as secho |
| 50 |
from .termui import style as style |
| 51 |
from .termui import unstyle as unstyle |
| 52 |
from .types import BOOL as BOOL |
| 53 |
from .types import Choice as Choice |
| 54 |
from .types import DateTime as DateTime |
| 55 |
from .types import File as File |
| 56 |
from .types import FLOAT as FLOAT |
| 57 |
from .types import FloatRange as FloatRange |
| 58 |
from .types import INT as INT |
| 59 |
from .types import IntRange as IntRange |
| 60 |
from .types import ParamType as ParamType |
| 61 |
from .types import Path as Path |
| 62 |
from .types import STRING as STRING |
| 63 |
from .types import Tuple as Tuple |
| 64 |
from .types import UNPROCESSED as UNPROCESSED |
| 65 |
from .types import UUID as UUID |
| 66 |
from .utils import echo as echo |
| 67 |
from .utils import format_filename as format_filename |
| 68 |
from .utils import get_app_dir as get_app_dir |
| 69 |
from .utils import get_binary_stream as get_binary_stream |
| 70 |
from .utils import get_text_stream as get_text_stream |
| 71 |
from .utils import open_file as open_file |
| 72 |
|
| 73 |
|
| 74 |
def __getattr__(name: str) -> object: |
| 75 |
import warnings |
| 76 |
|
| 77 |
if name == "BaseCommand": |
| 78 |
from .core import _BaseCommand |
| 79 |
|
| 80 |
warnings.warn( |
| 81 |
"'BaseCommand' is deprecated and will be removed in Click 9.0. Use" |
| 82 |
" 'Command' instead.", |
| 83 |
DeprecationWarning, |
| 84 |
stacklevel=2, |
| 85 |
) |
| 86 |
return _BaseCommand |
| 87 |
|
| 88 |
if name == "MultiCommand": |
| 89 |
from .core import _MultiCommand |
| 90 |
|
| 91 |
warnings.warn( |
| 92 |
"'MultiCommand' is deprecated and will be removed in Click 9.0. Use" |
| 93 |
" 'Group' instead.", |
| 94 |
DeprecationWarning, |
| 95 |
stacklevel=2, |
| 96 |
) |
| 97 |
return _MultiCommand |
| 98 |
|
| 99 |
if name == "OptionParser": |
| 100 |
from .parser import _OptionParser |
| 101 |
|
| 102 |
warnings.warn( |
| 103 |
"'OptionParser' is deprecated and will be removed in Click 9.0. The" |
| 104 |
" old parser is available in 'optparse'.", |
| 105 |
DeprecationWarning, |
| 106 |
stacklevel=2, |
| 107 |
) |
| 108 |
return _OptionParser |
| 109 |
|
| 110 |
if name == "__version__": |
| 111 |
import importlib.metadata |
| 112 |
import warnings |
| 113 |
|
| 114 |
warnings.warn( |
| 115 |
"The '__version__' attribute is deprecated and will be removed in" |
| 116 |
" Click 9.1. Use feature detection or" |
| 117 |
" 'importlib.metadata.version(\"click\")' instead.", |
| 118 |
DeprecationWarning, |
| 119 |
stacklevel=2, |
| 120 |
) |
| 121 |
return importlib.metadata.version("click") |
| 122 |
|
| 123 |
raise AttributeError(name) |