Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/click/__init__.py: 81%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2Click is a simple Python module inspired by the stdlib optparse to make
3writing command line scripts fun. Unlike other modules, it's based
4around a simple API that does not come with too much magic and is
5composable.
6"""
8from __future__ import annotations
10from .core import Argument as Argument
11from .core import Command as Command
12from .core import CommandCollection as CommandCollection
13from .core import Context as Context
14from .core import Group as Group
15from .core import Option as Option
16from .core import Parameter as Parameter
17from .core import ParameterSource as ParameterSource
18from .decorators import argument as argument
19from .decorators import command as command
20from .decorators import confirmation_option as confirmation_option
21from .decorators import custom_version_option as custom_version_option
22from .decorators import group as group
23from .decorators import help_option as help_option
24from .decorators import make_pass_decorator as make_pass_decorator
25from .decorators import option as option
26from .decorators import pass_context as pass_context
27from .decorators import pass_obj as pass_obj
28from .decorators import password_option as password_option
29from .decorators import version_option as version_option
30from .exceptions import Abort as Abort
31from .exceptions import BadArgumentUsage as BadArgumentUsage
32from .exceptions import BadOptionUsage as BadOptionUsage
33from .exceptions import BadParameter as BadParameter
34from .exceptions import ClickException as ClickException
35from .exceptions import FileError as FileError
36from .exceptions import MissingParameter as MissingParameter
37from .exceptions import NoSuchCommand as NoSuchCommand
38from .exceptions import NoSuchOption as NoSuchOption
39from .exceptions import UsageError as UsageError
40from .formatting import HelpFormatter as HelpFormatter
41from .formatting import wrap_text as wrap_text
42from .globals import get_current_context as get_current_context
43from .termui import clear as clear
44from .termui import confirm as confirm
45from .termui import echo_via_pager as echo_via_pager
46from .termui import edit as edit
47from .termui import get_pager_file as get_pager_file
48from .termui import getchar as getchar
49from .termui import launch as launch
50from .termui import pause as pause
51from .termui import progressbar as progressbar
52from .termui import prompt as prompt
53from .termui import secho as secho
54from .termui import style as style
55from .termui import unstyle as unstyle
56from .types import BOOL as BOOL
57from .types import Choice as Choice
58from .types import DateTime as DateTime
59from .types import File as File
60from .types import FLOAT as FLOAT
61from .types import FloatRange as FloatRange
62from .types import INT as INT
63from .types import IntRange as IntRange
64from .types import ParamType as ParamType
65from .types import Path as Path
66from .types import STRING as STRING
67from .types import Tuple as Tuple
68from .types import UNPROCESSED as UNPROCESSED
69from .types import UUID as UUID
70from .utils import echo as echo
71from .utils import format_filename as format_filename
72from .utils import get_app_dir as get_app_dir
73from .utils import open_file as open_file
76def __getattr__(name: str) -> object:
77 import warnings
79 if name == "BaseCommand":
80 from .core import _BaseCommand
82 warnings.warn(
83 "'BaseCommand' is deprecated and will be removed in Click 9.0. Use"
84 " 'Command' instead.",
85 DeprecationWarning,
86 stacklevel=2,
87 )
88 return _BaseCommand
90 if name == "MultiCommand":
91 from .core import _MultiCommand
93 warnings.warn(
94 "'MultiCommand' is deprecated and will be removed in Click 9.0. Use"
95 " 'Group' instead.",
96 DeprecationWarning,
97 stacklevel=2,
98 )
99 return _MultiCommand
101 if name == "OptionParser":
102 from .parser import _OptionParser
104 warnings.warn(
105 "'OptionParser' is deprecated and will be removed in Click 9.0. The"
106 " old parser is available in 'optparse'.",
107 DeprecationWarning,
108 stacklevel=2,
109 )
110 return _OptionParser
112 if name == "__version__":
113 import importlib.metadata
115 warnings.warn(
116 "The '__version__' attribute is deprecated and will be removed in"
117 " Click 9.1. Use feature detection or"
118 " 'importlib.metadata.version(\"click\")' instead.",
119 DeprecationWarning,
120 stacklevel=2,
121 )
122 return importlib.metadata.version("click")
124 if name == "get_binary_stream":
125 from .utils import _get_binary_stream
127 warnings.warn(
128 "'get_binary_stream' is deprecated and will be removed in Click 9.0.",
129 DeprecationWarning,
130 stacklevel=2,
131 )
132 return _get_binary_stream
134 if name == "get_text_stream":
135 from .utils import _get_text_stream
137 warnings.warn(
138 "'get_text_stream' is deprecated and will be removed in Click 9.0.",
139 DeprecationWarning,
140 stacklevel=2,
141 )
142 return _get_text_stream
144 raise AttributeError(name)