Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/click/__init__.py: 85%
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 group as group
22from .decorators import help_option as help_option
23from .decorators import make_pass_decorator as make_pass_decorator
24from .decorators import option as option
25from .decorators import pass_context as pass_context
26from .decorators import pass_obj as pass_obj
27from .decorators import password_option as password_option
28from .decorators import version_option as version_option
29from .exceptions import Abort as Abort
30from .exceptions import BadArgumentUsage as BadArgumentUsage
31from .exceptions import BadOptionUsage as BadOptionUsage
32from .exceptions import BadParameter as BadParameter
33from .exceptions import ClickException as ClickException
34from .exceptions import FileError as FileError
35from .exceptions import MissingParameter as MissingParameter
36from .exceptions import NoSuchCommand as NoSuchCommand
37from .exceptions import NoSuchOption as NoSuchOption
38from .exceptions import UsageError as UsageError
39from .formatting import HelpFormatter as HelpFormatter
40from .formatting import wrap_text as wrap_text
41from .globals import get_current_context as get_current_context
42from .termui import clear as clear
43from .termui import confirm as confirm
44from .termui import echo_via_pager as echo_via_pager
45from .termui import edit as edit
46from .termui import get_pager_file as get_pager_file
47from .termui import getchar as getchar
48from .termui import launch as launch
49from .termui import pause as pause
50from .termui import progressbar as progressbar
51from .termui import prompt as prompt
52from .termui import secho as secho
53from .termui import style as style
54from .termui import unstyle as unstyle
55from .types import BOOL as BOOL
56from .types import Choice as Choice
57from .types import DateTime as DateTime
58from .types import File as File
59from .types import FLOAT as FLOAT
60from .types import FloatRange as FloatRange
61from .types import INT as INT
62from .types import IntRange as IntRange
63from .types import ParamType as ParamType
64from .types import Path as Path
65from .types import STRING as STRING
66from .types import Tuple as Tuple
67from .types import UNPROCESSED as UNPROCESSED
68from .types import UUID as UUID
69from .utils import echo as echo
70from .utils import format_filename as format_filename
71from .utils import get_app_dir as get_app_dir
72from .utils import get_binary_stream as get_binary_stream
73from .utils import get_text_stream as get_text_stream
74from .utils import open_file as open_file
77def __getattr__(name: str) -> object:
78 import warnings
80 if name == "BaseCommand":
81 from .core import _BaseCommand
83 warnings.warn(
84 "'BaseCommand' is deprecated and will be removed in Click 9.0. Use"
85 " 'Command' instead.",
86 DeprecationWarning,
87 stacklevel=2,
88 )
89 return _BaseCommand
91 if name == "MultiCommand":
92 from .core import _MultiCommand
94 warnings.warn(
95 "'MultiCommand' is deprecated and will be removed in Click 9.0. Use"
96 " 'Group' instead.",
97 DeprecationWarning,
98 stacklevel=2,
99 )
100 return _MultiCommand
102 if name == "OptionParser":
103 from .parser import _OptionParser
105 warnings.warn(
106 "'OptionParser' is deprecated and will be removed in Click 9.0. The"
107 " old parser is available in 'optparse'.",
108 DeprecationWarning,
109 stacklevel=2,
110 )
111 return _OptionParser
113 if name == "__version__":
114 import importlib.metadata
115 import warnings
117 warnings.warn(
118 "The '__version__' attribute is deprecated and will be removed in"
119 " Click 9.1. Use feature detection or"
120 " 'importlib.metadata.version(\"click\")' instead.",
121 DeprecationWarning,
122 stacklevel=2,
123 )
124 return importlib.metadata.version("click")
126 raise AttributeError(name)