massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / click / click / decorators.pyi
1 from _typeshed import IdentityFunction
2 from distutils.version import Version
3 from typing import Any, Callable, Iterable, Text, Type, TypeVar, Union, overload
4
5 from click.core import Argument, Command, Context, Group, Option, Parameter, _ConvertibleType
6
7 _T = TypeVar("_T")
8 _F = TypeVar("_F", bound=Callable[..., Any])
9
10 _Callback = Callable[[Context, Union[Option, Parameter], Any], Any]
11
12 def pass_context(__f: _T) -> _T: ...
13 def pass_obj(__f: _T) -> _T: ...
14 def make_pass_decorator(object_type: type, ensure: bool = ...) -> IdentityFunction: ...
15
16 # NOTE: Decorators below have **attrs converted to concrete constructor
17 # arguments from core.pyi to help with type checking.
18
19 def command(
20     name: str | None = ...,
21     cls: Type[Command] | None = ...,
22     # Command
23     context_settings: dict[Any, Any] | None = ...,
24     help: str | None = ...,
25     epilog: str | None = ...,
26     short_help: str | None = ...,
27     options_metavar: str = ...,
28     add_help_option: bool = ...,
29     no_args_is_help: bool = ...,
30     hidden: bool = ...,
31     deprecated: bool = ...,
32 ) -> Callable[[Callable[..., Any]], Command]: ...
33
34 # This inherits attrs from Group, MultiCommand and Command.
35
36 def group(
37     name: str | None = ...,
38     cls: Type[Command] = ...,
39     # Group
40     commands: dict[str, Command] | None = ...,
41     # MultiCommand
42     invoke_without_command: bool = ...,
43     no_args_is_help: bool | None = ...,
44     subcommand_metavar: str | None = ...,
45     chain: bool = ...,
46     result_callback: Callable[..., Any] | None = ...,
47     # Command
48     help: str | None = ...,
49     epilog: str | None = ...,
50     short_help: str | None = ...,
51     options_metavar: str = ...,
52     add_help_option: bool = ...,
53     hidden: bool = ...,
54     deprecated: bool = ...,
55     # User-defined
56     **kwargs: Any,
57 ) -> Callable[[Callable[..., Any]], Group]: ...
58 def argument(
59     *param_decls: Text,
60     cls: Type[Argument] = ...,
61     # Argument
62     required: bool | None = ...,
63     # Parameter
64     type: _ConvertibleType | None = ...,
65     default: Any | None = ...,
66     callback: _Callback | None = ...,
67     nargs: int | None = ...,
68     metavar: str | None = ...,
69     expose_value: bool = ...,
70     is_eager: bool = ...,
71     envvar: str | list[str] | None = ...,
72     autocompletion: Callable[[Context, list[str], str], Iterable[str | tuple[str, str]]] | None = ...,
73 ) -> IdentityFunction: ...
74 @overload
75 def option(
76     *param_decls: Text,
77     cls: Type[Option] = ...,
78     # Option
79     show_default: bool | Text = ...,
80     prompt: bool | Text = ...,
81     confirmation_prompt: bool = ...,
82     hide_input: bool = ...,
83     is_flag: bool | None = ...,
84     flag_value: Any | None = ...,
85     multiple: bool = ...,
86     count: bool = ...,
87     allow_from_autoenv: bool = ...,
88     type: _ConvertibleType | None = ...,
89     help: Text | None = ...,
90     show_choices: bool = ...,
91     # Parameter
92     default: Any | None = ...,
93     required: bool = ...,
94     callback: _Callback | None = ...,
95     nargs: int | None = ...,
96     metavar: str | None = ...,
97     expose_value: bool = ...,
98     is_eager: bool = ...,
99     envvar: str | list[str] | None = ...,
100     # User-defined
101     **kwargs: Any,
102 ) -> IdentityFunction: ...
103 @overload
104 def option(
105     *param_decls: str,
106     cls: Type[Option] = ...,
107     # Option
108     show_default: bool | Text = ...,
109     prompt: bool | Text = ...,
110     confirmation_prompt: bool = ...,
111     hide_input: bool = ...,
112     is_flag: bool | None = ...,
113     flag_value: Any | None = ...,
114     multiple: bool = ...,
115     count: bool = ...,
116     allow_from_autoenv: bool = ...,
117     type: _T = ...,
118     help: str | None = ...,
119     show_choices: bool = ...,
120     # Parameter
121     default: Any | None = ...,
122     required: bool = ...,
123     callback: Callable[[Context, Option | Parameter, bool | int | str], _T] | None = ...,
124     nargs: int | None = ...,
125     metavar: str | None = ...,
126     expose_value: bool = ...,
127     is_eager: bool = ...,
128     envvar: str | list[str] | None = ...,
129     # User-defined
130     **kwargs: Any,
131 ) -> IdentityFunction: ...
132 @overload
133 def option(
134     *param_decls: str,
135     cls: Type[Option] = ...,
136     # Option
137     show_default: bool | Text = ...,
138     prompt: bool | Text = ...,
139     confirmation_prompt: bool = ...,
140     hide_input: bool = ...,
141     is_flag: bool | None = ...,
142     flag_value: Any | None = ...,
143     multiple: bool = ...,
144     count: bool = ...,
145     allow_from_autoenv: bool = ...,
146     type: Type[str] = ...,
147     help: str | None = ...,
148     show_choices: bool = ...,
149     # Parameter
150     default: Any | None = ...,
151     required: bool = ...,
152     callback: Callable[[Context, Option | Parameter, str], Any] = ...,
153     nargs: int | None = ...,
154     metavar: str | None = ...,
155     expose_value: bool = ...,
156     is_eager: bool = ...,
157     envvar: str | list[str] | None = ...,
158     # User-defined
159     **kwargs: Any,
160 ) -> IdentityFunction: ...
161 @overload
162 def option(
163     *param_decls: str,
164     cls: Type[Option] = ...,
165     # Option
166     show_default: bool | Text = ...,
167     prompt: bool | Text = ...,
168     confirmation_prompt: bool = ...,
169     hide_input: bool = ...,
170     is_flag: bool | None = ...,
171     flag_value: Any | None = ...,
172     multiple: bool = ...,
173     count: bool = ...,
174     allow_from_autoenv: bool = ...,
175     type: Type[int] = ...,
176     help: str | None = ...,
177     show_choices: bool = ...,
178     # Parameter
179     default: Any | None = ...,
180     required: bool = ...,
181     callback: Callable[[Context, Option | Parameter, int], Any] = ...,
182     nargs: int | None = ...,
183     metavar: str | None = ...,
184     expose_value: bool = ...,
185     is_eager: bool = ...,
186     envvar: str | list[str] | None = ...,
187     # User-defined
188     **kwargs: Any,
189 ) -> IdentityFunction: ...
190 def confirmation_option(
191     *param_decls: str,
192     cls: Type[Option] = ...,
193     # Option
194     show_default: bool | Text = ...,
195     prompt: bool | Text = ...,
196     confirmation_prompt: bool = ...,
197     hide_input: bool = ...,
198     is_flag: bool = ...,
199     flag_value: Any | None = ...,
200     multiple: bool = ...,
201     count: bool = ...,
202     allow_from_autoenv: bool = ...,
203     type: _ConvertibleType | None = ...,
204     help: str = ...,
205     show_choices: bool = ...,
206     # Parameter
207     default: Any | None = ...,
208     callback: _Callback | None = ...,
209     nargs: int | None = ...,
210     metavar: str | None = ...,
211     expose_value: bool = ...,
212     is_eager: bool = ...,
213     envvar: str | list[str] | None = ...,
214 ) -> IdentityFunction: ...
215 def password_option(
216     *param_decls: str,
217     cls: Type[Option] = ...,
218     # Option
219     show_default: bool | Text = ...,
220     prompt: bool | Text = ...,
221     confirmation_prompt: bool = ...,
222     hide_input: bool = ...,
223     is_flag: bool | None = ...,
224     flag_value: Any | None = ...,
225     multiple: bool = ...,
226     count: bool = ...,
227     allow_from_autoenv: bool = ...,
228     type: _ConvertibleType | None = ...,
229     help: str | None = ...,
230     show_choices: bool = ...,
231     # Parameter
232     default: Any | None = ...,
233     callback: _Callback | None = ...,
234     nargs: int | None = ...,
235     metavar: str | None = ...,
236     expose_value: bool = ...,
237     is_eager: bool = ...,
238     envvar: str | list[str] | None = ...,
239 ) -> IdentityFunction: ...
240 def version_option(
241     version: str | Version | None = ...,
242     *param_decls: str,
243     cls: Type[Option] = ...,
244     # Option
245     prog_name: str | None = ...,
246     message: str | None = ...,
247     show_default: bool | Text = ...,
248     prompt: bool | Text = ...,
249     confirmation_prompt: bool = ...,
250     hide_input: bool = ...,
251     is_flag: bool = ...,
252     flag_value: Any | None = ...,
253     multiple: bool = ...,
254     count: bool = ...,
255     allow_from_autoenv: bool = ...,
256     type: _ConvertibleType | None = ...,
257     help: str = ...,
258     show_choices: bool = ...,
259     # Parameter
260     default: Any | None = ...,
261     callback: _Callback | None = ...,
262     nargs: int | None = ...,
263     metavar: str | None = ...,
264     expose_value: bool = ...,
265     is_eager: bool = ...,
266     envvar: str | list[str] | None = ...,
267 ) -> IdentityFunction: ...
268 def help_option(
269     *param_decls: str,
270     cls: Type[Option] = ...,
271     # Option
272     show_default: bool | Text = ...,
273     prompt: bool | Text = ...,
274     confirmation_prompt: bool = ...,
275     hide_input: bool = ...,
276     is_flag: bool = ...,
277     flag_value: Any | None = ...,
278     multiple: bool = ...,
279     count: bool = ...,
280     allow_from_autoenv: bool = ...,
281     type: _ConvertibleType | None = ...,
282     help: str = ...,
283     show_choices: bool = ...,
284     # Parameter
285     default: Any | None = ...,
286     callback: _Callback | None = ...,
287     nargs: int | None = ...,
288     metavar: str | None = ...,
289     expose_value: bool = ...,
290     is_eager: bool = ...,
291     envvar: str | list[str] | None = ...,
292 ) -> IdentityFunction: ...